On Mon, Dec 21, 2015 at 4:48 AM, David Causse dcausse@wikimedia.org wrote:
Le 20/12/2015 21:55, Sage Ross a écrit :
If I'm, say, building a web app that could benefit from that kind of search suggestion tool, is there an API I can use?
The API endpoing is action=cirrus-suggest[1] and accepts 2 parameters: text for the user input and limit (5 by default).
Example : /w/api.php?action=cirrus-suggest&format=json&text=albert%20einstein&limit=5
Note that this API is highly experimental and is subject to change.
You should have implemented isInternal() to return true in your module, so the auto-generated documentation would properly reflect that status.
I'd suggest to use it only for evaluation purpose at this point. We may provide a better integration in the mediawiki API ecosystem (i.e. generators[2]) in the coming weeks.
Does your plan for "better integration" include making it the backend for action=opensearch when CirrusSearch is installed? That would allow browsers' search bars to benefit too.
I'd recommend against a non-beta CirrusSearch module for suggestions, versus something in core that Cirrus provides the backend for. That something is probably the existing list=prefixsearch.[1]
[1]: Which, despite the name,[2] doesn't really correspond to Special:PrefixIndex. That would be list=allpages with apprefix. [2]: We may want to look into the increasingly inaccurate name of that module at some point, but I wouldn't block Cirrus's work on doing anything more than just updating the apihelp-query+prefixsearch-description message.