Planner#
nlql.plan —— 查询规划:相关度提取(Scorer / score_key)、QueryPlan,以及过滤操作的拆分(split_filter / is_pushable),决定哪些操作可交给后端、哪些在内存执行。
plan
#
Query planning: analysis, scoring extraction, and (future) pushdown splitting.
__all__
module-attribute
#
__all__ = ['Planner', 'QueryPlan', 'Scorer', 'score_key', 'FilterSplit', 'split_filter', 'is_pushable', 'metadata_field']
QueryPlan
dataclass
#
QueryPlan(query: Query, scorers: list[Scorer] = list(), bindings: dict[str, Expr] = dict(), granularity: str = 'sentence', pushed_filter: Expr | None = None, residual_filter: Expr | None = None, store: str = 'local')
The analyzed form of a query, ready for the executor.
bindings
class-attribute
instance-attribute
#
bindings: dict[str, Expr] = field(default_factory=dict)
explain
#
A JSON-friendly description of the plan for EXPLAIN.
源代码位于: src/nlql/plan/plan.py
Scorer
dataclass
#
Scorer(key: str, query_text: str, path: str, call: Call, vector_name: str = 'default')
Planner
#
Planner(registry: Registry)
Turns a :class:Query into a :class:QueryPlan.
源代码位于: src/nlql/plan/planner.py
plan
#
plan(query: Query, *, granularity: str, caps: StoreCaps | None = None, field_types: dict[str, Any] | None = None) -> QueryPlan
源代码位于: src/nlql/plan/planner.py
FilterSplit
dataclass
#
score_key
#
score_key(call: Call) -> str
Canonical, stable identity of a scoring call (e.g. a SIMILARITY invocation).
is_pushable
#
Whether expr can be pushed to a store with the given capabilities.
metadata_field
#
metadata_field(path: Path) -> str
The dotted metadata key for a path (drops the optional meta prefix).
split_filter
#
split_filter(where: Expr | None, caps: StoreCaps, field_types: dict[str, Any] | None = None) -> FilterSplit
Partition a WHERE clause into (pushed, residual) given store capabilities.