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

r634b05f3a5070fef98 breaks SQLAlchemy's search page, emits dozens of unnecessary HTTP requests #9456

Closed
zzzeek opened this issue Jul 15, 2021 · 10 comments

Comments

@zzzeek
Copy link

zzzeek commented Jul 15, 2021

Describe the bug

upgrading to the 4.1 series, SQLAlchemy's search page now has a bunch of tags that look like <p class="context"> throughout them with ellipses inside with no functionality and it looks like these all emit indivudal HTTP requests that seem to do nothing, slowing down our search page.

the change is exactly that made in 634b05f. If i edit this directly in searchtools.js, the old behavior is restored. the change appears to now ignore an option that was in place before which explicitly states that the contextual files for this feature are not available. I have also tried setting html_copy_source to True, hoping to at least see the contextual stuff that I see in other doc pages, but it doesn't work for my site anyway.

i think it's a bad idea to emit an unecessary ajax / network request that has no chance of being useful. Can the old behavior please be restored? this change forces unnecessary network overhead for a feature that's not in use and also breaks our layout (which I can work around wtih CSS, but the 95 extra network calls makes this a non -starter).

How to Reproduce

$ git clone https://github.com/sqlalchemy/sqlalchemy
$ cd sqlalchemy/docs/build
$ pip install -r requirements.txt
$ make html
$ cd output/html
$ python -m http.server  # view docs on webserver
$ # navigate to http://localhost:8000

Expected behavior

No response

Your project

https://docs.sqlalchemy.org/

Screenshots

good:

good

bad:

bad

OS

linux

Python version

3.9

Sphinx version

4.1.1

Sphinx extensions

No response

Extra tools

No response

Additional context

No response

zzzeek referenced this issue Jul 15, 2021
This seems to have been a mistake with #4022 the ajax call functions correctly without the source files being included in the build (they are never used).

I have tested this out on several themes and now everything works correctly with `html_copy_source = False`
@zzzeek zzzeek changed the title r634b05f3a5070fef98 breaks SQLAlchemy's search page r634b05f3a5070fef98 breaks SQLAlchemy's search page, emits dozens of unnecessary HTTP requests Jul 15, 2021
@zzzeek
Copy link
Author

zzzeek commented Jul 15, 2021

edited above, note that this bug causes the search page to emit dozens of unnecessary network requests as well.

zzzeek added a commit to sqlalchemyorg/zzzeeksphinx that referenced this issue Jul 15, 2021
this is to work around
sphinx-doc/sphinx#9456 which is emitting
dozens of unused network calls on search
@tk0miya tk0miya added this to the 4.1.2 milestone Jul 23, 2021
@tk0miya
Copy link
Member

tk0miya commented Jul 24, 2021

Sorry for the inconvenience.

There are a related change and a bug:

  • searchtools.js starts to show the summary text (around the keyword) even if html_copy_source = False (refs: HTML: Fix search unnecessarily requiring source files #9129). Since Sphinx-2.0, searchtools.js does not require source files to create the summary text. So v4.1.0 starts to show them without source files.
  • searchtools.js inserts only abbreviation marks ("...") as a summary text if failed to fetch it. On creating a summary text, the script searches a HTML element having role="main" attribute. But SQL Alchemy docs does not have it.

I think the former one is an intended change. But it has also brought incompatible change. That's not intended. So it should be reverted during 4.1.x at least. I'm still debating this change will be applied again since 4.2 or 5.0.

Another one is a bug. Therefore, it should be fixed.

cc: @Blendify

@zzzeek
Copy link
Author

zzzeek commented Jul 24, 2021

thanks for the reply!! I think regardless of how you want to approach this, a configuration option to turn off the ajax-request-per-result thing altogether should be available, at the very least to support sites that don't have this text. (why doesn't my site have the text, is it because my custom theme isn't doing something it's supposed to?)

@tk0miya
Copy link
Member

tk0miya commented Jul 24, 2021

I think regardless of how you want to approach this, a configuration option to turn off the ajax-request-per-result thing altogether should be available, at the very least to support sites that don't have this text.

Perfectly agreed. I'll add a configuration to disable showing summary texts on re-merge #9129.

(why doesn't my site have the text, is it because my custom theme isn't doing something it's supposed to?)

Before the upgrading Sphinx (< 4.1), it was disabled via html_copy_source = False). After the upgrading to 4.1.0, it failed to fetch summaries because the theme you're using does not have a container tag having role="main" attribute:

<div class="body" role="main">
{% block body %} {% endblock %}
<div class="clearer"></div>
</div>

tk0miya added a commit that referenced this issue Jul 25, 2021
Fix #9456: html search: html_copy_source can't control the search summaries
@tk0miya tk0miya reopened this Jul 25, 2021
@Blendify
Copy link
Contributor

I would rather us add a new option rather than revert that commit, even if this means breaking compatibility. The reason I made the commit in the first place is to avoid having to copy and upload all the source files on my orgs build system, saving drive IOPS and network bandwidth.

@zzzeek
Copy link
Author

zzzeek commented Jul 26, 2021

thanks for looking into this! I will try to see if i can update my templates to work with this feature at some point.

@tk0miya
Copy link
Member

tk0miya commented Jul 26, 2021

I determined to revert the change from 4.1.x series and add a new option in 4.2.0.

@tk0miya tk0miya modified the milestones: 4.1.2, 4.2.0 Jul 26, 2021
@tk0miya tk0miya closed this as completed in 1753012 Aug 1, 2021
tk0miya added a commit that referenced this issue Aug 1, 2021
Fix #9456: html search: abbreation marks are inserted to the search
@tk0miya tk0miya reopened this Aug 1, 2021
@tk0miya tk0miya modified the milestones: 4.2.0, 4.3.0 Sep 12, 2021
dfelinto pushed a commit to dfelinto/blender-manual that referenced this issue Oct 14, 2021
This is no longer needed now that we link to a only copy of the sources.

In previous versions of sphinx this was still needed to control search
summeries but that is no longer needed after the recent update.

Note however sphinx 4.1.2 reverted this which breaks search summaries.
sphinx 4.2 should fix this so we will be skipping the rest of 4.1.x versions.

See: sphinx-doc/sphinx#9456


git-svn-id: https://svn.blender.org/svnroot/bf-manual/trunk/blender_docs@8334 c4de1f47-6596-e411-a384-0024e86c2797
@tk0miya tk0miya removed this from the 4.3.0 milestone Nov 9, 2021
@tk0miya tk0miya added this to the 4.4.0 milestone Nov 9, 2021
@Blendify
Copy link
Contributor

Any update here? This is preventing my project from updating to a newer version of sphinx

@tk0miya
Copy link
Member

tk0miya commented Jan 16, 2022

I reverted the commit that causes the original issue at #9494 and released as v4.1.2. So I think there are no troubles with the latest release. So there is no blocker to upgrade dependency on the sqlalchemy project.

The remaining task is reimplementing #9494 by another implementation (with an option switch for it).

@tk0miya tk0miya modified the milestones: 4.4.0, 4.5.0 Jan 16, 2022
tk0miya added a commit that referenced this issue Jan 17, 2022
Close #9456: html search: Add a config variable; html_show_search_summary
@tk0miya
Copy link
Member

tk0miya commented Jan 17, 2022

Finally, I added html_show_search_summary configuration. It will be released in 4.5.0.
Sorry for the inconvenience long.

marxin pushed a commit to marxin/sphinx that referenced this issue Jan 20, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants