The user-facing problem:
- When a user adds a property to an item, and starts typing the name of the item he wants to link to, a query is run against the wb_terms table to find and rank results, e.g. https://www.wikidata.org/w/api.php?action=wbsearchentities&search=united&language=en
- The current system doesn't index the labels or aliases in a structured manner, so they're not weighted highly enough in the search resultuses in-memory sorting and very basic scoring for ranking.
- This results in the search being suboptimal for users, sometimes displaying things in the wrong order or missing important entries
- This also leads to high database load, with an increasing number of timeouts (and thus, no search result)
Technical issues:
- The current implementation of the backend for this query is not performant
- The current implementation lacks a good mechanism for updating term weights (boosts)
Proposed solution:
- Searching for entities by label should be backed by EntitySearch (or Cirrus) for large wikis.
- An SQL based search should remain as a fallback/baseline.
This could be implemented using the mechanism proposed in {T89733}. However, if we don't want to block on this, it may be simpler to just implement the relevant hook in Cirrus.