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

Uploaded CPython 3.14Windows x86-64

hermes_core_python-0.4.9-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.9-cp314-cp314-macosx_11_0_arm64.whl (842.4 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

hermes_core_python-0.4.9-cp313-cp313-win_amd64.whl (786.1 kB view details)

Uploaded CPython 3.13Windows x86-64

hermes_core_python-0.4.9-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.9-cp313-cp313-macosx_11_0_arm64.whl (841.4 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hermes_core_python-0.4.9-cp312-cp312-win_amd64.whl (786.0 kB view details)

Uploaded CPython 3.12Windows x86-64

hermes_core_python-0.4.9-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.9-cp312-cp312-macosx_11_0_arm64.whl (841.3 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.9-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 17a268b1d4367a3c541e2e3412e465419613cdd1260ac6ffb958227d98fc3f75
MD5 b57ade7ae17ca3fed929cc01fa1a9130
BLAKE2b-256 ea105ed41449fa6b3d3e43b67c40755896222691f8f406e906a6a8bbc8bbff68

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.9-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 4e239ffbfa7cf01ce5192a68ebae63d499e0fcb6d159d80ab24045c96e499183
MD5 dbef2d63c20018ac63b135c7ad5fd1f0
BLAKE2b-256 fa9fb57e15dd563b786b1e14fade7a092b524f52f81f89270fd270b9ba6b3b87

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.9-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b8f533ae57e14aacda0408196c42e3890e5ef7abe668c5b0fa0586b156b5aceb
MD5 bfaa9588da3debf75be8e2969b744523
BLAKE2b-256 c353f3ff40b8cf2bdf39bb4f90dc025541ddf3a4137039ffb6a8ae99988c4821

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.9-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 5397b41490aa65fcea46222c97ad7fe4ee3064372fac7d8a17ce1131ad9e6349
MD5 2ac4a7d25999c0fa9df5f73a1a9faf64
BLAKE2b-256 ad7e5a655e15692e45e87711b65c555a263c012cd79caa29420319719acc2f00

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.9-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 d49e4388097773faafdd2451ed4cac094c5f24aed8439ba4c5d1466ef29265b4
MD5 d2fe47d472360582a3d6b69679b4225b
BLAKE2b-256 8894df42854ebaec6bee2746ebb6139d1a99b95b870f8aac9f67d78826ce9a79

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.9-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a8646abb416e1cf7959b4d785ae5e7ef1952fc2df71b3ce5bfc7b288f7b9608c
MD5 2ea7dc6a6bc13db17eecb33a8389f3df
BLAKE2b-256 b292a6e22abf50900756cbaf623c46effebc66620c07ff20d999679c05cf0291

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.9-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 13c4f337d171175f38852f713c351640cbb012d6cda609e992929d8999dbb47f
MD5 49f7cb9e7d5a55899f7b609044030782
BLAKE2b-256 a4810dbcadff28803b6604800f45cd91bd9b6fcc94ca39fc11c96821cbccc0de

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.9-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 ae3fa7d9fa10acaf609d03250abd2da84bf06cd7f45add48e8a663a020dd1e96
MD5 3055fe9277a32618a48f3bb0a530e08b
BLAKE2b-256 40536bc2c3d9b03d4395b436a3aa6acb8e08c6b1f97e246714ca557241679a68

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.9-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8e00829c7d6624d9033adc39f6f9768c26b1efa6ade055c91aee5150b71e1723
MD5 19a51473da10b3e48fcdf70c344dc666
BLAKE2b-256 4b669ff21932f0948b1055eb1337f26ec974e43d185cc7aa9c2d7111faf065a0

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