python - 当页面上不存在该短语时,"Searching..."需要永远读取文档

标签 python full-text-search python-sphinx read-the-docs

当我搜索 readthedocs 页面上不存在的短语时,我收到消息:

“正在搜索...”,这将花费很长时间。相反,当我搜索一些已知短语时,我会在一秒钟内得到结果。

我查看了页面的控制台:

The resource from “https://xxxxxx.readthedocs.io/en/latest/_static/css/yy.css” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff). Read the Docs search failed. Falling back to Sphinx search.

我已经尝试过:

  1. [conf.py] 我有一行:

    html_css_files = [
        "css/yy.css",
    ]
    

所以我添加了:

def setup(app) 中的 app.add_css_file(html_css_files):

但这导致了 readthedocs 中的构建错误

  • 我在conf.py中添加了:

    notfound_urls_prefix = "/projects/xxxxxx/en/latest/"
    
  • 但这也没有帮助。

    你遇到过类似的事情吗?如果是这样,您是如何解决这个问题的?

    最佳答案

    最终,根本原因是在其他地方。 当我查看 rtd 上的原始输出时,我发现 sphinx_rtd_theme 是随 0.4.3 安装的,这不是最新的。最新的是0.5.2。所以我将最新版本固定在我的 docs/requiremets.txt 中。这解决了搜索问题。

    关于python - 当页面上不存在该短语时,"Searching..."需要永远读取文档,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68709496/

    相关文章:

    eclipse - 在Eclipse中建立索引全文搜索?

    python - Sphinx 描述 api 的有效输入值

    python - 尝试获取 WLST 中的集群名称

    python - 在 Python 中使用 Google Translate 库时出现 Json 错误

    Python datetime to decimal year : one day off, bug在哪里?

    algorithm - 如何使倒排索引搜索更快?

    Python 在 O(n) 解决方案中检查 Anagram

    MySQL - 更改 FT_MIN_WORD_LEN

    html - 将 HTML 下载为单独的页面

    python-sphinx - 如何使用 sphinx 删除 reStructuredText 中代码块周围的框