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

HTML Search: partially-matched titles are not included in search results. #12040

Closed
jayaddison opened this issue Mar 2, 2024 · 0 comments · Fixed by #12041
Closed

HTML Search: partially-matched titles are not included in search results. #12040

jayaddison opened this issue Mar 2, 2024 · 0 comments · Fixed by #12041

Comments

@jayaddison
Copy link
Contributor

Describe the bug

As-written, the search code for Sphinx appears intended to give a score of 7 to partial-matches of the user query against document titles. This compares to a score of 15 when one of the terms from the user query matches a title term exactly.

However: there is a bug. The code uses the variable named word that relates to one of the words from the user's original query (philos in the repro case provided below) instead of the partially-matching title term found in the index (philosphi -- the i suffix is not a typo, that's due to term stemming).

How to Reproduce

Self-construct the Sphinx project's HTML documentation from commit 5745199 and host this using a local webserver (for example, by running python -m http.server -b 127.0.0.1 from the documentation build output directory).

Visit the locally-hosted project documentation using a web browser, and perform a search (keyboard shortcut: /) for the term philos.

Expected outcome: the Appendix: Deploying a Sphinx project online tutorial should be listed in the search results.

Actual outcome: the tutorial is not included in the search results.

Environment Information

Platform:              linux; (Linux-6.6.15-rt-amd64-x86_64-with-glibc2.37)
Python version:        3.11.8 (main, Feb  7 2024, 21:52:08) [GCC 13.2.0])
Python implementation: CPython
Sphinx version:        7.3.0+/574519900
Docutils version:      0.20.1
Jinja2 version:        3.1.3
Pygments version:      2.17.2

Sphinx extensions

extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.todo',
              'sphinx.ext.autosummary', 'sphinx.ext.extlinks',
              'sphinx.ext.intersphinx',
              'sphinx.ext.viewcode', 'sphinx.ext.inheritance_diagram',
              'sphinx.ext.coverage']

Additional context

Discovered during code review of #11958.

@jayaddison jayaddison self-assigned this Mar 2, 2024
jayaddison added a commit to jayaddison/sphinx that referenced this issue Mar 2, 2024
@jayaddison jayaddison changed the title [HTML search] partially-matched titles are not included in search results. HTML search: partially-matched titles are not included in search results. Mar 14, 2024
@jayaddison jayaddison changed the title HTML search: partially-matched titles are not included in search results. HTML Search: partially-matched titles are not included in search results. Mar 14, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant