ir.registry¶
Named-corpus registry — persistent, reusable corpus definitions.
A registry entry records how to (re)build a corpus — its kind (a source
preset), parameters, and embedder spec — so a corpus becomes a stable name you
can build once and query across sessions. The registry is a single JSON file
under the config dir (~/.config/ir/corpora.json).
Presets map to CorpusSource constructors:
skills→CorpusSource.from_skills()packages→CorpusSource.from_packages()reports→CorpusSource.from_md_reports()sessions→CorpusSource.from_claude_sessions()files→CorpusSource.from_files()(needsroot; optionalpattern)records→CorpusSource.from_records()(needsfetcher, a"module:attr"reference; optionalmetadata_keys/id_key/text_key) — the seam for a corpus whose records another package owns
Unregistered preset names (skills/packages/reports/sessions) are
auto-registered with defaults on first use, so ir build skills just works.
Module Attributes
Kinds that need parameters, so they are never auto-registered from a bare name. |
Functions
|
The registry entry for name, or |
|
The effective |
|
Register (or overwrite) a named corpus definition. |
All registered corpus definitions, keyed by name. |
|
|
A |
|
A lazy |
|
Resolve name to a source, auto-registering a preset if needed. |
|
Reconstruct a |
|
Remove name from the registry (does not delete built data). |
- ir.registry.PARAMETRIC_KINDS = ('files', 'records')¶
Kinds that need parameters, so they are never auto-registered from a bare name.
- ir.registry.policy_for(name)[source]¶
The effective
ir.policy.MaintenancePolicyfor corpus name.Resolves the registered entry’s
maintenanceover its kind’s smart default over the global default (seeir.policy.resolve_policy()). An unregistered name resolves to the global default policy.
- ir.registry.register(name, kind, *, embedder='default', strategy=None, maintenance=None, storage=None, **params)[source]¶
Register (or overwrite) a named corpus definition.
Beyond the v1
kind/embedder/params, an entry may now carry (all optional, with smart per-kind defaults applied at resolution time — seeir.policy):strategy— anIndexingStrategy(or a{"name", "params"}spec) persisted so the corpus’s segmentation is stable across rebuilds.Nonekeeps the preset’s default strategy.maintenance— the background-work policy dict (reindex/synopsis; validated here, seeir.policy.MaintenancePolicy).storage— the persistence backend (default{"backend": "local"}).
Entries written by older
ir(none of these keys) keep working unchanged.- Return type:
- ir.registry.retriever_for(name, **search_defaults)[source]¶
A
Retrieverbound to the registered corpus name.Opens the corpus (it must have been built) and wraps it with
ir.as_retriever();search_defaults(e.g.mode="hybrid") bind to every call.
- ir.registry.retrievers(**search_defaults)[source]¶
A lazy
Mapping[name, Retriever]view over the registry (ir_09 §8).The query-time projection of the build-recipe registry: each value is a ready-to-call
Retriever. This is the source-registry facade an orchestration layer (raglab) consumes — it never opens a corpus until the key is accessed, and always reflects the currentregistered()set.search_defaultsapply to every source.
- ir.registry.source_for(name)[source]¶
Resolve name to a source, auto-registering a preset if needed.
- Return type:
- ir.registry.source_from_entry(name, entry)[source]¶
Reconstruct a
CorpusSourcefrom a registry entry.A persisted
strategyspec (registry v2) is reconstructed and passed to the preset constructor, so a corpus’s segmentation survives across rebuilds. A v1 entry (nostrategy) passesstrategy=Noneand keeps the preset’s default — unchanged behavior.- Return type: