cadrumo.application.corpus_search.runtime module¶
Runtime corpus-search service: provision the index and run grounding search.
External tools and resources consume grounding through one service
entry, search_corpus(), so the protocol layer never re-derives the
retrieval wiring. The lexical index covers top-level
normatives/html/*.html.extracted.json payloads. It is provisioned in an
app-controlled cache and rebuilt atomically whenever the indexed bytes or
schema identity changes.
Retrieval is fully offline: the FTS5 lexical ranking and the exact-citation lookup need no model, no vectors, and no network. The service has no degraded mode because it has no optional half to degrade from.
See also
run_retrieval()Retrieval primitive this runtime service provisions and calls.
- corpus_search_dir(settings=None)[source]¶
Return the app-controlled corpus-search cache directory.
Read from the settings field rather than joined onto the storage root here. A module-local subdirectory literal is invisible to the taxonomy: no environment override could reach it, the tree materialiser could not pre-create it, and a root override in a test would not redirect it – so this module carried its own
mkdirto compensate for a directory nothing else knew about.- Return type:
Path- Parameters:
settings (Settings | None)
- corpus_index_path(settings=None)[source]¶
Return the lexical index path (whether or not it has been built).
- Return type:
Path- Parameters:
settings (Settings | None)
- ensure_corpus_index(settings=None)[source]¶
Return the current lexical index, rebuilding stale caches atomically.
Currency is determined from the sorted relative paths and exact bytes of every indexed source plus explicit index and extractor schema versions. Builds are staged beside the destination and published with one atomic replace, so an interrupted build is never mistaken for a current index.
- Return type:
Path- Parameters:
settings (Settings | None)