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

sphinx JS search is somehow broken / configuration changed in 7.2, please tell me where "undefined" is coming from #11686

Closed
zzzeek opened this issue Sep 19, 2023 · 4 comments

Comments

@zzzeek
Copy link

zzzeek commented Sep 19, 2023

Describe the bug

SQLAlchemy uses a custom theme and sphinx 7.2 seems to have changed something somewhere, I can't find where, but my search results are coming out with all the file extensions as "undefined", note link in the browser toolbar:

image

I apologize for not tracking this down, which if I dont hear from folks here I'll have to do and also revert sphinx on my site which will take me all day. If I can just get a clue what changed in searchindex.js that suddenly it doesnt know the file extensions (obviously it works fine in my other sites that use built-in themes) that would be super helpful, thanks!

How to Reproduce

go to https://docs.sqlalchemy.org/en/20/

search for any term, like "relationship"

links all stuffed with "undefined"

Environment Information

$ python -m sphinx --bug-report
Please paste all output below into the bug report template



Platform:              linux; (Linux-6.4.7-200.fc38.x86_64-x86_64-with-glibc2.37)
Python version:        3.11.4 (main, Jun  7 2023, 00:00:00) [GCC 13.1.1 20230511 (Red Hat 13.1.1-2)])
Python implementation: CPython
Sphinx version:        7.2.6
Docutils version:      0.20.1
Jinja2 version:        3.1.2
Pygments version:      2.15.1

Sphinx extensions

No response

Additional context

No response

@zzzeek
Copy link
Author

zzzeek commented Sep 19, 2023

a good search on alembic shows this

DOCUMENTATION_OPTIONS
Object { VERSION: "1.12.0", LANGUAGE: "en", COLLAPSE_INDEX: false, BUILDER: "html", FILE_SUFFIX: ".html", LINK_SUFFIX: ".html", HAS_SOURCE: true, SOURCELINK_SUFFIX: ".txt", NAVIGATION_WITH_KEYS: false, SHOW_SEARCH_SUMMARY: true, … }

​

the broken one shows this:

DOCUMENTATION_OPTIONS
Object { URL_ROOT: "./", VERSION: "2.0.21", COLLAPSE_MODINDEX: false, FILE_SUFFIX: ".html" }

now to find where that comes from

@picnixz
Copy link
Member

picnixz commented Sep 19, 2023

I think the culprit commit may be 8e730ae (see #11608 (comment)).

The comment also says:

It shouldn't affect themes that use base.html as-is from Sphinx; which... well, that's most theme. Furo doesn't and I'll be fixing that in a few minutes.

Since the basic themes seem unaffected, your custom theme might contain the issue?

@zzzeek
Copy link
Author

zzzeek commented Sep 19, 2023

yes it's that commit, as well as a957d6f , and ultimately DOCUMENTATION_OPTIONS is no longer a block inside the layout file.

our layout still has this form and I think this is the problem:

<script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
          URL_ROOT:    './',
          VERSION:     '2.0.21',
          COLLAPSE_MODINDEX: false,
          FILE_SUFFIX: '.html'
      };
    </script>

   // this is not working because we have a block above with the variable locally
    <script type="text/javascript" id="documentation_options" data-url_root="./" src="[_static/documentation_options.js](view-source:https://docs.sqlalchemy.org/en/20/_static/documentation_options.js)"></script>


    <script type="text/javascript" src="[_static/init.js](view-source:https://docs.sqlalchemy.org/en/20/_static/init.js)"></script>

i think this is the problem, will close this momentarily

zzzeek added a commit to sqlalchemyorg/zzzeeksphinx that referenced this issue Sep 19, 2023
this has been long supplied by a separate js file, the issue
just was not visible until more state was added to this file
that was used.

References: sphinx-doc/sphinx#11686
@zzzeek
Copy link
Author

zzzeek commented Sep 19, 2023

thanks that was the issue

@zzzeek zzzeek closed this as completed Sep 19, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 20, 2023
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

2 participants