-
Notifications
You must be signed in to change notification settings - Fork 2k
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 results: identical summaries displayed for different link targets #11943
Comments
Here's the code for the relevant helper method: sphinx/sphinx/themes/basic/static/searchtools.js Lines 547 to 572 in ceb3b2a
|
I had optimistically hoped that this issue might be a regression somewhere in the That could make sense; parsing the HTML of multiple results pages client-side could be an expensive operation. But it does mean that locating the anchors -- and relevant text near them -- would be required, and could require some care. I think I would pause at this point and check for advice from more experienced Sphinx developers. |
We do this already, so I think it's fine (the amount of computation/time needed to parse out the HTML is almost always going to be overwhelmed by the latency in requesting the HTML). See #11944 for what I think is the right solution. |
Brilliant - I didn't realize that we already did that. I'll add a question about the content we retrieve relative to each anchor in that pull request. |
Describe the bug
My understanding (that could be mistaken) about the
html_show_search_summary
feature (enabled by default) is that each search result displayed to the user should have a relevant snippet of the content displayed alongside, to aid the user's determination of which result(s) are most relevant.When the feature is enabled, we make an HTTP request to each result and display a portion of that using JavaScript.
How to Reproduce
Build the Sphinx documentation locally and then run a basic webserver to host it:
sphinx.git $ sphinx-build -b html doc _build sphinx.git $ cd _build sphinx.git $ python -m http.server -b 127.0.0.1
Open
http://127.0.0.1:8000
in a web browser, and perform a search for the query termtest
.Observe that multiple results with separate HTML anchor targets appear in the search results. However: they display the same search snippet (not useful - this is the bug).
Environment Information
Sphinx extensions
No response
Additional context
Discovered during investigation of #11942.
The text was updated successfully, but these errors were encountered: