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

Uploaded CPython 3.14Windows x86-64

hermes_core_python-0.4.14-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.14-cp314-cp314-macosx_11_0_arm64.whl (850.8 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

hermes_core_python-0.4.14-cp313-cp313-win_amd64.whl (792.0 kB view details)

Uploaded CPython 3.13Windows x86-64

hermes_core_python-0.4.14-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.14-cp313-cp313-macosx_11_0_arm64.whl (851.5 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hermes_core_python-0.4.14-cp312-cp312-win_amd64.whl (792.1 kB view details)

Uploaded CPython 3.12Windows x86-64

hermes_core_python-0.4.14-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.14-cp312-cp312-macosx_11_0_arm64.whl (851.3 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.14-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 38fecdd3f6799a610646b1ecf7c1d56b93740b746791a4e5c7f45ea28e4dbfc4
MD5 1d93d80470591b393dc9b8d7299af99c
BLAKE2b-256 46bb949738b9e01c93d81ebd61d42b52dc133c27d451e90cf6d9121bd0648e06

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.14-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 34cd5f2670e2fcef1aeb244a008bdd11d1d136eb125a22d48e782ffbadb29b4d
MD5 a39c469b0a23dcb0520f083d4cb63b23
BLAKE2b-256 d280666b705e7bab45a4d94d5cca4f5c54e81bbc3c6c9f01af2a66c262ea0b44

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.14-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f0b2d8d97660db72e0936c23a8bc3fed69adc42c8cc81ac3f896c12eabdcd49d
MD5 138529fabaa06b4d094d28e412e3973a
BLAKE2b-256 3dcd1cbeaa7aeddd20be1b3e209ecc6bc6b9e560628ebd7ef3704ebd111f86fc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.14-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 45081dfa135c6b7f4fc4cc5c97db5591c2158ef7050711dd7ad6161f4014af5a
MD5 d2d8be175982919704b94c7023563540
BLAKE2b-256 3ae3c6d59989c971f77e11d53875f22c7bf161105f887f7136275ead0a9100f4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.14-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 7e2f698ffae863561daeea8434964feec182eec39b98a7922d89cb749f659b97
MD5 2d732863df3ee4037f274a7eedc2a95c
BLAKE2b-256 425a6882f004469679c093272e048826fb1c2a76111d934a64313f857f75e9a2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.14-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 816ac07d5d259a0df5d9fc02965f47483b3763725b6f0e8acb9d5f27c75c2ee1
MD5 91dc4bfd464b106a079811b9e660f5a7
BLAKE2b-256 9095290739ad98e846f272023fde5f4f49f8e69afbe64630a4bb4ac82338a699

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.14-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 3734f9e14d2ffb992299d5cdcd4f19024d69c2ab6d95ea6bc6fb1c7113acb636
MD5 6eb3d2bf1055dfeca02764809f16c440
BLAKE2b-256 a5ccf3c3bc9158c325309156fb7a54bfdea97b65d242f5c184dcee34a5306ba0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.14-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 b001891d61088e704502aad9c6d168745fa1513efcabbd974e9dfb3f126dab92
MD5 b10b4e59ca8c2fb079a77fad3c7dd12d
BLAKE2b-256 932621d45ea7285b5a511a8bb613b3a178729d2df96fa2b6db621b2ef350189e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.14-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 83a32b8bb5bf21088cb9beeb4cb137aa001cbe79c2310b065e010bc1bbff5bcc
MD5 12875329b05f0fdbc929989bee2191c6
BLAKE2b-256 322dd811471e14117d3c48a00f1cd3859d7be61c348ea27e7b304c7d5fdedcdb

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