cadrumo.application.corpus_search.citation_lookup module¶
Structured exact-citation lookup over the registry legal catalogue.
Exact citations (“art. 27.2 LGT”, ley-58-2003:art-27.2) do not go
through the FTS index: the wheel already ships typed citation data (the
registry legal_refs with their corpus_ref and BOE permalinks),
so this is a direct structured key lookup, not a parallel citation
parser. The registry legal catalogue is the single citation authority;
this module reuses it and adds
the one thing the product lacked at runtime: resolving a citation id to
the verbatim authoritative text its corpus_ref points at.
The verbatim text is read from the published authority artifact’s signed evidence projection rather than the raw HTML, and sliced to the unit the citation’s anchor names when the source file carries multiple units.
See also
CitationResolutionTyped result carrying catalogue metadata and verbatim text.
search_corpus()Exact citation ids short-circuit through this lookup before ranking.
Notes
External adapters may resolve citation ids and retrieval corpus_ref
values through this product-owned service.
- class CitationLookup[source]¶
Bases:
ABCResolve a registry citation id to metadata plus verbatim text.
The lookup is built over one caller-selected component operation. Its text projection is signed with the authority, so resolving a citation never opens a bundled corpus file or source root.
- resolve(citation_id)[source]¶
Resolve
citation_idto aCitationResolution.- Parameters:
citation_id (
str) – A registrylegal_refsid, e.g.ley-58-2003:art-27.2.- Return type:
- Returns:
The citation’s catalogue metadata plus the verbatim authoritative text its
corpus_refpoints at.- Raises:
CorpusSearchInputError – If the id is unknown to the catalogue or its backing corpus text cannot be read.
- resolve_corpus_text(ref)[source]¶
Resolve a citation id OR a corpus_ref (
path#anchor) to verbatim text.The
cadrumo://corpus/{ref}resource accepts either form: a retrieval hit’scorpus_refor a bare citation id. A known citation id routes throughresolve(); otherwiserefis read as a corpus path and anchor.- Raises:
CorpusSearchInputError – If
refresolves to no readable text or escapes the corpus root.- Return type:
- Parameters:
ref (str)
- classmethod from_operation(reference_ids, *, operation)[source]¶
Build an evidence lookup from exact ids under one pinned operation.
Legal declarations and their evidence are both addressed pointwise. The caller supplies the ids it has selected; this constructor does not hydrate a legal catalogue or accept a parallel metadata projection.
- Return type:
- Parameters:
reference_ids (Collection[str])
operation (PinnedAuthorityOperation)
- bundled_citation_lookup(reference_ids, *, operation)[source]¶
Build the bundled lookup from caller-selected ids and one live operation.
The indexed authority does not expose a global legal catalogue projection here. Its composition root must select the ids and keep
operationleased for every lookup call.- Return type:
- Parameters:
reference_ids (Collection[str])
operation (PinnedAuthorityOperation)