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.

Bene created this task.Aug 24 2015, 5:36 PM
Bene updated the task description. (Show Details)
Bene raised the priority of this task from to Normal.
Bene assigned this task to Florian.
Bene added a project: MobileFrontend.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptAug 24 2015, 5:36 PM

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

Bene set Security to None.Aug 25 2015, 11:41 AM
Bene added a subscriber: Lydia_Pintscher.
daniel added a subscriber: daniel.Aug 26 2015, 2:57 PM

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

Bene added a subscriber: Bene.Sep 2 2015, 4:18 PM

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.

Bene added a subscriber: Jdlrobson.Sep 2 2015, 4:19 PM

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

Jdlrobson added a comment.EditedSep 9 2015, 5:11 PM

@Bene what's the current state of this? Is there a Wikidata patch?
is https://gerrit.wikimedia.org/r/#/c/234730/ needed/suitable?

Bene added a comment.Sep 9 2015, 5:33 PM

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

Bene added a comment.Sep 10 2015, 6:54 PM

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

Bene claimed this task.Sep 16 2015, 10:05 PM
Bene moved this task from Backlog to Doing on the Wikidata-Sprint-2015-09-15 board.
Tobi_WMDE_SW removed Bene as the assignee of this task.Sep 29 2015, 2:00 PM
Bene added a comment.Nov 3 2015, 11:21 AM

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

Jdlrobson moved this task from Backlog to Bugs on the MobileFrontend board.Nov 4 2015, 5:24 PM
Bene added a comment.Nov 4 2015, 6:37 PM

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

Bene claimed this task.Nov 5 2015, 8:03 AM
Bene moved this task from Backlog to Doing on the Wikidata-Sprint-2015-11-03 board.

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

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

Bene moved this task from Doing to Review on the Wikidata-Sprint-2015-11-03 board.Nov 5 2015, 8:36 AM

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

Jdlrobson closed this task as Resolved.Nov 6 2015, 6:52 PM

@Lydia_Pintscher @Bene you confirm that this is done?

Bene added a comment.Nov 12 2015, 12:15 PM

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.

Restricted Application added a project: Wikidata. · View Herald TranscriptDec 17 2015, 9:44 PM

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 reopened this task as Open.Jan 27 2016, 12:58 PM
Bene moved this task from Proposed to Review on the Wikidata-Sprint-2016-01-19 board.
daniel closed this task as Resolved.Feb 1 2016, 4:02 PM
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