Skip to main content

Python bindings for Hermes search engine

Project description

Hermes

A high-performance, embeddable full-text search engine written in Rust.

Features

  • Fast indexing - Parallel segment building and compression
  • BM25 ranking - Industry-standard relevance scoring
  • WAND optimization - Efficient top-k query processing
  • Multiple platforms - Native, WASM, and Python bindings
  • Flexible schema - SDL-based schema definition language
  • Compression - Zstd compression with configurable levels
  • Slice caching - Optimized for cold-start latency

Packages

Package Description Registry
hermes-core Core search engine library crates.io
hermes-tool CLI for index management and data processing crates.io
hermes-server gRPC server for remote search crates.io
hermes-core-python Python bindings PyPI
hermes-wasm WASM bindings for browsers npm

Quick Start

Installation

# Install CLI tool
cargo install hermes-tool

# Or use as a library
cargo add hermes-core

Create an Index

# Create index from SDL schema
hermes-tool create -i ./my_index -s schema.sdl

# Index documents from JSONL
cat documents.jsonl | hermes-tool index -i ./my_index --stdin

# Or from compressed file
zstdcat dump.zst | hermes-tool index -i ./my_index --stdin -p 50000

# Merge segments
hermes-tool merge -i ./my_index

# Show index info
hermes-tool info -i ./my_index

Schema Definition (SDL)

index documents {
    field title: text [indexed, stored]
    field content: text [indexed]
    field author: text [indexed, stored]
    field published_at: u64 [indexed, stored]
}

Data Processing Tools

# Calculate SimHash for near-duplicate detection
cat docs.jsonl | hermes-tool simhash -f title -o title_hash

# Sort documents by field
cat docs.jsonl | hermes-tool sort -f score -N -r

# Pipeline example
zstdcat dump.zst \
    | hermes-tool simhash -f title -o hash \
    | hermes-tool sort -f hash -N \
    | hermes-tool index -i ./my_index --stdin

Using as a Library

use hermes_core::{Index, IndexConfig, FsDirectory};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let dir = FsDirectory::new("./my_index");
    let config = IndexConfig::default();
    let index = Index::open(dir, config).await?;

    println!("Documents: {}", index.num_docs());

    Ok(())
}

Python Usage

import hermes_core

# Open index
index = hermes_core.Index("./my_index")

# Search
results = index.search("query text", limit=10)
for doc in results:
    print(doc.score, doc.fields)

WASM Usage

import init, { HermesIndex } from "hermes-wasm";

await init();
const index = await HermesIndex.open("/ipfs/Qm.../");
const results = await index.search("query text", 10);

Development

Prerequisites

  • Rust 1.92+
  • Python 3.12+ (for Python bindings)
  • Node.js 20+ (for WASM)
  • wasm-pack (for WASM builds)

Building

# Build all packages
cargo build --release

# Build WASM
cd hermes-wasm && wasm-pack build --release --target web

# Build Python wheel
cd hermes-core-python && maturin build --release

Testing

cargo test --all-features

Linting

# Install pre-commit hooks
pip install pre-commit
pre-commit install

# Run linters
cargo fmt --all
cargo clippy --all-targets --all-features

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.

hermes_core_python-0.3.6-cp314-cp314-win_amd64.whl (687.2 kB view details)

Uploaded CPython 3.14Windows x86-64

hermes_core_python-0.3.6-cp314-cp314-manylinux_2_34_x86_64.whl (906.9 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ x86-64

hermes_core_python-0.3.6-cp314-cp314-macosx_11_0_arm64.whl (740.1 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

hermes_core_python-0.3.6-cp313-cp313-win_amd64.whl (686.9 kB view details)

Uploaded CPython 3.13Windows x86-64

hermes_core_python-0.3.6-cp313-cp313-manylinux_2_34_x86_64.whl (905.8 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

hermes_core_python-0.3.6-cp313-cp313-macosx_11_0_arm64.whl (741.5 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hermes_core_python-0.3.6-cp312-cp312-win_amd64.whl (686.8 kB view details)

Uploaded CPython 3.12Windows x86-64

hermes_core_python-0.3.6-cp312-cp312-manylinux_2_34_x86_64.whl (905.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

hermes_core_python-0.3.6-cp312-cp312-macosx_11_0_arm64.whl (741.2 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

Details for the file hermes_core_python-0.3.6-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for hermes_core_python-0.3.6-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 12076957005af8cf63e51ef709a6b2e49ad5aace1f197050deac4de2bde28cb5
MD5 bc2ed77ca0c5b09e09703fda4f4bab98
BLAKE2b-256 7e4506857af1a87da24548a7a4f403426f506279b6fd73a36b00fbdc9b8c7b5b

See more details on using hashes here.

File details

Details for the file hermes_core_python-0.3.6-cp314-cp314-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for hermes_core_python-0.3.6-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 ee5b87c6884f3d5fd710efcc6b0c821a62e8711a54a6ac65d5ea66cc7f13f630
MD5 459262e4bb462dbec436ca6bde786098
BLAKE2b-256 d79929be747a64e50a0d7ea1dd7b27587e7b1f005e9e590f8d743cb78aafd7dd

See more details on using hashes here.

File details

Details for the file hermes_core_python-0.3.6-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hermes_core_python-0.3.6-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9c16d321a66b63291c64ef6df82ca359bfd348fa0d76139c8505695f720cb332
MD5 747825cc27650e6a084d46f626eb4417
BLAKE2b-256 f0ce4b158f69162fec0d6712ab6c4aca8b1684f98b881ee74555f28c855f3713

See more details on using hashes here.

File details

Details for the file hermes_core_python-0.3.6-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for hermes_core_python-0.3.6-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 cb720b5cd8fc2212f67f407b76e1aa1a8af5257c3fdedd8daf8b00970f02fc01
MD5 27c07b857521e4f39256605cd1014414
BLAKE2b-256 0dc1bc5452d6991082c7d504483033d372a5de9f84028a6c2551a026c338e0f2

See more details on using hashes here.

File details

Details for the file hermes_core_python-0.3.6-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for hermes_core_python-0.3.6-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 5d0b6cdb2ba093c93d6c5c739cde7721da98fa282cd1bf36f20f9b44f10c8b06
MD5 d19f816f8e5b0bdbdf3d74e4517856aa
BLAKE2b-256 1952befd44e1d880ab9b9cbf31723410b97705f3d8d1e539a95091dc0e60b1d6

See more details on using hashes here.

File details

Details for the file hermes_core_python-0.3.6-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hermes_core_python-0.3.6-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 335513a686a09b0f65302d7a9df4170942e1e82c10c4ea2406ccafeb95511b30
MD5 cd1617a217a69cfa72e7d9a1e9aa4a3a
BLAKE2b-256 76559c6919211dd401cbab4e9d051bd77ec1082ebab3a6af2677deb6dba079be

See more details on using hashes here.

File details

Details for the file hermes_core_python-0.3.6-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for hermes_core_python-0.3.6-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 ad54400c5dd0459c91aa001cf7bc00e9c59cbf859cefbc5e15edc81937c9e7d0
MD5 d2e8236df53f6ed2298137498089e5b2
BLAKE2b-256 878b12906b87e0c2dad2aa76b4d0c0ce0d94f6dece91ef219bf271c8515d0228

See more details on using hashes here.

File details

Details for the file hermes_core_python-0.3.6-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for hermes_core_python-0.3.6-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 4d24cb3bb08062795d3b814f3ff6cbd6438df9ce0c275e5eaf6b7fec814da694
MD5 c8f3a67b55842147f5c2d8b8b9ee6803
BLAKE2b-256 1c0194e441e77ed5b5f9885a42ddc79a05b57c540e60008a917fb45645aa6214

See more details on using hashes here.

File details

Details for the file hermes_core_python-0.3.6-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hermes_core_python-0.3.6-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fded87d1716b91b67e052d4b7463e40d14f8b7e193a51107910c6d11031b67ba
MD5 501fc9294decac311bfaefb3021aa8c5
BLAKE2b-256 75351e01510e9612fe4139ad657d541360be62be027ff1ddbe7a3ae459a20dfe

See more details on using hashes here.

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