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.28-cp313-cp313-manylinux_2_17_x86_64.whl (108.4 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

hhg-0.0.28-cp313-cp313-manylinux_2_17_aarch64.whl (100.2 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

hhg-0.0.28-cp313-cp313-macosx_11_0_arm64.whl (98.4 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hhg-0.0.28-cp312-cp312-manylinux_2_17_x86_64.whl (108.4 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

hhg-0.0.28-cp312-cp312-manylinux_2_17_aarch64.whl (100.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

hhg-0.0.28-cp312-cp312-macosx_11_0_arm64.whl (98.3 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

hhg-0.0.28-cp311-cp311-manylinux_2_17_x86_64.whl (108.4 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

hhg-0.0.28-cp311-cp311-manylinux_2_17_aarch64.whl (100.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

hhg-0.0.28-cp311-cp311-macosx_11_0_arm64.whl (98.4 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for hhg-0.0.28-cp313-cp313-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 17c9b8f0784aa3ccbbbe462ca9eccedb5b78e4778161f23f5f2052f7479b6bb5
MD5 a4fbfcad9d7c0ea554bbecedb1173dc7
BLAKE2b-256 d4bea1d9f9e7ebfc65dca78045dfba0eb7d820a0297629bab9177bfa83305300

See more details on using hashes here.

Provenance

The following attestation bundles were made for hhg-0.0.28-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.28-cp313-cp313-manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for hhg-0.0.28-cp313-cp313-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 a60d2e83b7773126ec3561d65cff7c860e2bfe31fef3eae0b4afcb414c1249f6
MD5 e5ea4892ab49070acbe60e315c375ff9
BLAKE2b-256 db8dc0eac0f14d8f4d823196611975868c538407af91d67bb4b379f8784d7c1a

See more details on using hashes here.

Provenance

The following attestation bundles were made for hhg-0.0.28-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.28-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hhg-0.0.28-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ac0f8ddceca183c9f97e8f441b967c9a0ac293570762d1a21893ff90f013f02e
MD5 01707de16781e6bf7265a47e09f2299d
BLAKE2b-256 b49f3d66467cc82de17ff9cf27b9e0f6e7855b66e07f0579581f1506433d927e

See more details on using hashes here.

Provenance

The following attestation bundles were made for hhg-0.0.28-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.28-cp312-cp312-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for hhg-0.0.28-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 6d2f9c08d6af803808628386b1631f556e787925e7e615edb4f9016445bce815
MD5 f52f65596e6e8616e0ba6d96efa19bb9
BLAKE2b-256 0af025b5f2f42249f5623e2d25afe992819394250fc75913964a232a52fc5372

See more details on using hashes here.

Provenance

The following attestation bundles were made for hhg-0.0.28-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.28-cp312-cp312-manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for hhg-0.0.28-cp312-cp312-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 3f905f160e4c8d68cb1dfb98c62acfb82e11f16ce09292b8d5da12bfc157e688
MD5 987e2d0b6548412cfe1861d194f1ad39
BLAKE2b-256 874e77ff70c7a79fcd7d7866df7a02d749602b80adfe6bb0df6661852cc79c94

See more details on using hashes here.

Provenance

The following attestation bundles were made for hhg-0.0.28-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.28-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hhg-0.0.28-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b56034f4bfe2cb0e0fda0cec7313021b3a1e076e1ffee5a1398f640ec15fab39
MD5 63e0834a1a480ca208f04c3e75ba9f53
BLAKE2b-256 6ea584160ccd6d3c63ff26a71d3c53a95e248ed475ed9a356668b4c67de149fc

See more details on using hashes here.

Provenance

The following attestation bundles were made for hhg-0.0.28-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.28-cp311-cp311-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for hhg-0.0.28-cp311-cp311-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 805421d75b5fc6119988e58a353489ebe62fc45300be0a2b82e55c771b799bd3
MD5 ccbb4990cbad885067fb56eaa613c7fa
BLAKE2b-256 38aadcf254711dc41187f502e845a1f74defd01b9847b58ec8dad328daa9cc04

See more details on using hashes here.

Provenance

The following attestation bundles were made for hhg-0.0.28-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.28-cp311-cp311-manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for hhg-0.0.28-cp311-cp311-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 23b249280bf5d8c7ad5ce0d1f98929de98c265130ab564597564c7ebdb2270c8
MD5 ce0e507e41eb2e9154f704b64d96d437
BLAKE2b-256 05ffc9d3c2b7bce24f0a215d4f3ea4145e4bd937a100a26fcdcc41dfec430cf9

See more details on using hashes here.

Provenance

The following attestation bundles were made for hhg-0.0.28-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.28-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hhg-0.0.28-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1eec1515b6a2a6f75781a8e40210f5a4756e8ffc27a56a87067e828aba9dc530
MD5 1ac8f1ef8d61526468f5b5c2229d5056
BLAKE2b-256 afbc8169391fdca1b877ad7a3e128039a25b329c3dc38959f5ad55530587f804

See more details on using hashes here.

Provenance

The following attestation bundles were made for hhg-0.0.28-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