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.4.11-cp314-cp314-win_amd64.whl (786.4 kB view details)

Uploaded CPython 3.14Windows x86-64

hermes_core_python-0.4.11-cp314-cp314-manylinux_2_34_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ x86-64

hermes_core_python-0.4.11-cp314-cp314-macosx_11_0_arm64.whl (844.6 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

hermes_core_python-0.4.11-cp313-cp313-win_amd64.whl (786.0 kB view details)

Uploaded CPython 3.13Windows x86-64

hermes_core_python-0.4.11-cp313-cp313-manylinux_2_34_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

hermes_core_python-0.4.11-cp313-cp313-macosx_11_0_arm64.whl (843.2 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hermes_core_python-0.4.11-cp312-cp312-win_amd64.whl (785.9 kB view details)

Uploaded CPython 3.12Windows x86-64

hermes_core_python-0.4.11-cp312-cp312-manylinux_2_34_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

hermes_core_python-0.4.11-cp312-cp312-macosx_11_0_arm64.whl (842.6 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.11-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 55ff74b51ef9462a927daaf0f4bd13fe57dc6aa7d1b4da47c2df3394ffe0156d
MD5 a96aefa6ef4a0738b80de0c3244a86c8
BLAKE2b-256 d12957febeffdb6737af98534215074926dfc74a354cf9e9fc4bffe6adf3f162

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.11-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 196244ef280d6f2072407a2adb912d767bd0c586d7985d2339fd71986a7dae73
MD5 7686ab26c69e2e928624ec627c375646
BLAKE2b-256 7c6a2ff478404f9d7414e16045ea1dcf0f61c9b3d1fc6215c7a6b9a9c7fe9cc9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.11-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a480ec68198839ec83e00cc0271a1e82c5a2ba0858ac2fd8d84caa4fe50052ea
MD5 3bf3e7e55e3759f8ebca6f7b836fd231
BLAKE2b-256 a521fb468afb8afe521abd58183d79a76f711e81d4087ba18646b5dc05a01ee8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.11-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 f5de409eae797ed3970b2290af4a0b7735dc0d92a97e6757c0c831296a9ae030
MD5 690e8c4cf090ba10d057a20fc5f53bb9
BLAKE2b-256 2372086c239dd35ad06fd01bc2ff46c615bb8494fec9e7073da9d0df6135dd7e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.11-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 a18153393c04f94dc892337b623abec1a87de3d16bc16f9f1ac0548a4bc7dc6f
MD5 d96deecea33eb5a42650ee11884d866f
BLAKE2b-256 842412ca48dd84721143588f48871c8b1230fe9bcaad0c4e7b5d5368c108e7c3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.11-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 53dd3d6eaecbbb9303f5dccf60e1e3f918759f1733eebcc242aa382ac2dc2cb8
MD5 1424504dc1f0f165e00478a7bf4511d5
BLAKE2b-256 5e1bd78e02980c9bb4ef54c6b8cbdbef27ada00be31f0a270917cb33fb0cb709

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.11-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 abf1930096ebd966d678004840ae812af9c1ab430b92885902c6eb8f18e4df7f
MD5 0ad05465fee909bf2ede061e7d3990bc
BLAKE2b-256 d57ae3ddf002becb65193d1c05fcdcbea58ba68a038c1c83e2dc8504c2335da3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.11-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 93c412010ad3ae24e1b8fc0c29b67809645ff985f67fac26f771223fe9e5c49c
MD5 735d622488d73db3c3bc8c329c5acd09
BLAKE2b-256 cde4cacad18015066795cb77d3438cdaa05e2e0fe368718517c9f47a65e97a1f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.11-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4b1dcf20eb8242205dc9455e4c486b0c3d0082866e19d43a76e5e6308c1ecb88
MD5 d5b0a86a900d2f3ac6f2132d6398b898
BLAKE2b-256 0a91d132a88c26497d7b6945d4540483c76fa1add9c2a1f4d653cd0df40399b9

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