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

feat: suggest fuzzy + limit as a param #6887

Merged
merged 2 commits into from
Jun 13, 2022
Merged

feat: suggest fuzzy + limit as a param #6887

merged 2 commits into from
Jun 13, 2022

Conversation

alexgarel
Copy link
Member

fixes: openfoodfacts/openfoodfacts-dart#465

Also add fuzzy searching.

@alexgarel alexgarel requested a review from a team as a code owner June 10, 2022 18:56
@github-actions github-actions bot added the Tags label Jun 10, 2022
@alexgarel
Copy link
Member Author

It would be cool to add tests, but I don't know if I have the time because it will require making a sub to be able to test with a fake taxonomy.

Copy link
Contributor

@monsieurtanuki monsieurtanuki left a comment

Choose a reason for hiding this comment

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

Thank you @alexgarel!
If I sum up, now there's

  • the fuzzy search
  • a new optional limit parameter (default is 25, max is 400)

cgi/suggest.pl Outdated
push @suggestions_c, $tag;
$suggestions_count++;
Copy link
Contributor

Choose a reason for hiding this comment

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

One issue with doing that (which was already present before) is that we will hit the limit with entries that don't start with the searched string, even though we may have some.

e.g. just searching with one letter:

image

So we could create a separate counter for suggestions matching inside instead.

@sonarcloud
Copy link

sonarcloud bot commented Jun 13, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@alexgarel
Copy link
Member Author

PR updated to only count for "start with" match to limit traversal.

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

Successfully merging this pull request may close these issues.

Autocomplete suggestions limited to 25: not enough!
3 participants