tantivy-search
Local code and markdown search tool built on Tantivy. Indexes directories for fast BM25 keyword search across code and markdown files.
Features
- BM25 search with hybrid exact (5x boosted) + fuzzy matching
- Field boosts: title (3x), heading_path (2x), content (1x)
- Language-aware chunking for 30+ programming languages and markdown
- Inline filters:
lang:py,repo:myrepo,file:*.toml,after:7d(with negation) - Snippet mode for compact output, with selective expansion of individual results
Usage
# Index directories (partition name derived from directory basename)
tantivy-index ~/code/my-project ~/Documents/notes
# Search
tantivy-search "error handling lang:py"
tantivy-search "config" --path /home/user/code/my-project
tantivy-search "README lang:md"
tantivy-search "error -lang:python" # exclude a language
tantivy-search "ssh setup after:7d" # recent results only
# Path filter: absolute path, repeatable for OR semantics
tantivy-search "config" --path /home/user/code/my-project --path /home/user/Documents/notes
# Browse-then-expand workflow (snippets are the default)
tantivy-search "error handling" -n 10 # 10 compact snippets with indices
tantivy-search "error handling" -n 10 -e 2,5 # expand results 2 and 5 to full content
# Index stats and listing
tantivy-search --status
tantivy-search --list-paths # tree of indexed filesystem paths with doc counts
Filters
| Flag / Inline | Description |
|---|---|
--path /abs/path |
Absolute filesystem path. Repeat to OR multiple paths. Matches the path itself or any descendant. |
-l / lang:<name> |
Filter by language (python, js, ts, rust, markdown, ...) |
after:<time> / before:<time> |
Timestamp filter (24h, 7d, 2w, or 2026-03-14) |
-lang:<name> |
Exclude a language |
Language aliases: py, md, rb, rs, sh, cs, kt.
Keeping the index up to date
tantivy-index does a full reindex of the given directories each time. For periodic reindexing, a systemd timer works well:
# ~/.config/systemd/user/tantivy-index.service
[Unit]
Description=Reindex tantivy-search
[Service]
Type=oneshot
ExecStart=%h/.local/bin/tantivy-index %h/code/my-project %h/Documents/notes
# ~/.config/systemd/user/tantivy-index.timer
[Unit]
Description=Reindex every 5 minutes
[Timer]
OnBootSec=30
OnUnitActiveSec=5min
[Install]
WantedBy=timers.target
For live reindexing (e.g. git-based change detection), see the Python API: SearchIndex.index_repo(repo_path, repo_name).
MCP server
pip install tantivy-search[mcp] adds an optional MCP server. Add to your Claude Desktop / Claude Code config:
{
"mcpServers": {
"tantivy-search": {
"command": "tantivy-search-mcp"
}
}
}
Metadata
Release files for tantivy-search 0.3.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tantivy_search-0.3.3.tar.gz | 128.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tantivy_search-0.3.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 146.6 kB
Release files / tantivy_search-0.3.3.tar.gz
| Download URL | tantivy_search-0.3.3.tar.gz |
|---|---|
| Size | 128.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fce63de631190b2f64be7591f1cd7c07511d5ef32b7fc1cb4a2cfa6f4735d551
|
|
BLAKE2b-256 checksum How to use checksums |
bc44f6723fba221a43762e6e74c5919e5f4b276c84179664f4d061113c3e8030
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / tantivy_search-0.3.3-py3-none-any.whl
| Download URL | tantivy_search-0.3.3-py3-none-any.whl |
|---|---|
| Size | 18.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
00b1d14ccf73d746d0e8133eefb8f4fc9c1c39d74e961c9c80a577f7e63cf6cf
|
|
BLAKE2b-256 checksum How to use checksums |
6ae9517dae340af2b815e86227a83eb36e06a9ba006c94326da11f9adcd51384
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|