readthedocs / sphinx_rtd_theme

Sphinx theme from Read the Docs
https://sphinx-rtd-theme.readthedocs.io/
MIT License
4.81k stars 1.74k forks source link

Case-sensitive search results would be good for technical projects #1534

Closed rptb1 closed 1 year ago

rptb1 commented 1 year ago

Problem

It would be useful to have search results respect case for technical projects that include case-sensitive identifiers. For example, it would be good if non-case-matching results downranked so that they don't intrude on better matches.

Something might be done by adding a case-sensitive search, but I suspect this could be done better by improving the ranking of results.

Reproducible Project

Found during formal inspection of transition to documentation of the Memory Pool System to Read the Docs. See https://github.com/Ravenbrook/mps/pull/166#pullrequestreview-1688020503 .

To reproduce, visit https://memory-pool-system--166.org.readthedocs.build/en/166/ and search for "pin" (a technical term used in our system) and note that the first results you get are irrelevant matches for e.g. "MutatorContextCanStepInstruction".

Error Logs/Results

image

Expected Results

When searching for "pin", pages which match "pin" as a whole word (in lower case) should be presented as the best matches. Stemmed matches such as "pins", "pinned", or "unpin" would be nice too.

Pages with the word "pin" matching with differing case should be ranked lower down.

Pages with the string "pin" matching only as a substring (e.g. in "StepIn") should be ranked even lower.

Environment Info

rptb1 commented 1 year ago

Digging a bit deeper, it looks like the Read the Docs theme is just using a build-in search from Sphinx, so this isn't the right project for this issue. I'll move it to https://github.com/sphinx-doc/sphinx/issues and keep digging for solutions.

Thanks all.