Module search

Module search 

Source
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§

ChunkCandidate
A candidate chunk returned from keyword or vector search.
ScoreExplanation
Scoring breakdown for a search result.
SearchParams
Retrieval tuning parameters, decoupled from application config.
SearchRequest
Bundles all inputs for a single search invocation.
SearchResultItem
A search result matching the SCHEMAS.md context.search response shape.

Functions§

normalize_scores
Min-max normalize raw scores to [0.0, 1.0].
run_search
CLI entry point — calls search_documents and prints results to stdout.
search_documents
Core search function returning structured results.