Page MenuHomePhabricator

ApiEntitySearchHelper should filter out not recognized data types from search results before returning
Closed, ResolvedPublic

Description

  • ApiEntitySearchHelper should ask for more results than needed from the remote API
  • ApiEntitySearchHelper should filter results and only return properties with known data types
    • WikibaseRepo->getDataTypeDefinitions->getTypeIds can be used in PHP to get the list of enabled data value type ids (needed for filtering)

One thing to consider is:

  • The UI makes the decision to show or not show the "more" button based on how many results are returned from the API / if search-continue key is returned. We should make sure we don't make this do bad things.
    • If the user asks for 8, and we ask wikidata for 12, and we get 12, filter 5 and return 7, no more button will be shown if only 7 are returned (evil)
  • Perhaps logging these cases, or throwing an exception might be fine for now? As the case discussed should be fairly unlikely for now.

Tech pointers:

  • WikibaseRepo->getDataTypeDefinitions->getTypeIds for getting PHP data types that are enabled in PHP
  • JS code that we think is doing the search in the UI side, view/resources/jquery/wikibase/jquery.wikibase.entityselector.js (although we didn't find where the limit is in the call)
  • search-continue will be important

Details

Event Timeline

Change 604660 had a related patch set uploaded (by Tobias Andersson; owner: Tobias Andersson):
[mediawiki/extensions/Wikibase@master] FP: Filter unavailable datatypes

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

Change 604660 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] FP: Filter unavailable datatypes

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

Addshore triaged this task as Medium priority.Jul 1 2020, 8:55 AM