autocomplete: tune autocorrect algorithm.
Tune autocorrect to produce fewer false positives. Before we used trigram similarity. Now we use Levenshtein edit distance with a dynamic typo threshold. Trigram similarity was able to correct large transpositions (e.g. `miku_hatsune` -> `hatsune_miku`), but it was bad at correcting small typos. Levenshtein is good at small typos, but can't correct large transpositions.
This commit is contained in:
@@ -58,7 +58,7 @@ class TagsControllerTest < ActionDispatch::IntegrationTest
|
||||
should respond_to_search(name_matches: "hatsune_miku").with { @miku }
|
||||
should respond_to_search(name_normalize: "HATSUNE_MIKU ").with { @miku }
|
||||
should respond_to_search(name_or_alias_matches: "miku").with { @miku }
|
||||
should respond_to_search(fuzzy_name_matches: "miku_hatsune", order: "similarity").with { @miku }
|
||||
should respond_to_search(fuzzy_name_matches: "hatsune_mika", order: "similarity").with { @miku }
|
||||
should respond_to_search(name: "empty", hide_empty: "true").with { [] }
|
||||
should respond_to_search(name: "empty", hide_empty: "false").with { [@empty] }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user