Overview
Thesearch command performs semantic search across all indexed documents. It supports multiple search modes including dense vector search, BM25 lexical search, and hybrid approaches.
You can search directly without the
search keyword: know "your query" is equivalent to know search "your query"Syntax
Parameters
The search query. Natural language questions and semantic queries work best.
Options
Number of results to return.Alias:
-nInclude only files matching glob patterns. Can be specified multiple times or as comma-separated values.Alias:
-gExample: --glob "**/*.md" --glob "notes/**"Only include files modified since the specified time. Accepts relative time (e.g.,
7d, 12h, 30m) or absolute dates (e.g., 2024-01-15).Examples:7d- Last 7 days12h- Last 12 hours30m- Last 30 minutes2w- Last 2 weeks2024-01-15- Since January 15, 2024
Use BM25 lexical search instead of semantic vector search. Better for exact keyword matches.
Use hybrid search combining BM25 and vector search. Balances semantic understanding with keyword matching.
Show both dense and BM25 results side-by-side for comparison.
Render results as plain text instead of rich formatted output.
Render results as JSON to stdout.
Write JSON results to the specified file.
Search Modes
Dense Vector Search (default)
Uses semantic embeddings to find conceptually similar content, even if exact keywords don’t match.BM25 Lexical Search
Uses traditional keyword-based ranking (BM25 algorithm). Better for finding exact terms.Hybrid Search
Combines both approaches for balanced results.Examples
Basic search
Direct query (without ‘search’ keyword)
Limit results
Filter by glob pattern
Search recent files only
BM25 search for exact keywords
Hybrid search
Compare search modes
Plain text output
JSON output to stdout
Save results to file
Complex query with multiple filters
Time Format Reference
The--since flag accepts flexible time formats:
| Format | Description | Example |
|---|---|---|
<N>m | Minutes ago | 30m |
<N>h | Hours ago | 12h |
<N>d | Days ago | 7d |
<N>w | Weeks ago | 2w |
YYYY-MM-DD | Absolute date | 2024-01-15 |
| ISO 8601 | Full timestamp | 2024-01-15T10:30:00 |
Prerequisites
Before searching, you must:- Add directories:
know add <directory> - Index content:
know index
See Also
know index- Index directoriesknow add- Add directories to watch list