Wikibase uses a different search api then mediawiki, so in order to make the search useful in MobileFrontend we have to replace the default SearchApi with a Wikibase specific implementation.
Description
Details
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Resolved | Jdlrobson | T78430 [Epic] Getting Wikidata to render nicely on mobile web | |||
Resolved | None | T110033 [Story] Redirect users on mobile devices to mobile site automatically | |||
Resolved | Bene | T85368 [Story] Search for Wikidata should give meaningful results on mobile as well | |||
Resolved | Bene | T110069 Make SearchApi module exchangeable |
Event Timeline
Change 233479 had a related patch set uploaded (by Bene):
Extract some methods in SearchApi
Change 233481 had a related patch set uploaded (by Florianschmidtwelzow):
Separate Search Api code from search frontend modules
Change 234339 had a related patch set uploaded (by Florianschmidtwelzow):
Remove hard requirement of mobile.search.api in mobile.search
Change 234338 had a related patch set uploaded (by Florianschmidtwelzow):
Follow up change in MobileFrontend
Change 234730 had a related patch set uploaded (by Florianschmidtwelzow):
Allow another extension to replace/extend modules loaded for mobile.search
Although we will perhaps not touch the javascript code of MobileFrontend anymore, we still need an option to inject a custom api call to MobileFrontend's SearchApi module. In particular, the lines after this need to be replacable by a config variable / hook or something completely different.
Change 233481 merged by jenkins-bot:
Separate Search Api code from search frontend modules
Change 234339 merged by jenkins-bot:
Remove hard requirement of mobile.search.api in mobile.search
@Bene what's the current state of this? Is there a Wikidata patch?
is https://gerrit.wikimedia.org/r/#/c/234730/ needed/suitable?
I will do a write up on the options we have soon to summarize our needs and make clear what the expectations of both Wikidata and Mobile teams are. This will perhaps happen this week though I'm a bit busy currently. The patch you linked will perhaps work for our needs but I'd suggest until we've made clear based on my summary how exactly this will work. :-)
Change 234730 abandoned by Florianschmidtwelzow:
Allow another extension to extend or replace the Search Api query
Reason:
see comment from Bene
@Jdlrobson has made some changes to how the mobile search api works which however do not really solve the problem we have. In SearchGateway.js (previously SearchApi.js) the following lines got added:
var data = $.extend( { generator: 'prefixsearch', gpssearch: query, gpsnamespace: this.searchNamespace, gpslimit: 15, prop: mw.config.get( 'wgMFQueryPropModules' ), redirects: '', list: 'prefixsearch', pssearch: query, pslimit: 15 }, mw.config.get( 'wgMFSearchAPIParams' ) );
While this allows us to change some of the parameters for the search api call, that still doesn't let us replace the generator competely. We can set generator: 'wbsearch' but the generator prefix ps is still hardcoded for the parameter names (as in pssearch, pslimit or gpsnamespace etc.). I'm not sure how we should fix this (using ps as the fixed prefix for a wikibase search generator module doesn't seem to be an option to me).
Seems like generator prefix should be configurable too. Yuck. Please do add a config variable defaulting to 'ps'
Change 251203 had a related patch set uploaded (by Bene):
Add search generator prefix config variable
Change 251207 had a related patch set uploaded (by Bene):
Use displaytext form api result in search display
Yes, this is done for the MobileFrontend side. We now need to merge and deploy the new api module (which is stuck in review) and make MobileFrontend to display the term found by search instead of the qid which should perhaps get its own ticket.
Is https://gerrit.wikimedia.org/r/#/c/251207/ still relevant? If not could you abandon it please, if it is could you fix it up and help me understand it a bit better?
Yes, that is the only part missing to get this resolved. I reworked that patch and improved it by adding comments and renaming variables so now it should be better understandable what it actually does.
Change 251207 merged by jenkins-bot:
Use displaytext from api result in search display