Collection Filtering
Restrict searches to specific collections using-c or --collection.
Single Collection
Search only one collection:Multiple Collections
Filter across multiple collections (combines results):- Searches all specified collections
- Combines and ranks results across collections
- Equivalent to OR logic:
collection=docs OR collection=examples
No Filter (Default)
Without-c, searches all collections:
includeByDefault: true (default) and excludes those with includeByDefault: false in your ~/.config/qmd/index.yml.
Collection Name Matching
Collection names can be specified in several ways:When to Use Collection Filters
| Use Case | Command |
|---|---|
| Search specific project docs | qmd search "setup" -c myproject |
| Exclude archived content | qmd search "current" -c active-docs |
| Search meeting notes only | qmd search "Q1 planning" -c meetings |
| Multiple related collections | qmd search "api" -c docs -c examples |
| Isolate personal vs work | qmd search "todo" -c personal |
Result Limits
Control how many results are returned.Default Limits
Different formats have different default limits optimized for their use case:| Format | Default | Override |
|---|---|---|
| CLI (default) | 5 | -n 10 |
--json | 20 | -n 50 |
--files | 20 | -n 100 |
--csv | 5 | -n 30 |
--md | 5 | -n 15 |
--xml | 5 | -n 25 |
Specify Exact Limit
Use-n <number> to set a custom limit:
All Results
Use--all to return all matching documents (up to 100,000):
--all returns ALL matches, which can be thousands of results. Use with --min-score to filter:
Multi-Get Limits
Formulti-get, -l limits lines per file, not number of files:
-n limit), but content is truncated:
Score Thresholds
Filter results by minimum relevance score using--min-score.
Default Thresholds
Different search commands have different defaults:| Command | Default | Reason |
|---|---|---|
search (BM25) | 0 | Accept all keyword matches |
vsearch (vector) | 0.3 | Filter low-similarity vectors |
query (hybrid) | 0 | Reranker provides quality signal |
Set Custom Threshold
Specify minimum score (0-1 scale):Understanding Scores
BM25 scores (search):- Unbounded, typically 0-10 range
- Higher = more keyword matches and better TF-IDF
- Normalized to 0-1 for display
- No score → No threshold by default
- 0-1 range (cosine similarity)
- 1.0 = identical embeddings
- 0.0 = completely unrelated
- Default threshold: 0.3
- 0-1 range (reranker confidence)
- Combines BM25 + vector + reranking
- Higher = model is more confident
- No default threshold (reranker already filters)
Best Practices
| Use Case | Threshold |
|---|---|
| Find exact matches only | --min-score 0.8 |
| High-quality results | --min-score 0.6 |
| Exploratory search | --min-score 0.3 |
| Recall (find everything) | --min-score 0 (default) |
| Precision (high accuracy) | --min-score 0.7 |
Combine with —all
Get all high-scoring results:--min-score, --all could return thousands of low-quality matches.
Output Modifiers
Additional options that affect what content is returned.Full Content
Show complete documents instead of snippets (search only):- Get complete context for LLM prompts
- Export full documents for analysis
- Review entire files matching search
- Generate documentation from search results
Line Numbers
Add line numbers to all output:- Search snippets
- Full document content (
--full) - Single document retrieval (
get) - Multi-get file content
- All output formats (JSON, CSV, Markdown, XML, CLI)
Line Slicing (Get Command)
Retrieve specific line ranges from a document:Multi-Get Size Limits
Control maximum file size for batch retrieval:- CLI:
[SKIPPED: reason] - JSON:
{"skipped": true, "reason": "..."} - CSV:
truein skipped column - Markdown:
> reason(blockquote) - XML:
<skipped>true</skipped><reason>...</reason> - Files:
[SKIPPED]suffix
- Prevent overwhelming terminal output
- Keep JSON payloads reasonable
- Avoid processing huge log files
- Make CSV exports manageable
Combining Filters
Stack multiple filters for precise results:Collection + Score + Limit
Multiple Collections + All + Score
Collection + Full + Format
Line Numbers + Full + Limit
Common Filter Patterns
Find Best Match
High-Quality Results Only
Everything in Collection
Export for Analysis
Preview Multiple Docs
Specific Collection Slice
Performance Tips
- Use collection filters when possible - searching 1 collection is faster than 10
- Set reasonable limits -
-n 10is faster than--allfor exploration - Add score thresholds -
--min-score 0.5filters before ranking - Limit line counts -
multi-getwith-l 50loads less data - Use —files - minimal format for quick scans
Filter Precedence
Filters are applied in this order:- Collection filter (
-c) - narrows search scope - Search/query - finds matching documents
- Score threshold (
--min-score) - filters by relevance - Limit (
-nor--all) - caps result count - Content modifiers (
--full,--line-numbers) - affects output format
See Also
- Output Formats - JSON, CSV, Markdown, XML, Files reference
- Search Commands - Search, query, and vsearch details
- Collections - Managing collections and includeByDefault
- Virtual Paths - Understanding qmd:// URIs