On Sep 6, 2013, at 9:18 PM, roger(a)rogerchrisman.com wrote:
$wgHooks['SpecialSearchGo'][] = function($t) {
$t = null;
return true;
};
That works. It is live at
http://teflpedia.com now.
What is $t? And what is []?
I don't really know PHP. Could you explain briefly what this snip is doing?
Sure. Mediawiki can be extended by registering functions as hooks. We registered one
designed to let you play with the results of the special search go action. The hook's
first parameter is the found title. We set it to null which in this case is interpreted as
not found. So the search action then proceeds to execute the search against the search
backend and give you the search results.
This is not great for two reasons I can think of right now:
1. The page is still loaded from the database. We just ignore it. This is inefficient.
2. No one is going to maintain this snippet for you and when you upgrade it will break.
Like, crash searches break. You'll have to switch to the other one I sent you. Unless
we change how that hook works again between now and when you upgrade. Sorry, this
isn't really very nice.
Now that I think about it, does the prefix search still work with that hack? By work I
mean you should be able to select one of the entries that pops down under the search box
as you type and it takes you to that article.
Nik
Sorry for typos. iPhone has autocorrect and likes to use it.
Thanks,
Roger :)
_______________________________________________
MediaWiki-l mailing list
MediaWiki-l(a)lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l