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

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

hhg-0.0.30-cp313-cp313-manylinux_2_17_aarch64.whl (103.9 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

hhg-0.0.30-cp313-cp313-macosx_11_0_arm64.whl (102.0 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hhg-0.0.30-cp312-cp312-manylinux_2_17_x86_64.whl (112.1 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

hhg-0.0.30-cp312-cp312-manylinux_2_17_aarch64.whl (103.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

hhg-0.0.30-cp312-cp312-macosx_11_0_arm64.whl (102.0 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

hhg-0.0.30-cp311-cp311-manylinux_2_17_x86_64.whl (112.1 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

hhg-0.0.30-cp311-cp311-manylinux_2_17_aarch64.whl (103.9 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

hhg-0.0.30-cp311-cp311-macosx_11_0_arm64.whl (102.0 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for hhg-0.0.30-cp313-cp313-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 929d73676de08644f8227c3d6ca4e9e943ed1ee62dd96f95836c8cd72a171517
MD5 84a9b9f749845f85c57ff5a4bb41dfa8
BLAKE2b-256 d05ef1dceb3855e367916cd9a3d61d062ffb9c73883623cd79ec96da2d7e6aa7

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.30-cp313-cp313-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 e1a70ca08b4da211e288a31cbd6485ef6d2e01908a28a2bcddc8f9ebbed0d10b
MD5 b9f1201618aa9ef9ef3f51459ed759ca
BLAKE2b-256 7bf801a65ba58e3f1c8d1a75c8ff5a4ee87ae882fb088e01e56b64dbd36aa4f5

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.30-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1ba654db18e7f257dc7dbd01268ff97ed636891d28b1a02b90d61437549019f1
MD5 ee8566a26b2cd436ec2e2628cb1a6f9e
BLAKE2b-256 a4177d48b1bf677709d151094f130b8a800a90ea3b42dc1a476144fb492ed141

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.30-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 30ffc5db814d457e671fe179cf7e09302dfa8a13c435d4afc94552c7d5cf9f91
MD5 e78bc142e8c12c578de4c0b99f078625
BLAKE2b-256 ed64a9fe9e9c392ef82fe0d0a92765c07a7156245e463e4fa4dc870ba3a4ab4c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.30-cp312-cp312-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 2f4e494f6246a35b7b1aa7d8aade40a5fe56e4e6251c0417026ce58cf9129648
MD5 da1737a97325903ca8a7a44f09b2a1bc
BLAKE2b-256 419a02dde25f999f96c4e714a59203bc127107af45ac6b151a9d6e3bcce72f59

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.30-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 78d9db4f6d4463e57b7e30f33184cced1a8b3221e49f7e9951736a39feca2cf7
MD5 39997d345887472f2674297bfe1718ec
BLAKE2b-256 64c7461c5e6cab86e824ab5ca7e92d9ed7ca8e37a625972611fd0396a29afb14

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.30-cp311-cp311-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 3735414ab82cf6f5171a46431074ef42c93411ce391717ba1a90c9bf4c9a84b2
MD5 30c436235afc855db3330aeedcc7d678
BLAKE2b-256 0393c3f00546be2710a032ccf0fb659e19e0f1e1a94586b0da9ab2494c011f85

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.30-cp311-cp311-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 10b1bf7642bd394054f8aa014d35630f53db4f7e001892a3180555d74bb33a9c
MD5 804cdbb9f74431585ddafd64438254c0
BLAKE2b-256 678d9cd88ef4e2d83a1fe3ed19046efda6729c538ed6768ecddc9ec6a484f380

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.30-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 38995dee6c6d5ee6560f2b2fae5e22bd946d608065d7d0b07ed6290f1e52f687
MD5 896eed3a4d2da35ba3a7bce5a3e820b9
BLAKE2b-256 a264745a4d874f150ed4ccf0880a08db8203b3c24e4a85bfc1a9a5586e5a4081

See more details on using hashes here.

Provenance

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