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

Fix the JavaScript search term splitting for compound words #307

Merged
merged 1 commit into from
Dec 12, 2023

Conversation

jbms
Copy link
Owner

@jbms jbms commented Dec 12, 2023

Previously, the JavaScript search code split the search query only on spaces, which meant that with a search query of a compound word like "mkdocs-material", for example, would be treated as a single term "mkdocs-material". In contrast, when building the search index, the /\w+/ regexp is used to split compound words, such that the index would only contain "mkdoc" and "material" as separate terms. Consequently, "mkdocs-material" as a single term would never be found.

With this change, the JavaScript search query splitting has been changed to match what is done when building the index.

Fixes #262.

Previously, the JavaScript search code split the search query only on
spaces, which meant that with a search query of a compound word like
"mkdocs-material", for example, would be treated as a single term
"mkdocs-material".  In contrast, when building the search index, the
`/\w+/` regexp is used to split compound words, such that the index
would only contain "mkdoc" and "material" as separate terms.
Consequently, "mkdocs-material" as a single term would never be found.

With this change, the JavaScript search query splitting has been
changed to match what is done when building the index.

Fixes #262.
@jbms jbms requested a review from 2bndy5 December 12, 2023 19:59
@jbms jbms mentioned this pull request Dec 12, 2023
@jbms jbms merged commit 1e813b6 into main Dec 12, 2023
57 checks passed
@jbms jbms deleted the fix-search-term-splitting branch December 12, 2023 21:45
@2bndy5
Copy link
Collaborator

2bndy5 commented Dec 12, 2023

I'll push a patch bump later when the CI is all caught up.

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

Successfully merging this pull request may close these issues.

Search missing results
2 participants