Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add similarity ordering to rule search #467

Merged
merged 2 commits into from
Apr 8, 2024

Conversation

jonathonherbert
Copy link
Contributor

@jonathonherbert jonathonherbert commented Apr 8, 2024

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.

Before After
Screenshot 2024-04-08 at 09 40 25 Screenshot 2024-04-06 at 15 18 48

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.

@jonathonherbert jonathonherbert requested a review from a team as a code owner April 8, 2024 08:43
@jonathonherbert jonathonherbert force-pushed the jsh/add-similarity-to-search branch from bff5bdc to bfdc202 Compare April 8, 2024 10:26
Copy link
Contributor

@rhystmills rhystmills left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brilliant work.

Deployed to CODE and search is miles better. This has been bothering me also:

Before After

@jonathonherbert jonathonherbert merged commit 57d94c7 into main Apr 8, 2024
1 check passed
@jonathonherbert jonathonherbert deleted the jsh/add-similarity-to-search branch April 8, 2024 12:08
@prout-bot
Copy link

Seen on Rule Manager (merged by @jonathonherbert 9 minutes and 34 seconds ago) Please check your changes!

@prout-bot
Copy link

Overdue on Checker (merged by @jonathonherbert 15 minutes and 3 seconds ago) What's gone wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants