Search indexed project content using BM25 ranking and optional metadata filters.
idx search [query terms] [flags]
query terms (optional only when at least one --path or --ext is provided).| Flag | Type | Default | Notes |
|---|---|---|---|
--format |
string | text |
Allowed: text, json |
--json-pretty |
bool | false |
Requires --format json |
--explain |
bool | false |
Includes ranking score |
--agent-compact |
bool | false |
Compact text output for agents (no header/footer spacing, simplified lines) |
--context |
int | 0 |
Must be >= 0 |
--matches-only |
bool | false |
Keeps only matching lines |
--files-only |
bool | false |
Returns only file paths |
--path |
string array | [] |
Repeatable metadata-path filter |
--ext |
string array | [] |
Repeatable file-extension filter (go or .go) |
--from |
int | 0 |
Pagination offset, must be >= 0 |
--size |
int | unset (0) |
If set, must be > 0 |
--operator |
string | AND |
Boolean operator for multi-term queries: AND or OR |
--relaxation |
string | unset | Only with --operator AND. Format >N; activates relaxation only when query has more than N terms, then removes trailing terms progressively |
--quiet, -q |
bool | false |
Suppress informational output |
Compatibility alias:
--macthes-only maps to --matches-only.--path and/or --ext).--operator AND (default): a document must contain all query terms to be ranked.--operator AND + --relaxation >N: activates only when the query has more than N terms, then evaluates decreasing term prefixes (removing tokens from right to left) down to a single term, ranking results by largest matched term count first.--operator OR: a document must contain at least one query term; broadens recall at the cost of precision. Proximity bonus is skipped for terms absent from a given document.files-only or matches-only, then pagination (from, size).--files-only has priority over --matches-only.📁 Found <total> file(s) matching your search📁 Found <total> file(s) matching your search (showing <displayed> with pagination)--agent-compact, header/footer spacing is omitted and lines are printed as <line>:<content>.No results found.{"count":0,"results":[]} (pretty when --json-pretty is enabled)count and results.score only appears when --explain is true.--files-only:
idx search auth token
idx search auth token --format json --json-pretty
idx search auth token --explain
idx search auth token --format json --explain
idx search auth token --agent-compact
idx search auth token --context 2
idx search --path internal/core
idx search --ext go
idx search --path internal/core --ext go
idx search auth token --from 10 --size 5
idx search auth token --files-only
idx search auth token --matches-only
idx search auth token --operator OR
idx search auth token --operator AND
idx search func abc x y int 10 --operator AND --relaxation '>2'
missing search query... expected idx search <terms>unsupported --format value ... expected one of [text json]--json-pretty requires --format jsoninvalid --context value ... expected a non-negative integerinvalid --from value ... expected a non-negative integerinvalid --size value ... expected a positive integerunsupported --operator value ... expected one of [AND OR]invalid --relaxation value ... expected format >N where N is a non-negative integerinvalid --relaxation with --operator ... expected AND