Expand description
Search engine with keyword, semantic, and hybrid retrieval modes.
This module provides the application-level entry points for search. The
core algorithm (normalization, hybrid merge, aggregation) lives in
context-harness-core::search and operates through the [Store] trait.
This wrapper handles config parsing, database connection, embedding, and
CLI output formatting.
§Search Modes
- Keyword — FTS5 full-text search using BM25 scoring.
- Semantic — Cosine similarity over stored embedding vectors.
- Hybrid — Weighted merge of keyword and semantic results.
Structs§
- Chunk
Candidate - A candidate chunk returned from keyword or vector search.
- Score
Explanation - Scoring breakdown for a search result.
- Search
Params - Retrieval tuning parameters, decoupled from application config.
- Search
Request - Bundles all inputs for a single search invocation.
- Search
Result Item - A search result matching the
SCHEMAS.mdcontext.searchresponse shape.
Functions§
- normalize_
scores - Min-max normalize raw scores to
[0.0, 1.0]. - run_
search - CLI entry point — calls
search_documentsand prints results to stdout. - search_
documents - Core search function returning structured results.