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

Uploaded CPython 3.14Windows x86-64

hermes_core_python-0.4.7-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.7-cp314-cp314-macosx_11_0_arm64.whl (843.1 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

hermes_core_python-0.4.7-cp313-cp313-win_amd64.whl (785.7 kB view details)

Uploaded CPython 3.13Windows x86-64

hermes_core_python-0.4.7-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.7-cp313-cp313-macosx_11_0_arm64.whl (842.2 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hermes_core_python-0.4.7-cp312-cp312-win_amd64.whl (785.7 kB view details)

Uploaded CPython 3.12Windows x86-64

hermes_core_python-0.4.7-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.7-cp312-cp312-macosx_11_0_arm64.whl (841.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.7-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 cb072900265c979c68991f174feea464e7e8022ba81b56ab535c6bb301d63958
MD5 60abd78a5f777b7f9fb3c64d26c6e6a2
BLAKE2b-256 08df6acf21be5f75ede8670f1ed2013f8a6a3b2e7948eff5ffaa075281b33a88

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.7-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 1fd90c844f1b4d256d6774c3118b30174e3af2ecef7b3a158111cd68eda1ff24
MD5 4779f5c772e5eadcbce2a84935f7086a
BLAKE2b-256 a5d9bedabc8217809dd599c06bd3b78b981e6b8e5d19069bae06cb6b8a685724

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.7-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8d8fed1ddd6bcff438b87cc2ff85a9c12344f7c56e8e27f2429f237b208f76c0
MD5 67697d4050917925cefa7712e27f15ff
BLAKE2b-256 9c495867290bff3c27f19a3324086699678e70887e692cf4b8dc6df15290c9e1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.7-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 03d57155a46b11951848f1850014ebdd3536516504acd3a221d4e715b2badbd9
MD5 004ac2d2cbac3a91026edfa75f665295
BLAKE2b-256 65aecbb958fbbba05e95b5cea7c9ef93d6581b2b247ca8a87d53a119ebb6aee5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.7-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 8467e913f58b5b06efaca263f3c258b75070063c45da5255cad885dfb5517c42
MD5 d3505c686c769c213040659c5b05076f
BLAKE2b-256 f451cec156a2c0a99fa48bf22933f7aacad639ae24a519f0afc2bdf3e8cfa2a1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.7-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 01cab6d5fa4139d159fcbcf3d1451a888a742b34d6e098652a9f0db34fe6eb21
MD5 4459107aa553fcfaddf390b69bd60979
BLAKE2b-256 86f69ff17e2bd70e5df7178d5409b1c0722fb5d23b21540540e30c7b800c0c2e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.7-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 7169c74a4f24aa67cd28e14cbd5b799b8872528e2d08df3b6555e6c5a883c218
MD5 dab2e6eba645ddc933c2ef7fc76d7037
BLAKE2b-256 35737a6629f861f0ff5491ef915d8d7ac619d14f4e647a084730ade38a617241

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.7-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 39033e678d273c3df4dff883185d3a1dab92da92b7bc8a69c41115ff473c70a7
MD5 a532cc74ce44e6f5efb7daef9ee6fcc6
BLAKE2b-256 e8505095e824aa99395a45cca2736d60b001dea3961d909d7327cd0567c669a5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.7-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 58ef5a9a35efefdd5ebbb89a86ad801cb6a9cf1632dddf67e3c67618cb27284a
MD5 9c444b38589d05b83d9b1600120e82ad
BLAKE2b-256 24b744029dce4cdf6042ed0897d91b1af32bff5c9063bbe6f99e604102259a18

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