Page MenuHomePhabricator

Investigate re-ranking second-try exact matches
Closed, ResolvedPublic

Description

Second-try searches that are exact matches (after transformation) for titles or redirects do not elevate those suggestions to the top of the suggestion list.

For example, with the second-try wrong-keyboard suggestions enabled, searching for ьщысщц on Russian Wikipedia searches for "Moscow", which brings up plenty of suggestions. However, it does not include the suggestion for "Москва" that you would get if you searched for Moscow in the Latin script. ("Москва" has a redirect from "Moscow", which is an exact match to the transformed Latin.)

Search for ьщысщц:
ьщысщц.png (862×650 px, 45 KB)
Search for moscow:
moscow.png (860×664 px, 63 KB)

In this case, the article for "Москва" is not in the top 10 suggestions for ьщысщц.

In general, this is not just an issue for Russian wrong-keyboard suggestions, similar examples exist for Hebrew wrong-keyboard and Georgian transliteration. The issue seems to be that the logic that elevates exact matches in the list of suggestions doesn't have access to the transformed query text.

Possible approaches to the problem include:

  • Move the logic to where the transformed data is, or vice versa, so that transformed exact matches are properly elevated.
    • This could also fix the Mõscow example mentioned below.
  • Decrease the penalty given to redirects (this will help for wrong keyboard, but not for transliteration, where titles are being matched)
  • Ignore this issue, since it happens in other, unrelated cases.
    • For example, searching for Mosco on Russian Wikipedia gives the same suggestions as ьщысщц because Mosco is not an exact match for the "Moscow" redirect. Similarly, searching for Mõscow or even "Moscow" (with quotes) on ruwiki does the same thing, again because the unnormalized query is not an exact match.
    • If there are non-transformed matches, do we want a transformed exact match to jump ahead of them? For example, пщ is the wrong-keyboard equivalent of go, which is the title of the Russian article on Go/Golang. Should that jump ahead of the actual results that start with "пщ"?

Event Timeline

TJones claimed this task.
TJones moved this task from Incoming to Done on the Discovery-Search (2025.10.20 - 2025.12.31) board.

After thinking about this more while writing up the description, and talking with @dcausse today, I think I'm going to close this ticket for now. If this shows up more often and more annoyingly than it seems to me that it will, someone can re-open the ticket.

Concerns, Ideas, & Notes:

  • For shorter queries, creating the пщ vs Go/Golang problem is trading one edge case another, more confusing edge case. This is the biggest factor in my opinion, and the one that seemed to be most convincing to others.
  • In general, for longer queries it's likely that there will be fewer options that share a prefix to push the exact match out of top place.
  • Incidental mitigations:
    • Related to T411933, we may add second-try matches into the function called from the go feature, which means that hitting return could take you to the normalized exact match page (like it already does for, say, Mõscow and "Moscow" on ruwiki).
    • We may look at re-weighting redirects anyway, which might fix many instances of not having the exact match at the top.
  • Ideas to remember:
    • We could implement a minimum length for exact-match reranking and ignore 1- and 2-letter queries.
    • We could have a preferred mapping direction, such that Latin→Cyrillic transformations are eligible for exact-match reranking on ruwiki while Cyrillic→Latin are not (since Cyrillic is the native script of the wiki). If we enable Ru/Qwerty second-try on English Wikipedia, the preferred direction would go the other way.
    • We could try to score the original and mapped queries to decide which are "good". I have some gibberish detection patterns I use elsewhere that could possibly tell that ьщысщц is less word-like than moscow—though they probably couldn't choose between Genby and Путин (a well known case where the wrong keyboard version of something is actually reasonably word-like).
    • If we decide we should look at this again more closely, we could do some data mining to get a sense of how often these wrong-keyboard exact matches were skipped and look at the kind of queries that generate them.
  • We're already calling this "second-try" (which sounds nicer than "last-ditch")... we're trying to recover from a user error; we'll never get them all.

FWIW to Go/пщ problem: there are current examples of this right now, for example php/зрз returns first one potentially relevant result in Cyrillic and then a bunch of results related to PHP. I think this is actually how this redirect thing should/would function too in that case, so returning a full match title somewhere in the list of suggestions (maybe even always as a last one out of potential ones if it’s too generic, but always the first one out of the ones added by the algorithm) doesn’t seem all that problematic.

Edit for another example: Perl/Зукд returns Perl as a first suggestion and then Зук Дык (a redirect in Cyrillic) as a second suggestion, I suppose because it’s another type of ‘autocorrected’ match.