Page MenuHomePhabricator

Allow extensions to append stuff to search queries, e.g. for search by prefix
Open, LowPublic

Description

It should be possible to somehow search by prefix through the search box. It's possible through inputbox.

(Note that this is only possible in Lucene search, but that is used on WMF wikis anyway.)

It would be extremely useful for Incubator to be able to search within a specific test wiki.


Version: unspecified
Severity: enhancement

Details

Reference
bz30229

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 11:53 PM
bzimport added a project: MediaWiki-Search.
bzimport set Reference to bz30229.
bzimport added a subscriber: Unknown Object (MLST).
SPQRobin created this task.Aug 4 2011, 5:47 PM

rainman wrote:

Can you be more specific? You can search by prefix by doing a query like this:
<your query> prefix:<the page prefix>

Well, yes, it should be somehow configurable by an extension.

For example, based on the current title e.g. "Prefix/Subpage", an extension should be able to set the prefix in the searchbox to "Prefix" (and preferably not by a visible "prefix:Prefix" in the searchbox but rather by passing through a &prefix= parameter).

brion added a comment.Aug 4 2011, 8:24 PM

That there's some specific support for search form queries accepting a 'prefix' query string parameter which gets passed through to the underlying search engine (currently only supported by Lucene via MWSearch extension, by sticking a 'prefix:'+val into the query in its transformSearchTerm method.)

This I think got introduced for use with the <inputbox> extension and is used fairly extensively to create custom search forms within various project hierarchies on some of our wikis.

For use on, say, Incubator, it could be *really* nice to have the search box default to looking within the current language/project.

I suspect we can hack this up for Incubator extension in some way; adding a hidden field with the 'prefix' field value to the search form should do the job. If it's not directly manipulable through a hook, one could probably add it from JavaScript at runtime; not ideal but should be possible as a quick fix.

It would also help to implement the prefix support in the default MySQL search engine, as this would certainly aid folks testing the Incubator extension. This should be broken out to a separate bug though.

brion added a comment.Aug 16 2011, 6:54 PM

See also bug 30404 -- a more general way to append stuff into the search query could be helpful. On the other hand that could also be handled by a smarter input box system that handles the appending and just sends you on to the search page with a full query.

Restricted Application added a project: Discovery-Search. · View Herald TranscriptNov 25 2018, 3:53 AM
debt added a subscriber: debt.

Hi, removing our team tag - let us know if you need help with this very old ticket.