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

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

hhg-0.0.25-cp313-cp313-manylinux_2_17_aarch64.whl (100.5 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

hhg-0.0.25-cp313-cp313-macosx_11_0_arm64.whl (98.8 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hhg-0.0.25-cp312-cp312-manylinux_2_17_x86_64.whl (108.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

hhg-0.0.25-cp312-cp312-manylinux_2_17_aarch64.whl (100.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

hhg-0.0.25-cp312-cp312-macosx_11_0_arm64.whl (98.6 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

hhg-0.0.25-cp311-cp311-manylinux_2_17_x86_64.whl (108.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

hhg-0.0.25-cp311-cp311-manylinux_2_17_aarch64.whl (100.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

hhg-0.0.25-cp311-cp311-macosx_11_0_arm64.whl (98.6 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for hhg-0.0.25-cp313-cp313-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 73fcde59dee41504557baaf9bc8e50e51eda0a0f46b77dd42f398fb2f57b2504
MD5 f404c6965460fe47606966fcc1007787
BLAKE2b-256 1178f0ea792b15f007873ca191d9f1b0b1829e8703a5262fc119bfa2e66045b1

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.25-cp313-cp313-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 1e1f3c71045c02dcc4c6af662f04b61d5d0cb78cb0f151e380c58a97c2e2092c
MD5 8a14141c4a5feac709f8390066d7b448
BLAKE2b-256 a5fc77bde79397b6f446bf7e46daba29aa7e46978696f55388a6e406b023e247

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.25-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 214ecfe18368593edd237365b488b226586d5d50f317b231f92bb9b5b0afabcf
MD5 1cd125eba6973f3eaa0e6bbf83ee19f5
BLAKE2b-256 30fe845e1bb44bbf4e5d3e31440419d04947f4ee6484d0af2bd14e894cb3f8b8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.25-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 e5e5367cd3cf9608a142051da4b977b3564136b5921b1d2c89c007262e35db31
MD5 2c00714e041981375fce7e37bf11e24f
BLAKE2b-256 3c5a88f8255d1e6d05823aad435a0a931c551aa5e7279bbc15942e51d6118c58

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.25-cp312-cp312-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 138ede477bed1ac37c20b8dc8cd88d1ce41f8a404382dda3ffb33ed89e6c602b
MD5 cbdd8165a910faac8101bf6eaddcdc1a
BLAKE2b-256 ce25b23458032ab12e1b65a12d9d71f5ef2eed554ed50c965c6d230a7a934a49

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.25-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c5631a4eba274000c87b30a0400f08c52662f5343e14d4d7951a4a4d53c715e0
MD5 db2e5a4a7c7f28690e24f7529582d7e8
BLAKE2b-256 0bc2a132f798119f094e81c67a6d9cb9d74df4059e458858df71a15a807b55c3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.25-cp311-cp311-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 160ca599faeeb20676913e07e7695c702442d3b5f23fd27dc664dc20d91d3941
MD5 17982742708303a498ecd07cb137c6cf
BLAKE2b-256 de8e831924393c793a316d12cc0eafe1c50653d65011359096bca7949d5fd690

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.25-cp311-cp311-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 52b4d80d1a8fbda430a2de7b874dc2423eddc83acb5247dd181228a7a1945afc
MD5 c270c32f62a5ba956cfd84efdd49971e
BLAKE2b-256 36bc0540b17fa6f59c95ba9d5897c7b0a1f710ed48230d933ac03441cd002141

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.25-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6db85ccad6ab6677718d1aecf87470e2227cc9ae21b689f111f6685f00ba270d
MD5 9e16ce6a39868ba45d57ee74486e8ae2
BLAKE2b-256 af8457451b67aae8631277a680530b1414a3f02ddcabd0643f452a27a740495c

See more details on using hashes here.

Provenance

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