Last modified: 2014-11-17 09:21:27 UTC
I can't find any non-ugly way to alter the default search box suggestion functionality. I would like to change the namespaces and change rendering format a bit. I checked how Wikidata does their thing, but even they override the whole search box with their own one.
(In reply to Niklas Laxström from comment #0) > I can't find any non-ugly way to alter the default search box suggestion > functionality. I would like to change the namespaces and change rendering > format a bit. Which file were you looking at specifically?
If you're a skin, you can override the 'mediawiki.searchSuggest' module, which is normally loaded, by overriding the Skin::getDefaultModules() method. If you're a ResourceLoader module, you can just depend on 'jquery.suggestions' *and* 'mediawiki.searchSuggest', and then call .suggestions() to override the rendering and selecting behavior (as well as a couple other things, see jquery.suggestions documentation) using code like below (every object key is optional in this call, and missing ones will keep their previous behavior). 'mediawiki.searchSuggest' actually does just that itself, calling .suggestions() several times. $( '#searchInput' ).suggestions( { result: { render: ..., select: ... }, special: { render: ..., select: ... } } );
Hmm okay. I will try the RL approach by duplicating searchboxesSelectors and overriding 'fetch' and 'result' by calling .suggestions() in $( document ).ready(). If that works this can be closed as WFM.
I had to duplicate 'computeResultRenderCache' which is less than ideal.