sphinx-doc/sphinx

searchindex.js contains rst_epilog matches for all pages in docs

開放

#4,248 建立於 2017年11月17日

 (1 則留言) (0 個反應) (0 位負責人)Python (1,985 個分叉)batch import
good first issuehelp wantedhtml search

倉庫指標

星標
 (5,625 顆星)
PR 合併指標
 (平均合併 10天 11小時) (30 天內合併 11 個 PR)

描述

Problem: rst_epilog values are returned for all pages when searched for.

My understanding is that the searchindex.js file is built from the doctrees cache. https://github.com/sphinx-doc/sphinx/blob/master/sphinx/search/__init__.py#L239

Each doctree file contains all of the rst_epilog values. As a result, these are included for every page when indexed, e.g. this is included in all doctrees files: .. |TEST1| replace:: TestWord

Reproduce:

  1. Add something like this to the conf.py and build
rst_epilog = '''
.. |TEST1| replace:: TestWord
.. |TEST2| replace:: TestWord2
'''
  1. Search the rebuilt docs for "testword"
  2. All pages in the doc set will be returned, and none will not actually contain "testword"
  3. if you take a look at searchindex.js you will see the rst_epilog values indexed for all pages, e.g. {testword2:[0,1,2],testword:[0,1,2]}

Env: Tested using Sphinx 1.5.5 and 1.6.5 & python 2.7.10

Regards, Brian

貢獻者指南