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

Uploaded CPython 3.14Windows x86-64

hermes_core_python-0.4.10-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.10-cp314-cp314-macosx_11_0_arm64.whl (843.0 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

hermes_core_python-0.4.10-cp313-cp313-win_amd64.whl (785.4 kB view details)

Uploaded CPython 3.13Windows x86-64

hermes_core_python-0.4.10-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.10-cp313-cp313-macosx_11_0_arm64.whl (842.0 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hermes_core_python-0.4.10-cp312-cp312-win_amd64.whl (785.3 kB view details)

Uploaded CPython 3.12Windows x86-64

hermes_core_python-0.4.10-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.10-cp312-cp312-macosx_11_0_arm64.whl (841.8 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.10-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 25b28ed273a8bf4906eb176856b47dafcea1f55a21fcf313595b5930e5e72f87
MD5 3ab32fef1fbfab3b03116aebc68aecdf
BLAKE2b-256 4b8925b18bd71bb828785cdbe43dbff4461560e29ebeff52e5b23f0c0da54ab2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.10-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 2cd3f146686979721fbc4cd357e88b1b180a5ede16c6d4f0f213b4e18fd9091f
MD5 9d9e1f4eacd5f5a1aa650fe8542a2d84
BLAKE2b-256 dadcb61231ea5d89066f94d4b93988bca471d78edba46dd011d1221b6728aebf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.10-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a063c53073be9a9179e9e6d10053eb4307e3d6caec0dccffb17d49fe0e5d2904
MD5 2b5ffd6ff9e908f482c990d76394c419
BLAKE2b-256 06960bf5dcf419cf9d72fdc6efe18de796e9c8df4cdb0a854cee7bf177dc2c6b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.10-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 98e63f3cec1a654d15cc7fd776cb3799fa6331d4a787683b48d58d5fa8554473
MD5 24f130a94a284d339b9008426083be47
BLAKE2b-256 31aaaa7dd941f5410543492437b486b24cb61b4aa86365ea5d383169c74ce05b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.10-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 38970be089a3594d7baea74525eb6f05fcc5b4a4d4d1258fd96577b27cd25b18
MD5 192ecd0d709d01070492407bf9769b34
BLAKE2b-256 e087d1921c11a4ce6c0f32f322fcbe20189702b07a9a5042faca171a13d63efc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.10-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bba4e279ecd0aa0039a40b83d1d94f7de60eaba58e8af58feff0759f3b14af07
MD5 e6705f7153ef9016efa3c0d41a679679
BLAKE2b-256 19f6503b045b25127d96dc63de00cc027b3e3acd7ace6068e22ab24b007275b2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.10-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4748f533c8f9a0464cfc7912d0c6d200688276b68a6ab8ff87cc7f137e6975bb
MD5 3b078b7417d5a3842fcc44b64d0570de
BLAKE2b-256 556723ce6b9849bd929cfaca5da1b1fa92bd25cf332759b058d7433524e17136

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.10-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 551f13994edba1314f09f5b1dc262411f91ce32afe51109fc8bce06712c1b192
MD5 7a7e06a9117a3a561a75ab9425f622b0
BLAKE2b-256 35e4349558ce5321520e7b537477463c112b3ac3cb87b2b94a6771f916d11962

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.10-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0cc0881b26e907ec614e2a1acfc89407afe88f1012d2f2f59b087ddccff45a53
MD5 248c9ceaf412639e20a6d68e2121fb8a
BLAKE2b-256 b9d61fca71878adcf282873bebf660283bc6e02a9772d2f35df8cb0bae9c340e

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