Page MenuHomePhabricator

Make SearchApi module exchangeable
Closed, ResolvedPublic

Description

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.

Event Timeline

Bene assigned this task to Florian.
Bene raised the priority of this task from to Medium.
Bene updated the task description. (Show Details)
Bene added a project: MobileFrontend.

Change 233479 had a related patch set uploaded (by Bene):
Extract some methods in SearchApi

https://gerrit.wikimedia.org/r/233479

Change 233481 had a related patch set uploaded (by Florianschmidtwelzow):
Separate Search Api code from search frontend modules

https://gerrit.wikimedia.org/r/233481

Change 233479 merged by jenkins-bot:
Extract some methods in SearchApi

https://gerrit.wikimedia.org/r/233479

Change 234339 had a related patch set uploaded (by Florianschmidtwelzow):
Remove hard requirement of mobile.search.api in mobile.search

https://gerrit.wikimedia.org/r/234339

Change 234338 had a related patch set uploaded (by Florianschmidtwelzow):
Follow up change in MobileFrontend

https://gerrit.wikimedia.org/r/234338

Change 234730 had a related patch set uploaded (by Florianschmidtwelzow):
Allow another extension to replace/extend modules loaded for mobile.search

https://gerrit.wikimedia.org/r/234730

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

https://gerrit.wikimedia.org/r/233481

Change 234338 merged by jenkins-bot:
Follow up change in MobileFrontend

https://gerrit.wikimedia.org/r/234338

Change 234339 merged by jenkins-bot:
Remove hard requirement of mobile.search.api in mobile.search

https://gerrit.wikimedia.org/r/234339

@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. :-)

See T111209#1627047, I hope I didn't miss something, will add it otherwise.

Change 234730 abandoned by Florianschmidtwelzow:
Allow another extension to extend or replace the Search Api query

Reason:
see comment from Bene

https://gerrit.wikimedia.org/r/234730

@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'

Ok that sounds like the best idea! Thanks :-)

Change 251203 had a related patch set uploaded (by Bene):
Add search generator prefix config variable

https://gerrit.wikimedia.org/r/251203

Change 251207 had a related patch set uploaded (by Bene):
Use displaytext form api result in search display

https://gerrit.wikimedia.org/r/251207

Change 251203 merged by jenkins-bot:
Add search generator config variable

https://gerrit.wikimedia.org/r/251203

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.

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.

Bene moved this task from Proposed to Review on the Wikidata-Sprint-2016-01-19 board.
daniel moved this task from Review to Done on the Wikidata-Sprint-2016-01-19 board.

Change 251207 merged by jenkins-bot:
Use displaytext from api result in search display

https://gerrit.wikimedia.org/r/251207