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

Search does not work for docs built with 1.8.0 #5460

Closed
dkliban opened this issue Sep 19, 2018 · 11 comments
Closed

Search does not work for docs built with 1.8.0 #5460

dkliban opened this issue Sep 19, 2018 · 11 comments

Comments

@dkliban
Copy link

dkliban commented Sep 19, 2018

Subject: Docs built with sphinx 1.8.0 have broken search

Problem

  • Search returns no results for all queries. When I build using 1.7.9 everything works fine.

Procedure to reproduce the problem

  • build docs with sphinx 1.8.0
  • try to search the docs using the search textbox
  • no results ever show

Expected results

Search works

Environment info

  • OS: Fedora 28
  • Python version: 3.6
  • Sphinx version: 1.8.0
@tk0miya
Copy link
Member

tk0miya commented Sep 20, 2018

Sorry, I can't reproduce the error. Could you share your project or reproducible example please?

@tk0miya tk0miya added this to the 1.8.1 milestone Sep 20, 2018
@dkliban
Copy link
Author

dkliban commented Sep 20, 2018

I am able to reproduce using: https://github.com/dkliban/pulp/tree/broken-sphinx

However, I just realized that this only occurs when using the 'sphinx-rtd-theme'. After I uninstalled 'sphinx-rtd-theme' the problem goes away. Should I file the bug with https://github.com/rtfd/sphinx_rtd_theme ?

@ImportanceOfBeingErnest

To see this bug in action, see the matplotlib search (as long as this isn't reverted to use sphinx 1.7.9).

The error seems to be

Uncaught ReferenceError: Stemmer is not defined
    at Object.query (searchtools.js:9)
    at Object.setIndex (searchtools.js:3)
    at <anonymous>:1:8
    at p (jquery.js:1)
    at Function.globalEval (jquery.js:1)
    at text script (jquery.js:1)
    at Qb (jquery.js:1)
    at A (jquery.js:1)
    at XMLHttpRequest.<anonymous> (jquery.js:1)

As far as I can tell matplotlib does not use the 'sphinx-rtd-theme'; but of course some other customization that is done may be responsible, maybe an old jquery in use?

@tk0miya
Copy link
Member

tk0miya commented Sep 20, 2018

@dkliban Thank you for comment. I reproduced this.
And I just post readthedocs/sphinx_rtd_theme#672 to fix this from sphinx_rtd_theme side.

Note: This was added in #5207. It updated documentation_options.js which was added in 1.7. But sphinx_rtd_theme has not refered it.

@tk0miya tk0miya modified the milestones: 1.8.1, 1.8.2 Sep 21, 2018
@ImportanceOfBeingErnest

It seems sphinx 1.8.1 is out without this being fixed. Could someone comment on the solution here?

It looks like the searchtools.js needs some variables from another javascript and currently the user is resposible for including that other javascript? Is this documented somewhere?

@tk0miya
Copy link
Member

tk0miya commented Sep 22, 2018

The variables are defined in documentation_options.js. But sphinx_rtd_theme does not load it.
Unfortunately, the theme has loaded JavaScript files via their custom solution. So the changes on Sphinx does not effect to the theme.

Until merging readthedocs/sphinx_rtd_theme#672 , you need to pin Sphinx==1.7.9 or customize the theme manually.

@mitya57
Copy link
Contributor

mitya57 commented Sep 27, 2018

sphinx_rtd_theme and matplotlib are not the only themes that got broken with this. Another example is scipy/scipy-sphinx-theme#9, and I think there will be other examples of breakage.

Maybe it's possible to add a fallback for such themes, like we did in past (e.g. #4107)?

@tk0miya
Copy link
Member

tk0miya commented Sep 29, 2018

@TimKam do you have any idea for @mitya57 's comment?

@TimKam
Copy link
Member

TimKam commented Sep 29, 2018

I will take a look. Should be possible for me to add such a fallback, if this is okay with you.

TimKam added a commit to TimKam/sphinx that referenced this issue Sep 30, 2018
* Inject ``documentation_options.js`` script as part of HTML build
* Set attributes of the script accordingly
* Remove script reference from basic template (would be duplication)
* Add fallback for URL_ROOT variable
TimKam added a commit to TimKam/sphinx that referenced this issue Sep 30, 2018
mitya57 added a commit to mitya57/sphinx that referenced this issue Nov 4, 2018
This file is included in script_files, so it will be present even for
projects using custom templates.

Fixes sphinx-doc#5460.
@mitya57
Copy link
Contributor

mitya57 commented Nov 8, 2018

There is a new pull request in #5590. Any testing is appreciated. Please consider assigning it to 1.8.2 milestone.

@tk0miya tk0miya modified the milestones: 1.8.2, 1.8.3 Nov 11, 2018
@tk0miya
Copy link
Member

tk0miya commented Nov 11, 2018

Fixed by #5590. Thank you @mitya57 !

@tk0miya tk0miya closed this as completed Nov 11, 2018
odinserj added a commit to HangfireIO/Hangfire.Documentation that referenced this issue Aug 21, 2020
nickjalbert added a commit to nickjalbert/agentos that referenced this issue Jan 10, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 10, 2021
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.

5 participants