Search
Tantivy-powered full-text search with regex, language filtering, and path scoping. Instant results.
Drok search is built on Tantivy — a full-text search engine written in Rust, inspired by Apache Lucene but without the JVM overhead. Every repository is indexed. Every file is searchable. Results are instant.
Code Search
Search across all repositories you have access to:
drok search "fn refresh_token" --lang rustQuery Syntax
| Syntax | Description | Example |
|---|---|---|
| Plain text | Full-text search | refresh_token |
"exact phrase" | Exact string match | "fn refresh_token" |
regex: | Regular expression | regex:fn\s+\w+_token |
lang: | Language filter | lang:rust refresh_token |
path: | Path filter | path:src/auth refresh_token |
repo: | Repository filter | repo:my-org/my-repo refresh_token |
file: | Filename filter | file:*.rs refresh_token |
NOT | Exclusion | refresh_token NOT test |
OR | Disjunction | refresh_token OR renew_token |
Language Filtering
Filter results by programming language. Language detection uses Tree-sitter parsing, not file extension heuristics — a .h file containing Objective-C is correctly identified as Objective-C, not C.
drok search "async fn" --lang rust
drok search "interface Props" --lang typescript
drok search "def __init__" --lang pythonPath Scoping
Restrict search to specific directories:
drok search "TODO" --path src/
drok search "import" --path "tests/**/*.py"Path patterns support glob syntax.
Search Results
Results are displayed with:
- File path — Full path with repository name
- Line content — The matching line with syntax highlighting
- Context lines — Surrounding lines for understanding the match in context
- Match highlighting — The specific matched text is highlighted within each line
- Line numbers — Click to navigate directly to the file at that line
Results are ranked by relevance, considering:
- Exact match vs. fuzzy match — Exact matches rank higher
- File importance — Matches in source files rank above matches in generated or vendored files
- Recency — Recently modified files rank higher when relevance is otherwise equal
- Match density — Files with multiple matches in proximity rank higher
Instant Results
Search results appear as you type in the web interface. The Tantivy engine returns results in under 50 milliseconds for repositories with millions of lines of code. There is no loading spinner. There is no "Searching..." state that lasts longer than a human can perceive.
Repository Search
Search within a single repository from its page:
- Press
/to open the search bar - Results filter to the current repository
- Use
Ctrl+Shift+F/Cmd+Shift+Ffor cross-repository search
CLI Search
The drok search command mirrors the web search functionality:
# Search across all accessible repos
drok search "pattern"
# Search with filters
drok search "pattern" --lang rust --path src/ --repo my-org/my-repo
# Regex search
drok search --regex "fn\s+\w+_token" --lang rust
# Output formats
drok search "pattern" --format json
drok search "pattern" --format plainSearch Output
my-org/my-repo src/auth/token.rs:42
fn refresh_token(ttl: Duration) -> Result<Token, AuthError> {
my-org/my-repo src/auth/session.rs:118
let token = refresh_token(Duration::from_secs(3600))?;
my-org/other-repo src/lib.rs:7
pub use auth::refresh_token;Indexing
Repositories are indexed automatically on every push. The index is incremental — only changed files are re-indexed, not the entire repository. Index updates propagate within seconds of a push completing.
Index Coverage
| Content | Indexed | Notes |
|---|---|---|
| Source code files | Yes | All text files under 1 MB |
| Binary files | No | By design |
| Generated files | Excluded by default | Configurable via .drok/search-config.yml |
| Vendored dependencies | Excluded by default | Configurable |
| Documentation | Yes | Markdown, reStructuredText, AsciiDoc |
| Commit messages | Yes | Searchable via type:commit |
| Issue content | Yes | Searchable via type:issue |
Search Configuration
Customize indexing behavior per repository:
# .drok/search-config.yml
exclude:
- "vendor/**"
- "node_modules/**"
- "*.generated.*"
- "dist/**"
include_generated: false
max_file_size: 512KBAPI Access
Search is available via the REST API:
curl "https://drok.us/api/v1/search?q=refresh_token&lang=rust" \
-H "Authorization: Bearer $Drok_TOKEN"Response:
{
"total_count": 3,
"items": [
{
"repository": "my-org/my-repo",
"path": "src/auth/token.rs",
"line": 42,
"content": "fn refresh_token(ttl: Duration) -> Result<Token, AuthError> {",
"context_before": ["/// Refresh an expired token with the given TTL."],
"context_after": [" let token = generate_token()?;"],
"language": "rust"
}
]
}