class_docstr: Helper class that creates a search index based on the doctrees
  passed to the `feed` method.
class_docstr_tok: ["Helper","class","that","creates","a","search","index","based","on","the","doctrees","passed","to","the","`","feed","`","method","."]
code: def __init__(
      self,
      env: BuildEnvironment,
      lang: str,
      options: dict,
      scoring: str,
  ) -> None:
      self.env = env
      # docname -> title
      self._titles: dict[str, str] = env._search_index_titles
      # docname -> filename
      self._filenames: dict[str, str] = env._search_index_filenames
      # stemmed words -> set(docname)
      self._mapping: dict[str, set[str]] = env._search_index_mapping
      # stemmed words in titles -> set(docname)
      self._title_mapping: dict[
          str, set[str]
      ] = env._search_index_title_mapping
      # docname -> all titles in document
      self._all_titles: dict[
          str, list[tuple[str, str]]
      ] = env._search_index_all_titles
      # docname -> list(index entry)
      self._index_entries: dict[
          str, list[tuple[str, str, str]]
      ] = env._search_index_index_entries
      # objtype -> index
      self._objtypes: dict[
          tuple[str, str], int
      ] = env._search_index_objtypes
      # objtype index -> (domain, type, objname (localized))
      self._objnames: dict[
          int, tuple[str, str, str]
      ] = env._search_index_objnames
      # add language-specific SearchLanguage instance
      lang_class = languages.get(lang)
  
      # fallback; try again with language-code
      if lang_class is None and "_" in lang:
          lang_class = languages.get(lang.split("_")[0])
  
      if lang_class is None:
          self.lang: SearchLanguage = SearchEnglish(options)
      elif isinstance(lang_class, str):
          module, classname = lang_class.rsplit(".", 1)
          lang_class: type[SearchLanguage] = getattr(import_module(module), classname)  # type: ignore[no-redef]
          self.lang = lang_class(options)  # type: ignore[operator]
      else:
          # it's directly a class (e.g. added by app.add_search_language)
          self.lang = lang_class(options)
  
      if scoring:
          with open(scoring, "rb") as fp:
              self.js_scorer_code = fp.read().decode()
      else:
          self.js_scorer_code = ""
      self.js_splitter_code = ""
  
imports: from __future__ import annotations
  import dataclasses
  import functools
  import html
  import json
  import pickle
  import re
  from importlib import import_module
  from os import path
  from typing import IO, TYPE_CHECKING, Any
  from docutils import nodes
  from docutils.nodes import Element, Node
  from sphinx import addnodes, package_dir
  from sphinx.environment import BuildEnvironment
  from sphinx.util.index_entries import split_index_msg
  from sphinx.search.en import SearchEnglish
label_desc: Use image node_id 1 to create a new IndexBuilder object  with example: obj = IndexBuilder(env, lang, options, scoring)