Classes
QueryIndexRegistry
Registry for all query indexes.
Manages the lifecycle of query indexes:
- Registration (built-in +…
QueryIndexRegistry
Registry for all query indexes.
Manages the lifecycle of query indexes:
- Registration (built-in + custom)
- Building (full + incremental)
- Persistence
- Template access via site.indexes
Methods 7
register
Register a query index.
register
def register(self, name: str, index: QueryIndex) -> None
Register a query index.
Parameters 2
name |
str |
Index name (e.g., 'section', 'author', 'status') |
index |
QueryIndex |
QueryIndex instance |
build_all
Build all indexes from scratch (full build).
build_all
def build_all(self, pages: list[Page], build_cache: BuildCache, skip_generated: bool = True) -> None
Build all indexes from scratch (full build).
Parameters 3
pages |
list[Page] |
All site pages |
build_cache |
BuildCache |
Build cache for dependency tracking |
skip_generated |
bool |
Skip generated pages (tag pages, etc.) |
update_incremental
Update indexes incrementally for changed pages.
update_incremental
def update_incremental(self, changed_pages: list[Page], build_cache: BuildCache, skip_generated: bool = True) -> dict[str, set[str]]
Update indexes incrementally for changed pages.
Parameters 3
changed_pages |
list[Page] |
Pages that changed |
build_cache |
BuildCache |
Build cache for dependency tracking |
skip_generated |
bool |
Skip generated pages |
Returns
Dict mapping index_name → affected_keysdict[str, set[str]]
—
get
Get index by name.
get
def get(self, index_name: str) -> QueryIndex | None
Get index by name.
Parameters 1
index_name |
str |
Index name (e.g., 'section', 'author') |
Returns
QueryIndex instance or None if not foundQueryIndex | None
—
has
Check if index exists.
has
def has(self, index_name: str) -> bool
Check if index exists.
Parameters 1
index_name |
str |
Index name |
Returns
True if index is registeredbool
—
save_all
Save all indexes to disk.
save_all
def save_all(self) -> None
Save all indexes to disk.
stats
Get statistics for all indexes.
stats
def stats(self) -> dict[str, Any]
Get statistics for all indexes.
Returns
Dict with index statsdict[str, Any]
—
Internal Methods 5
__init__
Initialize registry.
__init__
def __init__(self, site: Site, cache_dir: Path)
Initialize registry.
Parameters 2
site |
Site |
Site instance |
cache_dir |
Path |
Directory for index cache files |
_ensure_initialized
Lazy initialization - only register indexes when first accessed.
_ensure_initialized
def _ensure_initialized(self) -> None
Lazy initialization - only register indexes when first accessed.
_register_builtins
Register built-in indexes.
_register_builtins
def _register_builtins(self) -> None
Register built-in indexes.
__getattr__
Allow attribute-style access: registry.section instead of registry.get('section').
__getattr__
def __getattr__(self, name: str) -> QueryIndex
Allow attribute-style access: registry.section instead of registry.get('section').
Parameters 1
name |
str |
Index name |
Returns
QueryIndex instanceQueryIndex
—
__repr__
String representation.
__repr__
def __repr__(self) -> str
String representation.
Returns
str