Complete reference documentation for Probe's search capabilities, including query syntax, ranking algorithms, and advanced search techniques.
probe search <QUERY> [PATH] [OPTIONS]| Parameter | Description |
|---|---|
<QUERY> | Required: Search terms or expression |
[PATH] | Directory to search (defaults to current directory) |
| Option | Description | Default |
|---|---|---|
--files-only | List matching files without code blocks | Off |
--ignore <PATTERN> | Additional patterns to ignore | None |
--exclude-filenames, -n | Exclude filenames from matching | Off |
--reranker, -r <TYPE> | Ranking algorithm: hybrid, hybrid2, bm25, tfidf | hybrid |
--frequency, -s | Enable smart token matching | On |
--max-results <N> | Limit number of results | No limit |
--max-bytes <N> | Limit total bytes of code returned | No limit |
--max-tokens <N> | Limit total tokens | No limit |
--allow-tests | Include test files and code | Off |
--any-term | Match any search term (OR logic) | Off |
--no-merge | Keep code blocks separate | Off |
--merge-threshold <N> | Max lines between blocks to merge | 5 |
--session <ID> | Session ID for caching results | None |
--format <TYPE> | Output format: color, plain, markdown, json | color |
For complete option details, see probe search --help.
Probe enhances search queries through several techniques:
Breaks down terms into tokens:
findUserByEmail → [find, user, by, email]Reduces words to their root form:
implementing, implementation → implementProbe supports an Elasticsearch-like query syntax:
probe search "authentication" # Single term
probe search "user authentication" # Multiple terms (AND logic)probe search "error AND handling" # Require both terms
probe search "login OR authentication" # Match either term
probe search "database NOT sqlite" # Exclude termprobe search "(error OR exception) AND (handle OR process)"probe search "+authentication login" # Required term
probe search "database -sqlite" # Excluded term
probe search "\"handle error\"" # Exact phraseprobe search "function:authenticate" # Search in function namesSearch hints allow you to filter results by file properties. These filters are applied at the file discovery stage and removed from the query before content searching:
probe search "error AND ext:rs" # Only search in .rs files
probe search "class AND file:src/**/*.py" # Only search in Python files under src/
probe search "function AND dir:tests" # Only search in files under tests/ directory
probe search "struct AND type:rust" # Only search in Rust files
probe search "component AND lang:javascript" # Only search in JavaScript filesAvailable Search Hints:
| Hint | Description | Examples |
|---|---|---|
ext:<extension> | Filter by file extension | ext:rs, ext:py,js,ts |
file:<pattern> | Filter by file path pattern (supports globs) | file:src/**/*.rs, file:*test* |
path:<pattern> | Alias for file: | path:src/main.rs |
dir:<pattern> | Filter by directory pattern | dir:src, dir:tests |
type:<filetype> | Filter by ripgrep file type | type:rust, type:javascript |
lang:<language> | Filter by programming language | lang:rust, lang:python |
Combining Search Hints:
# Multiple filters (all must match)
probe search "config AND ext:rs AND dir:src"
# Multiple extensions (any can match)
probe search "import AND ext:js,ts,jsx,tsx"
# Complex combinations
probe search "(error OR exception) AND ext:rs AND file:src/**/*"probe search "auth*" # Matches "auth", "authentication", "authorize", etc.Probe uses sophisticated algorithms to rank search results:
Term Frequency-Inverse Document Frequency balances how often terms appear in a specific code block against how common they are across the codebase.
Term Frequency (TF): How often a term appears in a code block
TF(term, block) = (Number of times term appears in block) / (Total number of terms in block)Inverse Document Frequency (IDF): Measures how unique or rare a term is
IDF(term) = ln(Total number of blocks / Number of blocks containing term)TF-IDF Score: Combines these factors
TF-IDF(term, block) = TF(term, block) * IDF(term)^2Key benefits:
BM25 (Best Matching 25) is an improved version of TF-IDF that addresses some of its limitations.
BM25(block, query) = ∑ IDF(term) * (TF(term, block) * (k1 + 1)) / (TF(term, block) + k1 * (1 - b + b * (block_length / average_block_length)))Where:
k1 (1.2): Controls term frequency saturationb (0.75): Controls length normalizationKey benefits:
Probe's default ranking algorithm combines multiple signals for superior results.
The hybrid algorithm considers:
Combined score: Weighted combination of TF-IDF and BM25
Combined = α * TF-IDF + (1-α) * BM25Position weights: Terms in function names, class names, and identifiers receive higher scores
Block metrics:
File metrics:
Key benefits:
An enhanced version of the hybrid algorithm with improved relevance:
probe search "error handling try catch"This search:
probe search "(login OR authenticate) AND (user OR account) NOT test"This complex query:
probe search "function:create* api endpoint"This search:
probe search "database connection pool" --max-tokens 4000 --format jsonThis search:
function:, class:, etc.--max-results, --max-bytes, or --max-tokens for large codebases--session to avoid seeing the same code blocks repeatedlyFor more information on how Probe works internally, see How Probe Works. For details on code extraction, see Code Extraction.