Search pipeline
Query reformulation, document expansion, and contextual chunking — tuning the retrieval pipeline.
Query reformulation#
Query reformulation rewrites your query before retrieval to bridge vocabulary gaps between how users phrase questions and how answers are written in documents.
| Strategy | How it works | Best for |
|---|---|---|
| HyDE | Generates a hypothetical answer, then searches for documents similar to it | Factual questions with predictable answer phrasing |
| Multi-Query | Generates 3 alternative phrasings and merges results | Ambiguous or domain-specific queries |
| Step-Back | Generates a broader version of the query for high-level context | Narrow questions that need broader context |
Document expansion#
Document Expansion improves answer quality for queries targeting a specific document (policy number, ticket ID, case number). When 3 or more of the top 5 results come from the same document, the system pulls in all chunks from that document so the AI sees the full picture.
- Enable/Disable — off by default. Turn on when your content includes document-specific queries.
- Max Expanded Chunks — limits how many chunks are pulled per document (default 50).
Contextual chunking#
Contextual chunking prepends document-level context to each chunk before embedding. Without context, a chunk like "The deadline is March 15" is ambiguous — with context, the system knows it's about "Q1 budget review deadlines from the Finance team".
| Mode | How it works | Cost |
|---|---|---|
| Rule-Based | Prepends document title, source name, and metadata to each chunk | Free — no API calls |
| LLM | Uses LLM to generate a contextual summary for each chunk | One LLM call per chunk |
Hybrid search balance#
The hybrid search balance controls the weight between semantic (vector) and keyword (full-text) search. A value between 0.0 (pure keyword) and 1.0 (pure semantic). The default 0.70 works well for mixed content.
- Lower values (0.30–0.50) — when exact terms matter (product codes, legal clauses).
- Higher values (0.70–0.90) — when meaning matters more than wording.