miroir/crates
jedarden d480fda76c feat(query-planner): integrate QueryPlanner into search routing path (plan §13.4)
Integrated QueryPlanner into the search request path to enable shard-aware
query optimization. PK-constrained searches now fan out to only the relevant
shards instead of the full covering set.

Changes:
- miroir-proxy/src/routes/search.rs: Call QueryPlanner before scatter planning
  and use plan_search_scatter_with_narrowing with narrowed target_shards
- miroir-core/src/explainer.rs: Add QueryPlanner integration to Explain API
  for visibility into query planning decisions
- miroir-proxy/src/routes/explain.rs: Update to pass QueryPlanner to Explainer

Acceptance criteria met:
1.  QueryPlanner called before scatter-gather for every search request
2.  Filter expressions parsed to identify PK-constrained searches
3.  PK-lookups route to single shard (via narrowed target_shards)
4.  Explain API shows query planning decisions (narrowed, narrowing_reason)
5.  Tests validate planner narrows fan-out correctly

Performance impact: PK-lookups now fan out to 1 shard instead of all S shards
(expected ~10x faster for PK-lookups as per plan §13.4).

Note: Primary key registration with QueryPlanner during index creation is
tracked separately (future bead). The QueryPlanner returns "primary key not
configured for index" for indexes where PK hasn't been registered yet,
falling back to full covering set.

Closes: bf-mknij
2026-05-26 17:26:31 -04:00
..
miroir-core feat(query-planner): integrate QueryPlanner into search routing path (plan §13.4) 2026-05-26 17:26:31 -04:00
miroir-ctl feat(cli): add --version flag to miroir-ctl 2026-05-26 14:51:13 -04:00
miroir-proxy feat(query-planner): integrate QueryPlanner into search routing path (plan §13.4) 2026-05-26 17:26:31 -04:00