r60831 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60830‎ | r60831 | r60832 >
Date:07:52, 8 January 2010
Author:freakolowsky
Status:ok
Tags:
Comment:
Escaped Oracle Text reserved words
Modified paths:
  • /trunk/phase3/includes/search/SearchOracle.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/search/SearchOracle.php
@@ -27,6 +27,34 @@
2828 * @ingroup Search
2929 */
3030 class SearchOracle extends SearchEngine {
 31+
 32+ private $reservedWords = array ('ABOUT' => 1,
 33+ 'ACCUM' => 1,
 34+ 'AND' => 1,
 35+ 'BT' => 1,
 36+ 'BTG' => 1,
 37+ 'BTI' => 1,
 38+ 'BTP' => 1,
 39+ 'FUZZY' => 1,
 40+ 'HASPATH' => 1,
 41+ 'INPATH' => 1,
 42+ 'MINUS' => 1,
 43+ 'NEAR' => 1,
 44+ 'NOT' => 1,
 45+ 'NT' => 1,
 46+ 'NTG' => 1,
 47+ 'NTI' => 1,
 48+ 'NTP' => 1,
 49+ 'OR' => 1,
 50+ 'PT' => 1,
 51+ 'RT' => 1,
 52+ 'SQE' => 1,
 53+ 'SYN' => 1,
 54+ 'TR' => 1,
 55+ 'TRSYN' => 1,
 56+ 'TT' => 1,
 57+ 'WITHIN' => 1);
 58+
3159 function __construct($db) {
3260 $this->db = $db;
3361 }
@@ -191,6 +219,7 @@
192220 private function escapeTerm($t) {
193221 global $wgContLang;
194222 $t = $wgContLang->stripForSearch($t);
 223+ $t = isset($this->reservedWords[strtoupper($t)]) ? '{'.$t.'}' : $t;
195224 $t = preg_replace('/^"(.*)"$/', '($1)', $t);
196225 $t = preg_replace('/([-&|])/', '\\\\$1', $t);
197226 return $t;

Status & tagging log