Page MenuHomePhabricator

[Story] Search for Wikidata should give meaningful results on mobile as well
Closed, ResolvedPublic

Description

The search on mobile for Wikidata needs to use the entity selector like the desktop version does. Otherwise only page titles are found which are the item ids on WIkidata.

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

See P1923 for a proposal how a custom search api for wikibase could look like.

@Bene can you turn your proposal into a patch? That would make it much easier to test and to comment.

Note that this proposal only makes sense if T110069 gets tackled which mainly depends on these two patches: https://gerrit.wikimedia.org/r/233479 and https://gerrit.wikimedia.org/r/233481

I didn't get an answer by @Jdlrobson on my patch yet and he didn't comment on the other one as well.

Current state of this: in the short term we may replace the javascript module to make the search work basically. However, we want to use cirrus search on Wikidata anyways and that would also solve this issue. This is the long term solution which should be used for desktop and mobile search.

@Bene If replacing teh JS module proves to be problematic, we can also provide an API module that wraps sbsearchentities and emulates the output format used by core's title search.

@daniel I also considered that. What about specifying a parameter in wbsearchentities that enables core's search format. This way we can avoid breaking the api output and do not have another module cluttering our api.

@Bene: a separate module would be cleaner, both from the "inside" and the "outside". Adding an option thaqt completely changes the structure of the output is bound to cause confusion, and it leads to multi-option multi-purpose code, which tends to be hard to maintain.

In particular, it's going to be much easier to just remove a module, than to remove an option and clean up the relevant code pathes.

After looking deeper into the search api call, I see that MobileFrontend uses prefixsearch only as a generator and gets all the relevant data via action=query&prop=thumbnail. This makes the whole thing a bit harder. I'm not sure if we want to replicate such a specific query including generators etc. in a fake api. In future however, we should perhaps implement some page props that work for Wikibase entities.

The full query is

{
	action: 'query',
	generator: 'prefixsearch',
	gpssearch: query,
	gpsnamespace: this.searchNamespace,
	gpslimit: 15,
	prop: 'pageimages',
	piprop: 'thumbnail',
	pithumbsize: mw.config.get( 'wgMFThumbnailSizes' ).tiny,
	pilimit: 15,
	redirects: '',
	list: 'prefixsearch',
	pssearch: query,
	pslimit: 15
}

Change 234560 had a related patch set uploaded (by Bene):
Create MediawikiSearchEntities api module

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

Change 234675 had a related patch set uploaded (by Bene):
Allow to use custom displayTitle in search

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

Change 234675 merged by jenkins-bot:
Allow to use custom displayTitle in search

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

https://gerrit.wikimedia.org/r/#/c/234560/ isn't finished yet but I want to get some review first to see if the team agrees this is the right way to go. I will create tests and fix jenkins after I got a +1.

@Bene please add a subtask for the new API module, so we can track that separately.

daniel renamed this task from [Task] search for Wikidata should use entity selector on mobile as well to [Story] search for Wikidata should use entity selector on mobile as well.Sep 2 2015, 3:11 PM
Bene removed Bene as the assignee of this task.Sep 15 2015, 9:45 AM
Bene subscribed.

Change 238983 had a related patch set uploaded (by Bene):
Configure MobileFrontend to use wbsearch as generator

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

Lydia_Pintscher renamed this task from [Story] search for Wikidata should use entity selector on mobile as well to [Story] Search for Wikidata should give meaningful results on mobile as well.Nov 17 2015, 2:31 PM

Change 254645 had a related patch set uploaded (by Bene):
Use custom generator for mobile search on Wikibase

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

Change 238983 abandoned by Bene:
Configure MobileFrontend to use wbsearch as generator

Reason:
Done in config: https://gerrit.wikimedia.org/r/#/c/254645/1

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

The only thing for this to be done is getting the config patch merged: https://gerrit.wikimedia.org/r/#/c/254645/ Maybe someone can have a look into that?

daniel changed Security from None to Software security bug.Nov 26 2015, 12:42 PM
Restricted Application changed the visibility from "Public (No Login Required)" to "Custom Policy". · View Herald TranscriptNov 26 2015, 12:42 PM
Restricted Application changed the edit policy from "All Users" to "Custom Policy". · View Herald Transcript
Restricted Application added a project: acl*security. · View Herald Transcript
JanZerebecki changed Security from Software security bug to None.Nov 26 2015, 12:47 PM
Aklapper changed the visibility from "Custom Policy" to "Public (No Login Required)".Nov 26 2015, 1:08 PM
Aklapper changed the edit policy from "Custom Policy" to "All Users".

Tested this locally, with the following settings:

$wgMFNearby = true;
$wgMFQueryPropModules[] = 'pageterms';
$wgMFSearchAPIParams['wbptterms'] = array( 'label' );
$wgMFSearchGenerator = array(
	'name' => 'wbsearch',
	'prefix' => 'wbs'
);

I tested with latest master of core, Wikibase, and MobileFrontend.

I found the following:

  • In the search box, I get matches for labels, but labels are not used for display. I just see IDs, no labels or descriptions.
  • On Special:Nearby, labels are used for display, but no descriptions are shown.
  • Also, I found T119707
  • In the search box, I get matches for labels, but labels are not used for display. I just see IDs, no labels or descriptions.

Matched terms will be shown as soon as https://gerrit.wikimedia.org/r/#/c/251207/ is merged.

  • On Special:Nearby, labels are used for display, but no descriptions are shown.

I don't know how Special:Nearby works but that is unrelated to this task.

Perhaps my MobileFrontend patch suffers from the same issues... :S

Tested this locally, with the following settings:

$wgMFNearby = true;
$wgMFQueryPropModules[] = 'pageterms';
$wgMFSearchAPIParams['wbptterms'] = array( 'label' );
$wgMFSearchGenerator = array(
	'name' => 'wbsearch',
	'prefix' => 'wbs'
);

I tested with latest master of core, Wikibase, and MobileFrontend.

I found the following:

  • In the search box, I get matches for labels, but labels are not used for display. I just see IDs, no labels or descriptions.
  • On Special:Nearby, labels are used for display, but no descriptions are shown.

Do you have the following settings?

$wgMFUseWikibaseDescription = true;                                                                 
$wgMFDisplayWikibaseDescription = true;

descriptions are a separate, general feature that works on any client wiki, including wikidata.

alternatively:

$wgMFSearchAPIParams['wbptterms'] = array( 'label', 'description' );

might work.

@aude thanks, with the two extra settings, it works as expected.

Still blocked on minor escaping and naming issues in https://gerrit.wikimedia.org/r/#/c/251207/

adrianheine raised the priority of this task from Medium to High.Dec 7 2015, 10:11 AM
adrianheine moved this task from Review to Doing on the Wikidata-Sprint-2015-12-01 board.

Patches that need to be merged:

When done, this can be closed as resolved.

Change 254645 merged by jenkins-bot:
Use custom generator for mobile search on Wikidata

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