I was searching for a dictionary rule, and realised that Typerighter's rule search is not very good.
Part of the reason is that we use a trigram index for comparing words, but do not order by similarity to the search term. This PR adds that ordering, so the results most similar to the search term are surfaced first.
Before
After
How to test
The automated tests should pass. Existing ones have reasonable coverage of search functionality. There's a new one for relevance.
Running locally or in CODE, observe the behaviour of search. It should favour text that most closely matches the rule type, pattern, description, or replacement.
What does this change?
I was searching for a dictionary rule, and realised that Typerighter's rule search is not very good.
Part of the reason is that we use a trigram index for comparing words, but do not order by similarity to the search term. This PR adds that ordering, so the results most similar to the search term are surfaced first.
How to test