In addition to the basic functionality covered in https://phabricator.wikimedia.org/T383132, the endpoint should also cover the following functionality:
- Add matched data element to the response - to be investigated (timeboxed to max 20 hours)
- Language fallback of labels and aliases as in the UI
Example for matched data:
GET [...]/rest.php/wikibase/v0/search/items?language=en&q=spud "id": "Q123", "label": { "language": "en", "value": "potato" } "description": { "language": "en", "value": "staple food" } "match": { "type": "alias", "language": "en", "text": "spud" }
Example for label language fallback:
GET [...]/rest.php/wikibase/v0/search/items?language=en&q=Douglas%20Adams "id": "Q123", "label": { "language": "mul", "value": "Douglas Adams" } "description": { "language": "en", "value": "English science fiction writer and humorist" } "match": { "type": "label", "language": "mul", "text": "Douglas Adams" }
Example for alias language fallback:
GET [...]/rest.php/wikibase/v0/search/items?language=en&q=Douglas%20N.%20Adams "id": "Q123", "label": { "language": "mul", "value": "Douglas Adams" } "description": { "language": "en", "value": "English science fiction writer and humorist" } "match": { "type": "alias", "language": "mul", "text": "Douglas N. Adams" }
Task breakdown:
- Create an ItemSearchEngine implementation that can support language fallback and match data
- Implement match data
- adjust the use case and the ItemSearchResult model
- adjust the two ItemSearchEngine accordingly
- Implement language fallback
- adjust the use case and the ItemSearchResult model
- adjust the two ItemSearchEngine accordingly