Page MenuHomePhabricator

💡 Handle ID/URL matches
Closed, ResolvedPublic

Description

Event Timeline

Both ID and URL matches are already handled by the EntitySearchHelperPrefixSearchEngine, and there is end-to-end test covering this case.

GET http://default.mediawiki.mwdd.localhost:8080/w/rest.php/wikibase/v0/suggest/items?q=http%3A%2F%2Fdefault.mediawiki.mwdd.localhost%3A8080%2Fwiki%2FItem%3AQ1&language=%3F

{
	"results": [
		{
			"id": "Q1",
			"display-label": {
				"language": "en",
				"value": "Potato"
			},
			"description": null,
			"match": {
				"type": "entityId",
				"text": "Q1"
			}
		}
	]
}

GET http://default.mediawiki.mwdd.localhost:8080/w/rest.php/wikibase/v0/suggest/items?q=Q1&language=%3F

{
	"results": [
		{
			"id": "Q1",
			"display-label": {
				"language": "en",
				"value": "Potato"
			},
			"description": null,
			"match": {
				"type": "entityId",
				"text": "Q1"
			}
		},
		{
			"id": "Q4",
			"display-label": {
				"language": "en",
				"value": "q1"
			},
			"description": null,
			"match": {
				"type": "label",
				"language": "en",
				"text": "q1"
			}
		}
	]
}