Skip to main content

searxh

Small BM25 search tool for local code/docs. No third-party dependencies.

what it does

  • Indexes text/code files into SQLite (bm25.sqlite by default)
  • Supports incremental indexing (only changed files are reprocessed)
  • Ranks with BM25
  • Shows optional snippets with line numbers
  • Supports path/extension filters, JSON output, and colored matches

requirements

  • Python 3.9+

install

Editable install:

python3 -m pip install -e .

After install, use:

searxh index .
searxh "replication backlog"
sx index .
sx "replication backlog"

quick start

Build or update index:

./search index .

Check whether the current directory is indexed:

./search status

Search:

./search "replication backlog"

command forms

./search [global-options] index [root] [index-options]
./search [global-options] search "query"
./search [global-options] "query"

common examples

Full rebuild:

./search index . --full

Search with snippet + color:

./search --snippet --color "aof fsync"

Filter by path:

./search --path src/ "replication"

Filter by extension:

./search --ext .c,.h,.md "dict"

JSON output:

./search --json "cluster slots"

Custom index path:

./search index . --out /path/to/myindex.sqlite
./search --index /path/to/myindex.sqlite "term"

key options

  • --k: number of results (default 10)
  • --k1, --b: BM25 tuning knobs
  • --path-boost: extra weight for path token matches (default 1.5)
  • --stem: enable simple stemming
  • --no-stopwords: disable stopword filtering
  • --workers: indexing worker threads
  • --no-progress: hide indexing progress output

indexing behavior

  1. Scan files by extension/name and skip likely binary files.
  2. Compare mtime and size with index metadata.
  3. Reindex changed files and remove deleted files.
  4. Update postings and document metadata in SQLite.

If a file produces no tokens (for example, empty/whitespace-only), it is saved as a zero-length doc so incremental runs do not keep retrying it.

tests

python3 -m unittest discover -s . -p 'test_*.py' -q

troubleshooting

sqlite3.OperationalError: unable to open database file

  • Make sure the DB parent directory exists and is writable.
  • Try writing the DB in the current project first:
./search index . --out ./bm25.sqlite

Results look weak

  • Rebuild with --full
  • Try --stem
  • Increase --k
  • Recheck filters (--ext, --path)

files

  • src/sx_search/cli.py: CLI
  • src/sx_search/engine.py: indexing/search engine
  • search: compatibility wrapper script
  • bm25tool.py: compatibility import wrapper
  • test_bm25tool.py: tests
  • SEARCH.md: short usage notes

Metadata

Release files for searxh 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for searxh 0.1.2
File Size Uploaded Provenance
searxh-0.1.2.tar.gz 12.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for searxh 0.1.2
File Interpreter ABI Platform
searxh-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 25.4 kB

Release files / searxh-0.1.2.tar.gz

Download URL searxh-0.1.2.tar.gz
Size 12.3 kB
Tags Source
SHA-256 checksum
How to use checksums
345f4d930ffea86a6693b815067d54b3cb1569917060c82251a93335ea6e1626
BLAKE2b-256 checksum
How to use checksums
909995dc2f0c8304377c7b9f0b727763d5e55934cc3e4e493db84716fd61dfa3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release files / searxh-0.1.2-py3-none-any.whl

Download URL searxh-0.1.2-py3-none-any.whl
Size 13.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e28d3be7a8f96ba28284003cfcc01c3986c4df1ab2e9157ad0e4bc40393d4dd9
BLAKE2b-256 checksum
How to use checksums
234a4cee21f7dffafc5016d2dca3933a0e64b7f3c531124d23da36243d21d9f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Security for searxh 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page