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

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

hhg-0.0.21-cp313-cp313-macosx_11_0_arm64.whl (94.5 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hhg-0.0.21-cp312-cp312-manylinux_2_17_x86_64.whl (104.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

hhg-0.0.21-cp312-cp312-macosx_11_0_arm64.whl (94.5 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

hhg-0.0.21-cp311-cp311-manylinux_2_17_x86_64.whl (103.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

hhg-0.0.21-cp311-cp311-macosx_11_0_arm64.whl (94.6 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for hhg-0.0.21-cp313-cp313-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 ffc965e6a8c0dddb50fc7be4294b4b3114984f9e8a54b8051d7827092bd12a98
MD5 e0166ac7457feba152b2204077f9cf0a
BLAKE2b-256 e275fd13ee54d698d194ef5efadd67b10aa3015e0ef63c8b09e280ee3b25cad4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.21-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 46eb02e3de5decb8a111a52c5816459e1e228a2e26f38cf41980d3ef40d3effc
MD5 a3eeffed630e9f186d60c6a60ff87854
BLAKE2b-256 4ed4e8f5fd335e046d156bda38f124ad52b286a502dca87b9a1034879c981494

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.21-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 9af4aaddc11ff8c2736d311260618015b20b7a2db0b5639615bc30b6c3706bae
MD5 f8a3520853f3453c09c2bc805ff88a29
BLAKE2b-256 be1c2261172927c40a13468e35859a98a4d4bc1ae8f069c7aad66d778ab25984

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.21-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f4a9c542addfee24250e8c5c9c4599896cc208ec1ab3f284737788c6281a82e9
MD5 85d00e76b45078c23deca00b8f0994b5
BLAKE2b-256 0067a76620bacb571f2c161e08c23d056e25795575ff638cfba8ff1ccc368b22

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.21-cp311-cp311-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 1865e3cbbd2bf8afd5db0010798da90beb67a3f9cf7b1d2004b80e6f83282e31
MD5 b783b4523214d85f6e9a499b7b81828e
BLAKE2b-256 7a51d4df15aaef895548b0a73c42d3d05cc40081884500f4d178d32ae59f7bb4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.21-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b66167642432d560bd94ac2d07b02d88d17799b6c5ecf13b43ca1187466e531a
MD5 50ca8dda0a4f82f2b6ec1e3c068c89d7
BLAKE2b-256 5d435371eda158de8de9130e6fdf0fc28e5279bc69270762e27f1d49155d2aa0

See more details on using hashes here.

Provenance

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