Page MenuHomePhabricator

Remove broken and unfixable "prefix" ngram behavior

Authored by epriestley on Apr 16 2020, 4:32 PM.
Referenced Files
Unknown Object (File)
Sat, Apr 6, 3:31 AM
Unknown Object (File)
Fri, Mar 29, 8:20 AM
Unknown Object (File)
Mar 16 2024, 3:21 AM
Unknown Object (File)
Feb 22 2024, 1:00 AM
Unknown Object (File)
Feb 10 2024, 1:00 PM
Unknown Object (File)
Jan 25 2024, 11:59 AM
Unknown Object (File)
Jan 25 2024, 2:20 AM
Unknown Object (File)
Dec 26 2023, 12:23 PM



Ref T13501. The older ngram code has some "prefix" behavior that tries to handle cases where a user issues a very short (one or two character) query.

This code doesn't work, presumably never worked, and can not be made to work (or, at least, I don't see a way, and am fairly sure one does not exist).

If the user searches for "xy", we can find trigrams in the form "xy*" using the index, but not in the form "*xy". The code makes a misguided effort to look for " xy", but this will only find "xy" in words that begin with "xy", like "xylophone".

For example, searching Files for "om" does not currently find "random.txt".

Remove this behavior. Without engaging the trigram index, these queries fall back to an unidexed "LIKE" table scan, but that's about the best we can do.

Test Plan

Searched for "om", hit "random.txt".

Diff Detail

rP Phabricator
Lint Not Applicable
Tests Not Applicable