Skip to main content
Full-text search using BM25 ranking. Fast keyword-based search without LLM processing.

Usage

qmd search [options] <query>
query
string
required
Search terms (supports phrases, proximity, and boolean operators)

Options

-c, --collection
string
Filter by collection name (can be specified multiple times). Defaults to all included collections.
-n
number
default:"5 (CLI), 20 (JSON/files)"
Maximum number of results
--all
boolean
default:"false"
Return all matches (use with --min-score)
--min-score
number
default:"0"
Minimum score threshold (0-1)
--full
boolean
default:"false"
Show full document instead of snippet
--line-numbers
boolean
default:"false"
Add line numbers to output
--json
boolean
default:"false"
Output as JSON
--csv
boolean
default:"false"
Output as CSV
--md
boolean
default:"false"
Output as Markdown
--xml
boolean
default:"false"
Output as XML
--files
boolean
default:"false"
Output file paths only (with docid and score)

Query Syntax

BM25 search supports: Exact phrases:
qmd search '"CAP theorem"'
Proximity search:
qmd search 'distributed systems'  # Terms within 10 words
Individual terms (OR):
qmd search 'kubernetes docker'  # Matches either term
Negation:
qmd search 'database -mongodb'  # Exclude documents with "mongodb"

Examples

# Basic search
qmd search "authentication"

# Search in specific collection
qmd search "API design" -c docs

# Search multiple collections
qmd search "deployment" -c notes -c wiki

# Get all results above threshold
qmd search "error handling" --all --min-score 0.4

# JSON output with full documents
qmd search "configuration" --json --full

# Export to CSV
qmd search "meeting notes" --csv -n 50

Output Formats

CLI (default)

Color-coded results with snippets, scores, and context.

JSON

Structured output with docid, score, file, title, context, and snippet/body.

Files

Simple format: #docid,score,filepath,"context"

CSV

Spreadsheet-compatible with all fields.

Markdown

Formatted for documentation with headings and code blocks.

XML

Structured XML with <document> elements.

Score Normalization

BM25 scores are normalized to 0-1 range using sigmoid transformation:
  • 70%+ — Excellent match (green)
  • 40-69% — Good match (yellow)
  • Below 40% — Weak match (dim)

Performance

BM25 search is the fastest option:
  • No LLM inference required
  • Direct SQLite FTS5 index query
  • Typically completes in under 50ms
For better semantic understanding, use qmd query or qmd vsearch.

qmd query

Hybrid search with query expansion and reranking (recommended)

qmd vsearch

Vector semantic search

qmd get

Retrieve document by path or docid

Build docs developers (and LLMs) love