Skip to main content

Hybrid file search — semantic + keyword matching

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

hhg (hybrid grep)

Hybrid file search — semantic + keyword matching

pip install hhg
hhg build ./src
hhg "authentication flow" ./src

What it does

Search code and text using natural language. Combines semantic understanding with keyword matching (BM25) for accurate results:

$ hhg build ./src                    # Build index first
Found 40 files (0.0s) Indexed 646 blocks from 40 files (34.2s)

$ hhg "error handling" ./src         # Then search
api_handlers.ts:127 function errorHandler
  function errorHandler(err: Error, req: Request, res: Response, next: NextFunc...

errors.rs:7 class AppError
  pub enum AppError {
      Database(DatabaseError),

2 results (0.52s)

Why hhg over grep?

grep finds exact text. hhg understands what you're looking for.

Query grep finds hhg finds
"error handling" Comments mentioning it errorHandler(), AppError
"authentication" Strings containing "auth" login(), verify_token()
"database" Config files, comments Connection, query(), Db

Hybrid search combines semantic understanding (finds related concepts) with BM25 keyword matching (finds exact terms). Best of both worlds.

Use grep/ripgrep for exact strings (TODO, FIXME, import statements). Use hhg when you want implementations, not mentions.

Install

Requires Python 3.11-3.13 (onnxruntime lacks 3.14 support).

pip install hhg
# or
uv tool install hhg
# or
pipx install hhg

The embedding model (jina-code-int8) downloads on first use (~154MB).

Usage

hhg build [path]                # Build/update index (required first)
hhg "query" [path]              # Semantic search
hhg status [path]               # Check index status
hhg list [path]                 # List all indexes under path
hhg clean [path]                # Delete index
hhg clean [path] -r             # Delete index and all sub-indexes

# Options
hhg -n 5 "error handling" .     # Limit results
hhg --json "auth" .             # JSON output for scripts/agents
hhg -l "config" .               # List matching files only
hhg -t py,js "api" .            # Filter by file type
hhg --exclude "tests/*" "fn" .  # Exclude patterns
hhg --exclude "*.md" "api" .   # Code only (exclude docs)

# Model
hhg model                       # Check if model is installed
hhg model install               # Download model (auto-downloads on first use)

Note: Options go before positional args, or use -- separator:

hhg --exclude "*.md" "api" .   # Options first
hhg "api" . -- --exclude "*.md" # Or use -- separator

Output

Default:

src/auth.py:42 function login
  def login(user, password):
      """Authenticate user and create session."""
      ...

JSON (--json):

[
  {
    "file": "src/auth.py",
    "type": "function",
    "name": "login",
    "line": 42,
    "end_line": 58,
    "content": "def login(user, password): ...",
    "score": 0.87
  }
]

Compact JSON (--json --compact): Same fields without content.

How it Works

Query → Embed → Hybrid search (semantic + BM25) → Results
                        ↓
             Requires 'hhg build' first (.hhg/)
             Auto-updates stale files on search

Supported Files

Code (22 languages): Bash, C, C++, C#, Elixir, Go, Java, JavaScript, JSON, Kotlin, Lua, Mojo, PHP, Python, Ruby, Rust, Svelte, Swift, TOML, TypeScript, YAML, Zig

Text: Markdown, plain text, RST — smart chunking with header context for docs, blog posts, research papers

Development

git clone https://github.com/nijaru/hygrep && cd hygrep
pixi install && pixi run build-ext && pixi run test

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

hhg-0.0.24-cp313-cp313-manylinux_2_17_x86_64.whl (107.4 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

hhg-0.0.24-cp313-cp313-manylinux_2_17_aarch64.whl (99.2 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

hhg-0.0.24-cp313-cp313-macosx_11_0_arm64.whl (97.2 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hhg-0.0.24-cp312-cp312-manylinux_2_17_x86_64.whl (107.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

hhg-0.0.24-cp312-cp312-manylinux_2_17_aarch64.whl (99.2 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

hhg-0.0.24-cp312-cp312-macosx_11_0_arm64.whl (97.4 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

hhg-0.0.24-cp311-cp311-manylinux_2_17_x86_64.whl (106.2 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

hhg-0.0.24-cp311-cp311-manylinux_2_17_aarch64.whl (99.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

hhg-0.0.24-cp311-cp311-macosx_11_0_arm64.whl (97.2 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

Details for the file hhg-0.0.24-cp313-cp313-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for hhg-0.0.24-cp313-cp313-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 52b4a55ee265ae760fdd894f38fea6394365dcd5441de5a0edecc4206e14e795
MD5 15a44502749c6e359968d3e49d24e991
BLAKE2b-256 6fccff7c5e52c23f0916b25ad5d1a4093898b45d917970dff04183c620f511a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for hhg-0.0.24-cp313-cp313-manylinux_2_17_x86_64.whl:

Publisher: release.yml on nijaru/hygrep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hhg-0.0.24-cp313-cp313-manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for hhg-0.0.24-cp313-cp313-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 bb8e9dcfb7f21a50fbcd30eaa916c591ff7fc4aa7cc6483f1b5059585ae4e149
MD5 889f9d0a4bece9cc51dc5630d0bf5819
BLAKE2b-256 0a0449199a3ddb397e54de751dd163e00d4d9b78f7e7cb86b9110f0183996a4a

See more details on using hashes here.

Provenance

The following attestation bundles were made for hhg-0.0.24-cp313-cp313-manylinux_2_17_aarch64.whl:

Publisher: release.yml on nijaru/hygrep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hhg-0.0.24-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hhg-0.0.24-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 17a0971c643144007dc0b37f8e6b4ea286c8a0802af0e874d775e9ca0422980b
MD5 4588697853e0985a5f3e683c3b6ad5b6
BLAKE2b-256 81cd4bc6229f45216028fd953216a7d06f0b236bffcfdd0cf0738d1a46123b3c

See more details on using hashes here.

Provenance

The following attestation bundles were made for hhg-0.0.24-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: release.yml on nijaru/hygrep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hhg-0.0.24-cp312-cp312-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for hhg-0.0.24-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 28e08651a25996fe240fc68fd7cfd4712d2faadc14d575ad2000dc5de1f1f0cc
MD5 c93c9bbc1ac40b0ff0e7e9269f3c4736
BLAKE2b-256 35bbf629724f782dd9a93dc2f32a87cf95f9fd17f602a4b60807f0a0d8a5fa9a

See more details on using hashes here.

Provenance

The following attestation bundles were made for hhg-0.0.24-cp312-cp312-manylinux_2_17_x86_64.whl:

Publisher: release.yml on nijaru/hygrep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hhg-0.0.24-cp312-cp312-manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for hhg-0.0.24-cp312-cp312-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 adf41b00134beaf8eedf1c3585d04af8d9002d72cf4cb08814a53172fa3342b0
MD5 9eeef94dcee9ca4d7009cfabb6657697
BLAKE2b-256 74a26f325258a059d41aa77a0172390eded94465d2854d494308819ce35d637e

See more details on using hashes here.

Provenance

The following attestation bundles were made for hhg-0.0.24-cp312-cp312-manylinux_2_17_aarch64.whl:

Publisher: release.yml on nijaru/hygrep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hhg-0.0.24-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hhg-0.0.24-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 233c93c45f0004507a166ce5f70c82878642fee2d6db2cf063ad499442df346d
MD5 ebe4001f9b031ae0933d79f41512294b
BLAKE2b-256 18dcccc178daec6dbab850d40e72a997e5a4d523e421bf65c3818210e37a9a60

See more details on using hashes here.

Provenance

The following attestation bundles were made for hhg-0.0.24-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yml on nijaru/hygrep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hhg-0.0.24-cp311-cp311-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for hhg-0.0.24-cp311-cp311-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 bbaa5b4bbe1243413fa17456b4f43ac3bdc0d2e206096748c9db2092ff66ea3e
MD5 5d56e03a8f54b60a8aa7397773f40daf
BLAKE2b-256 3a4b814d921256d7fd229f7c30a0360d11340c6e746f675fd51e6f869f1dd902

See more details on using hashes here.

Provenance

The following attestation bundles were made for hhg-0.0.24-cp311-cp311-manylinux_2_17_x86_64.whl:

Publisher: release.yml on nijaru/hygrep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hhg-0.0.24-cp311-cp311-manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for hhg-0.0.24-cp311-cp311-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 9502e320ebf654b0515eb097cbfa26749059767dad296e0562e9e391b6d90e13
MD5 a7f59dd19c8155e43a0aab8e4d68df19
BLAKE2b-256 57a3c91e63c83af6da72b8499baa518829a181cc0062f7df1979be1b39953684

See more details on using hashes here.

Provenance

The following attestation bundles were made for hhg-0.0.24-cp311-cp311-manylinux_2_17_aarch64.whl:

Publisher: release.yml on nijaru/hygrep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hhg-0.0.24-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hhg-0.0.24-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4bff3be2945f2bd938851aaa247de6dc45d350d4aa4cca44a38bc8da945d5169
MD5 252ff022fd6f1ce05bc976b8709ea9f8
BLAKE2b-256 cce29dd3d6150c23723c225e3e658e2450f5a6fd0f23514ad71883b630550502

See more details on using hashes here.

Provenance

The following attestation bundles were made for hhg-0.0.24-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: release.yml on nijaru/hygrep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page