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

Filter lunr.js stopwords from the 'Missing' section of each search result #3343

Closed
4 tasks done
bradumbaugh opened this issue Dec 12, 2021 · 4 comments
Closed
4 tasks done
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open

Comments

@bradumbaugh
Copy link

bradumbaugh commented Dec 12, 2021

Contribution guidelines

I want to suggest an idea and checked that ...

  • ... to my best knowledge, my idea wouldn't break something for other users
  • ... the documentation does not mention anything about my idea
  • ... there are no open or closed issues that are related to my idea

Description

As suggested, filing an issue for discussion #3342.

screenshot

As shown by the above screenshot from the live MkDocs Material site, when a user enters a search term that lunr.js treats as a stopword, search results can indicate that the word is "missing" from the result even when it's actually there. This can be a little confusing, especially when the snippet shown by the search preview happens to include that stopword.

Can lunr.js stopwords be filtered from the 'missing' section?

Another, related idea: explicitly indicate that particular words have been excluded from the search (i.e., an 'Excluded: when, is, and') if/when a user searches on them. I don't know, though — even as I type that it out it seems a little heavy-handed (and it'd get repetitive to see that same info on each search result).

Use Cases

This is obviously not a major problem. That said, fixing it might prevent users from getting confused when a search result says that a word is missing, when in fact that same word is visible right in the same search result.

The primary benefit here would be to prevent any loss in trust that might arise from the search UI indicating something that isn't true.

Screenshots / Mockups

No response

@bradumbaugh bradumbaugh changed the title Filter lunr.js stopwords from the 'missing section' of each search result Filter lunr.js stopwords from the 'Missing' section of each search result Dec 12, 2021
@squidfunk squidfunk added the needs investigation Issue must be investigated by the maintainers label Dec 12, 2021
@squidfunk
Copy link
Owner

squidfunk commented Dec 12, 2021

I had some time on my hands and fixed it right away. Starting with fdfe150f4 stopwords are now removed from the list of missing terms. I also noticed this some time ago but forgot about it, so I'm glad we finally fixed it as it was really annoying.

As an additional note, showing this was filtered because it's a stopword might lead to more confusion than it helps. Most users will not search for stopwords, but for single keywords, at least that's what I'm seeing on the docs.

@squidfunk squidfunk added bug Issue reports a bug resolved Issue is resolved, yet unreleased if open and removed needs investigation Issue must be investigated by the maintainers labels Dec 12, 2021
@bradumbaugh
Copy link
Author

Whoa, amazing! Thanks @squidfunk! That has to be some kind of a speed record. Love this project!

@squidfunk
Copy link
Owner

I also backported the fix in 539ddad.

@squidfunk
Copy link
Owner

Released as part of 8.1.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open
Projects
None yet
Development

No branches or pull requests

2 participants