Page MenuHomePhabricator

[MEX] M4 - improve findability of properties on lookups
Closed, ResolvedPublic3 Estimated Story Points

Description

Not sure if this belongs here because it happens on desktop too:

Screenshot 2026-02-17 at 15.37.18.png (1,734×646 px, 129 KB)

Current behavior: Adding a space after a word on a lookup has no effect

Fixed behavior: Adding a space after a word makes it clear that i am searching first and foremost for that exact word. Example: Pet (no space) first result is Peter. Pet (space) First result should be exactly the word Pet.

This was the expectation of a user during the mex user tests

Event Timeline

Adding in the search team to look into this

I understand the issue as follow:

  • You search for "pet" hoping to select Pet (Q39201)
  • You see a wide variety of matches starting with pet but not what you expect (Pet Q39201)
  • You add a space and search for "pet " hoping for Q39201 to be preferred

Currently the trailing have very minimal effect on the ranking (and it was partially broken for some languages which will be fixed in https://gerrit.wikimedia.org/r/c/operations/mediawiki-config/+/1267130). But even when fixed this won't help this particular case, trailing space in the search query will only give more chances to matches like "pet shop" to be ranked slightly higher, it won't tell the engine to prefer "exact" matches to "Pet".

I believe the issue is more around how we rank exact label matches, searching for pet alone should already try to rank Pet (Q39201) higher.

What we can do is revisit the weight for exact label matches such that the user don't feel the need to add extra space: searching for "pet" should return a label with only the word "pet" in the top-3.

I'm not opposed to a change in the behavior and give the trailing space more meaning by telling the engine to stop listing all matches that starts with "pet" when searching for "pet " but we still have, I think, to allow pet shop to match:

  • "Peter" would no longer match when searching for "pet "
  • "pet" would still match
  • "pet shop" would match

Edit: yes that's all correct from my end

Change #1271716 had a related patch set uploaded (by DCausse; author: DCausse):

[mediawiki/extensions/WikibaseCirrusSearch@master] Complete: use raw user query on prefix fields

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

Change #1271716 merged by jenkins-bot:

[mediawiki/extensions/WikibaseCirrusSearch@master] Completion: use raw user query on prefix fields

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

Change #1278375 had a related patch set uploaded (by DCausse; author: DCausse):

[mediawiki/extensions/WikibaseCirrusSearch@master] Completion: fix near match field name

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

Change #1278375 merged by jenkins-bot:

[mediawiki/extensions/WikibaseCirrusSearch@master] Completion: fix near match field name

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

Change #1278509 had a related patch set uploaded (by DCausse; author: DCausse):

[mediawiki/extensions/WikibaseCirrusSearch@wmf/1.46.0-wmf.26] Completion: fix near match field name

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

Change #1278509 merged by jenkins-bot:

[mediawiki/extensions/WikibaseCirrusSearch@wmf/1.46.0-wmf.26] Completion: fix near match field name

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

Mentioned in SAL (#wikimedia-operations) [2026-04-29T07:17:19Z] <dcausse@deploy1003> Started scap sync-world: Backport for [[gerrit:1278509|Completion: fix near match field name (T417648)]], [[gerrit:1269464|search: add alt. completion indices to test keyword tokenizer (1/2) (T420427)]]

Mentioned in SAL (#wikimedia-operations) [2026-04-29T07:19:18Z] <dcausse@deploy1003> dcausse: Backport for [[gerrit:1278509|Completion: fix near match field name (T417648)]], [[gerrit:1269464|search: add alt. completion indices to test keyword tokenizer (1/2) (T420427)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.

Mentioned in SAL (#wikimedia-operations) [2026-04-29T07:24:26Z] <dcausse@deploy1003> Finished scap sync-world: Backport for [[gerrit:1278509|Completion: fix near match field name (T417648)]], [[gerrit:1269464|search: add alt. completion indices to test keyword tokenizer (1/2) (T420427)]] (duration: 07m 07s)

The API is now using the trailing space to also favor exact matches (trimmed): https://www.wikidata.org/w/api.php?action=wbsearchentities&format=json&limit=10&language=en&uselang=en&type=item&search=pet+

  • this is working in the search widget while editing a statement
  • this is not working in the main search widget (the trailing space seems to be trimmed by the client in this case)