Sorry, I meant second :-s
On Sat, Aug 23, 2008 at 8:01 PM, Alex Powell alexp@exscien.com wrote:
Ah. I branched a version of the search functions at 1.11 and directed them towards a centralized text store. THis was done by overriding the Special::SearchPage. I noticed in my code that the legalSearchChars stuff was filtering out " 's from the query, that meant a search:
"fish pie"
would include articles with the string "fish and pie" only in them and not an exact match to "fish pie" only. By adding \x22 to the legal chars in the core class, which in my 1.11 version was called regardless of any derived classes overridden legalSearchChars(). Possibly this issue is fixed in 1.13, but the line remains the same.
BTW the relevance metric for the MySQL search is also quite borked in the 1.13 codebase. It needs to be more like on line 191, SearchMySQL.php:
$match = $this->parseQuery( $filteredTerm, $fulltext );
$m2 = str_replace(" IN BOOLEAN MODE", "", $match);
return "SELECT page_id, page_namespace, page_title, {$m2} as relevance " . "FROM masterwiki.$page, masterwiki.$searchindex " . "WHERE pid=si_masterid AND $match";
That will give properly ranked results - got this from the MySQL man page on free text search:
http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html
First comment.
Hope that helps!
Kind regards,
Alex
On Fri, Aug 22, 2008 at 5:29 PM, Brion Vibber brion@wikimedia.org wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Alex Powell wrote:
Oh and while I'm at it is there any reason why line 161 of \includes\SearchEngine.php cannot be updated to :
return "\x22A-Za-z_'0-9\x80-\xFF\-";
This allows for quoted searches to be passed into the MySQL query
engine. Or
am I introducing a security hole?
Are you looking at a really old version? We've supported quoted searches for a while.
- -- brion
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkiu6XoACgkQwRnhpk1wk452YQCgjvzlBhnremGXVI4xbXJkP1Aw 3nEAn33cADmdwCcgqLJnJfvFWAMaljfn =mo1X -----END PGP SIGNATURE-----
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
-- Alex Powell
Exscien Training Ltd Tel: +44 (0) 1865 876562 Mob: +44 (0) 7717 765210
skype: alexp700 mailto:alexp@exscien.com http://www.exscien.com
Registered in England and Wales 05927635, Unit 10 Wheatley Business Centre, Old London Road, Wheatley, OX33 1XW, England