Skip to content

Commit

Permalink
Merge back search indexer
Browse files Browse the repository at this point in the history
  • Loading branch information
ubmarco committed Nov 3, 2023
1 parent fd14612 commit a432648
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions sphinx/builders/html/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class StandaloneHTMLBuilder(Builder):

imgpath: str = ''
domain_indices: list[DOMAIN_INDEX_TYPE] = []
post_transform_merge_attr = ['images']
post_transform_merge_attr = ['images', 'indexer']

def __init__(self, app: Sphinx, env: BuildEnvironment) -> None:
super().__init__(app, env)
Expand Down Expand Up @@ -235,12 +235,20 @@ def init(self) -> None:
self.use_index = self.get_builder_config('use_index', 'html')

def merge_env_post_transform(self, new_attrs: dict[str, Any]) -> None:
"""Merge images back to the main builder after parallel
"""Merge images and search indexer back to the main builder after parallel
post-transformation.
param new_attrs: the attributes from the parallel subprocess to be
udpated in the main builder (self)
"""
# handle indexer
self.indexer._all_titles.update(new_attrs['indexer']._all_titles)
self.indexer._filenames.update(new_attrs['indexer']._filenames)
self.indexer._index_entries.update(new_attrs['indexer']._index_entries)
self.indexer._mapping.update(new_attrs['indexer']._mapping)
self.indexer._title_mapping.update(new_attrs['indexer']._title_mapping)
self.indexer._titles.update(new_attrs['indexer']._titles)
# handle images
for filepath, filename in new_attrs['images'].items():
if filepath not in self.images:
self.images[filepath] = filename
Expand Down

0 comments on commit a432648

Please sign in to comment.