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

adjust fuse threshold in offline search to better filter out irrelevant results #1183

Merged
merged 4 commits into from
Jul 10, 2023

Conversation

gumaerc
Copy link
Collaborator

@gumaerc gumaerc commented Jul 6, 2023

What are the relevant tickets?

Closes #1182

Description (What does it do?)

This PR simply adjusts the threshold value in the FuseJS configuration for offline search in www-offline to 0.2 from 0.4. After some testing, this seems to be a good place to set it in order to filter out irrelevant results.

Screenshots (if appropriate):

image

How can this be tested?

Follow the same instructions as #1175, but pay extra attention to the results and verify that irrelevant results have been minimized

@gumaerc gumaerc changed the title adjust threshold down to 0.2 to filter out irrelevant results adjust fuse threshold in offline search to better filter out irrelevant results Jul 6, 2023
@github-actions github-actions bot temporarily deployed to pull request July 6, 2023 16:11 Inactive
@github-actions github-actions bot temporarily deployed to pull request July 6, 2023 16:11 Inactive
@github-actions
Copy link

github-actions bot commented Jul 6, 2023

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

@ChristopherChudzicki ChristopherChudzicki self-assigned this Jul 7, 2023
Copy link
Contributor

@ChristopherChudzicki ChristopherChudzicki left a comment

Choose a reason for hiding this comment

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

In addition to the comment I left, one other requested change: Move const searchResultsSection = document.getElementById("search-results") above performSearch.

Currently, the else block throws an error since searchResultsSection is not defined. Gosh, I forgot how easy these errors are in un-linted files.

@@ -73,7 +73,7 @@ <h3 class="col-3 text-center m-auto">Start typing to search</h3>
const Fuse = window.Fuse
const searchOptions = {
shouldSort: true,
threshold: 0.4,
threshold: 0.2,
location: 0,
distance: 100,
matchAllTokens: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

Requested Change: matchAllTokens: I don't think exists anymore. It's not in the docs and changelog says it was removed

Suggestion

I think we should ditch location and distance. Remove those options, and add ignoreLocation.

With { threshold: 0.2, distance: 100, location: 0 } a match only counts if it occurs (starts??) within the first 20 characters, which really isn't that many. For example:

Screenshot 2023-07-07 at 3 31 30 PM

@github-actions github-actions bot temporarily deployed to pull request July 7, 2023 22:35 Inactive
@github-actions github-actions bot temporarily deployed to pull request July 7, 2023 22:35 Inactive
Copy link
Contributor

@ChristopherChudzicki ChristopherChudzicki left a comment

Choose a reason for hiding this comment

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

@gumaerc Did you want to add ignoreLocation: true? Currently, fuse is using the default values for distance/loc, so "Geographic Information Systems" still shows limited results.

Requested change: As mentioned: Move const searchResultsSection = document.getElementById("search-results") above performSearch.

Currently, the else block is throwing when there are no results.

@gumaerc
Copy link
Collaborator Author

gumaerc commented Jul 10, 2023

@ChristopherChudzicki Whoops, I missed that part but that makes sense. It should be all set now.

@github-actions github-actions bot temporarily deployed to pull request July 10, 2023 17:50 Inactive
@github-actions github-actions bot temporarily deployed to pull request July 10, 2023 17:50 Inactive
@github-actions github-actions bot temporarily deployed to pull request July 10, 2023 17:55 Inactive
@github-actions github-actions bot temporarily deployed to pull request July 10, 2023 17:56 Inactive
@gumaerc gumaerc merged commit 90ec0eb into main Jul 10, 2023
5 checks passed
@odlbot odlbot mentioned this pull request Jul 11, 2023
6 tasks
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.

unexpected results for offline search
2 participants