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

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

hhg-0.0.22-cp313-cp313-macosx_11_0_arm64.whl (95.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hhg-0.0.22-cp312-cp312-manylinux_2_17_x86_64.whl (105.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

hhg-0.0.22-cp312-cp312-macosx_11_0_arm64.whl (95.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

hhg-0.0.22-cp311-cp311-manylinux_2_17_x86_64.whl (104.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

hhg-0.0.22-cp311-cp311-macosx_11_0_arm64.whl (95.7 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for hhg-0.0.22-cp313-cp313-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 6054365661b4ec9f6ec1df09e9b59afbbbceab4213ee458be7703d94eeea2607
MD5 960552f76bd4eb76916cd01b8d224c58
BLAKE2b-256 52e7035e568c8a3281ac40316f49facdd81ca4a67d3108c81ca2d7ab9a4adcbb

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.22-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a3a2457b6b44d067ed012aa4f05f321bd36bd1c3733f8434bb27940dcb15c9dd
MD5 4777fa1e801f4affcfcf5a7051d49438
BLAKE2b-256 4dd867e0403b12860a001f19374247c6635adc8f90e80fe13277c10259b8d6de

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.22-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 4b8270a7d3edb99d0e97f725e69cab783a45a99ff2700c00da0e1ad9f65f3ca2
MD5 5a2fcf1a9ac8b84b6b0e9239a7e0d694
BLAKE2b-256 8d3c75f99a2a51c7543b098856c5693a4792f8dca47258f5fc2d5d13240e0ba7

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.22-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 46569f43bf37eae9aa3f0ecad9a55fc58ef89a326c81bcb90f8e11504ef59470
MD5 7fd75023ef2049056caf7fbf99b242ba
BLAKE2b-256 78cb99d08ff1be22727e798df7d71b914923f7989339b5b596cce7a1d991675c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.22-cp311-cp311-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 f420466ce419736d9ccd649e11e3a06c5749312c1df468300bc49e7db9098f47
MD5 98062a71a097f3a8357d6ba06d61f457
BLAKE2b-256 78c2f3d4a2b18fde217dee4c7a3bf318cde2baa192fe0247dafc744dbf2340e7

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.22-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d6451571de3ef69beb957aab2f9088c915e33861ff0203c8f7d37ec999790972
MD5 b0c4c56d32443f0a88893cddeb175d92
BLAKE2b-256 2f55634d17ec5ecb4d76111a8c8b994cbd13d11f373e4875d7f4095446c4f06b

See more details on using hashes here.

Provenance

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