Zvec Logo

Search Guide

Choose a retrieval route, narrow the workspace, and tune Zvec-Grep results.

Zvec-Grep offers complementary routes behind one zg <query> command. Start with the route that matches what you know, then narrow the search space before increasing the result count.

Choose a Route

Your intentCommandBehavior
Discover by meaning or combine meaning with keywordszg "authentication flow"Hybrid ranked sample
Rank known terms by relevancezg --fts "AuthService"BM25-ranked sample
Search only by conceptual similarityzg --vector "where credentials are validated"Vector-ranked sample
Find every literal or regex occurrencezg --rg -n -F "AuthService" srcExhaustive unless bounded

Use --rg for exact or exhaustive work. Use indexed retrieval when wording or location is unknown, or when the answer requires relationships across files.

The default positional query combines lexical and vector retrieval:

zg --preview detail "where are user preferences restored at startup" --limit 5

Positional words are joined into one query, even when separately quoted. To run separate queries, repeat --hybrid, --fts, or --vector:

zg --hybrid "connection pool" --hybrid "socket timeout"

When a question also contains exact anchors, fuse them into one ranked plan:

zg --hybrid "authentication flow" --fts "ForbiddenError" --fuse --limit 10

Narrow the Workspace

zg "plugin lifecycle" -g "src/**" -g "!src/generated/**" -t ts
OptionUse it to
-g, --glob, --iglobInclude or exclude paths
-t, --type, -T, --type-notFilter file types
--modified-after / --modified-beforeFilter by modification time

Control Results and Freshness

OptionEffect
--limit <n>Maximum results per query group
--preview none|short|full|detailSource previews; detail adds metadata, outlines, and file grouping
--debug / --traceQuery and per-hit diagnostics
--refresh background|wait|offIndex freshness policy

Output defaults to --preview short in terminals, pipes, and redirected files. full includes all available content of each retrieved item; it does not fetch an entire file.

Indexed results report fresh or possibly_stale. Refresh defaults to background in server mode and off in direct mode; direct mode cannot refresh in the background. Use --refresh wait when changes must be indexed before searching.

Improve Weak Results

  1. Confirm the workspace root and index state with zg --status.
  2. Restrict the query to relevant paths or file types.
  3. Add one or two concrete anchors with --fts.
  4. Switch to --rg when the target text is known.
  5. Review Supported Content and the selected Embedding Models.

Run zg --help search for the installed version's complete flag reference. If results remain weak, follow Troubleshooting.

On this page