Search Modes
Fast Keyword Search (search)
Use BM25 full-text search for fast, keyword-based lookups:
- Exact terms or phrases you know appear in documents
- Quick lookups when you know the vocabulary
- Prefix matching (“auth” matches “authentication”)
Semantic Search (vsearch)
Use vector embeddings for meaning-based search:
- Natural language questions
- Finding concepts even when exact words don’t match
- Cross-language semantic similarity
Vector search requires embeddings. Run
qmd embed first if you see a warning.Hybrid Search (query)
Recommended for best results. Combines keyword + vector + query expansion + LLM re-ranking:
RRF Fusion
Results merged using Reciprocal Rank Fusion with top-rank bonus (+0.05 for #1, +0.02 for #2-3).
Search Options
Number of Results
- CLI: 5 results
--jsonor--files: 20 results
Minimum Score Threshold
Filter results by relevance score (0.0 - 1.0):Collection Filtering
Restrict search to specific collections:-c to search all included collections (excludes collections marked with includeByDefault: false).
Full Content vs Snippets
By default, search returns context snippets. Show full documents:Line Numbers
Add line numbers to output:Output Formats
QMD supports multiple output formats for integration with other tools.- CLI (default)
- JSON
- CSV
- Markdown
- XML
- Files List
Colorized terminal output with snippets and highlighted matches:Output:
Understanding Scores
Score Ranges
| Score | Meaning |
|---|---|
| 0.8 - 1.0 | Highly relevant - exact matches or strong semantic similarity |
| 0.5 - 0.8 | Moderately relevant - related content |
| 0.2 - 0.5 | Somewhat relevant - tangentially related |
| 0.0 - 0.2 | Low relevance - weak matches |
How Scores Are Calculated
BM25 (FTS):- Raw FTS5 BM25 scores: 0 to ~25+
- Normalized:
Math.abs(score)
- Cosine distance converted:
1 / (1 + distance) - Range: 0.0 to 1.0
- LLM rates 0-10, normalized to 0.0-1.0
- Blended with retrieval score based on rank position
Reciprocal Rank Fusion
Thequery command uses RRF to combine multiple result lists:
- #1 in any list: +0.05
- #2-3 in any list: +0.02
Search Examples
Quick Keyword Lookup
Semantic Question
Best Results with Filtering
Export for LLM Context
Scripting with JSON
Find All Matches Above Threshold
Tips for Better Search Results
Add Context
Use
qmd context add to describe collections and paths. Search uses this metadata to improve relevance.Use Hybrid Search
The
query command combines keyword + semantic + reranking for best results.Filter by Collection
Narrow searches with
-c when you know which collection contains the answer.Adjust Score Threshold
Use
--min-score 0.5 to filter out low-confidence results, or --min-score 0.3 for broader recall.Performance Notes
search(BM25 only): ~10-50ms, no GPU requiredvsearch(vectors only): ~50-200ms, benefits from GPUquery(hybrid): ~1-3s first run (model loading), ~200-500ms cached