r44429 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44428‎ | r44429 | r44430 >
Date:23:06, 10 December 2008
Author:brion
Status:ok
Tags:
Comment:
Revert r44257 "Use boolean searching with '?' char"
Let's avoid making up our own syntax that nobody will know or think to try...
Lucene, Google, Yahoo!, and Windows Live search all understand "red OR lion" but see nothing special in "?red ?lion". If we're going to add it, let's make the OR thing work. :)
Modified paths:
  • /trunk/phase3/includes/SearchEngine.php (modified) (history)
  • /trunk/phase3/includes/SearchMySQL.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SearchEngine.php
@@ -150,7 +150,7 @@
151151 }
152152
153153 public static function legalSearchChars() {
154 - return "A-Za-z_'0-9\\x80-\\xFF\\-\\?";
 154+ return "A-Za-z_'0-9\\x80-\\xFF\\-";
155155 }
156156
157157 /**
Index: trunk/phase3/includes/SearchMySQL.php
@@ -43,18 +43,12 @@
4444
4545 # FIXME: This doesn't handle parenthetical expressions.
4646 $m = array();
47 - if( preg_match_all( '/([-+<>?~]?)(([' . $lc . ']+)(\*?)|"[^"]*")/',
48 - $filteredText, $m, PREG_SET_ORDER ) )
49 - {
 47+ if( preg_match_all( '/([-+<>~]?)(([' . $lc . ']+)(\*?)|"[^"]*")/',
 48+ $filteredText, $m, PREG_SET_ORDER ) ) {
5049 foreach( $m as $terms ) {
5150 if( $searchon !== '' ) $searchon .= ' ';
52 - if( $this->strictMatching ) {
53 - // '' means AND while ? means OR to the user
54 - if( $terms[1] == '' ) {
55 - $terms[1] = '+';
56 - } else if( $terms[1] == '?' ) {
57 - $terms[1] = '';
58 - }
 51+ if( $this->strictMatching && ($terms[1] == '') ) {
 52+ $terms[1] = '+';
5953 }
6054 $searchon .= $terms[1] . $wgContLang->stripForSearch( $terms[2] );
6155 if( !empty( $terms[3] ) ) {

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r44257Use boolean searching with '?' charaaron18:16, 5 December 2008

Status & tagging log