[Mediawiki-l] modify search engine

Scheid, Bernhard Bernhard.Scheid at oeaw.ac.at
Fri Oct 1 15:51:00 UTC 2010


Thank you! However, the hook does not seem to work. Search engine still does not find 'ex<middot>ample'. 


PS. For the time being I have replaced Wiki-Search by Google Site Search which ignores special characters like 'middot', 'shy', etc. and also finds 'examples' if you search 'example'... Extensions like Lucene-search or MWsearch may be costomed to do the same, but for non-specialists like me Google is definitively the easiest way, even if that means hacking the original PHP code of my Wiki. Btw,  it seems high time to further develop the standard Wiki search. 


> As far as I see, the basic feature I need is a kind of parsing before the text is searched, whereby all middots in the text-to-search are eliminated. The other method would be to multiply the term-to-find with middots at every possibly place as you indicated. No idea how to achieve either way nor which one would be "less expensive", but the first way sounds easier...
> Bernhard


That's easy to do.
Smply add to LocalSettings:

$wgHooks['SearchUpdate'] = 'RemoveMiddotsInSearch';
function RemoveMiddotsInSearch( $id, $namespace, $title, &$text ) {
        $text = str_replace( 'middot' , '', $text );
        return true;

(replacing middot with the real middot character)

More information about the MediaWiki-l mailing list