Skip to content

Commit

Permalink
Revert b32841e to fix parallel search index building
Browse files Browse the repository at this point in the history
The image-related changes were already reverted in
2a7c40d, but the search index changes
also need to be reverted.

It would be nice to support parallel search index building, but the
necessary support for merging the search indices produced by each
process needs to be added first.

Fixes #11163.
  • Loading branch information
jbms committed Feb 12, 2023
1 parent ddf4daf commit 3da10f2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 3 additions & 4 deletions sphinx/builders/html/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,10 +655,6 @@ def get_doc_context(self, docname: str, body: str, metatags: str) -> dict[str, A
}

def write_doc(self, docname: str, doctree: nodes.document) -> None:
title_node = self.env.longtitles.get(docname)
title = self.render_partial(title_node)['title'] if title_node else ''
self.index_page(docname, doctree, title)

destination = StringOutput(encoding='utf-8')
doctree.settings = self.docsettings

Expand All @@ -678,6 +674,9 @@ def write_doc(self, docname: str, doctree: nodes.document) -> None:
def write_doc_serialized(self, docname: str, doctree: nodes.document) -> None:
self.imgpath = relative_uri(self.get_target_uri(docname), self.imagedir)
self.post_process_images(doctree)
title_node = self.env.longtitles.get(docname)
title = self.render_partial(title_node)['title'] if title_node else ''
self.index_page(docname, doctree, title)

def finish(self) -> None:
self.finish_tasks.add_task(self.gen_indices)
Expand Down
7 changes: 7 additions & 0 deletions tests/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,3 +286,10 @@ def test_nosearch(app):
assert 'latex' not in index['terms']
assert 'zfs' in index['terms']
assert index['terms']['zfs'] == [] # zfs on nosearch.rst is not registered to index


@pytest.mark.sphinx(testroot='search', parallel=3, freshenv=True)
def test_parallel(app):
app.build()
index = load_searchindex(app.outdir / 'searchindex.js')
assert index['docnames'] == ['index', 'nosearch', 'tocitem']

0 comments on commit 3da10f2

Please sign in to comment.