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

Uploaded CPython 3.14Windows x86-64

hermes_core_python-0.4.1-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.1-cp314-cp314-macosx_11_0_arm64.whl (843.9 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

hermes_core_python-0.4.1-cp313-cp313-win_amd64.whl (787.5 kB view details)

Uploaded CPython 3.13Windows x86-64

hermes_core_python-0.4.1-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.1-cp313-cp313-macosx_11_0_arm64.whl (842.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hermes_core_python-0.4.1-cp312-cp312-win_amd64.whl (787.4 kB view details)

Uploaded CPython 3.12Windows x86-64

hermes_core_python-0.4.1-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.1-cp312-cp312-macosx_11_0_arm64.whl (842.4 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.1-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 b51026487feed71ac845c1a622049a59f21f9774499edd9561dcc48c157a91e8
MD5 82f95322a4e8e6e0b477f0ea4974d937
BLAKE2b-256 db53bd118e32f790d55fe5b92bf1a72963c7e40f3370e2ecc4806b3401a38a61

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.1-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 21c4f0c6ac50bbc23f465367a23cb2c7f01ec002e59ec2b9f63bcf541b08a08a
MD5 3b1fd4b33d7329f3d771096b2720e8bc
BLAKE2b-256 87eefe668ade5545770404c14344c6f7fbe99d8e2fb2487b4b4fd8b32cc0a6f5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.1-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4bd8de86035121024deef368310598c9a11599a18ecc490a3aa33dd1609e3c47
MD5 42ba5dd83bc212fb582b92e310e1119b
BLAKE2b-256 7fb4a0c69fb3134e3f48a4527477eb70dce9adc79f5ed99ee67d10bb7ddce98e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 86646e280998b35851a30b25460f5421dd4b7f440a82c763b3aa1b176b957ae5
MD5 9b4d4bc8a84b1767c05f69b8f242f3f8
BLAKE2b-256 e95f90240a76f2781036c3150d3cc029885abb9da82e11de6a2f49d10654ee7f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.1-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 ecec4547caee8e35dd4a5f0fd122ff33b1835af749b0ad12476d600316e4f519
MD5 fb608aa64d7efce584594d0fbf127858
BLAKE2b-256 80be3ee79cf7e40c38f37a25753f1291e3fc52f8396955e7bd0f332e828e1a6c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5a458069ef602d31ad55bf54593b450bc5e1f9cf1c5da3b80e1d45d50fba4033
MD5 c672a82776308af79a2ea533b4892ad3
BLAKE2b-256 152fca6de1b29c230da27b1c73f2a779ebe182fa1890556067634e789c099c11

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 3c428836c67098201bd89bd075f325752637aaf245d5b4ca9a84f8d1f11eef13
MD5 7156a788f74cb673387cf8ea0eeb88b7
BLAKE2b-256 e16139d70c7860372c6067133053caba2c15f4a1f553534e5bfb829e254f724b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.1-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 54d80375ff4ac04f57463fc45b10eb1caff26718cf7bff97037fc44c40fd31af
MD5 4d7b81dfb6293c3d81f6ddfa2598995d
BLAKE2b-256 ca319643a5523f44e699635c37666dad530963a198add6106ca6807d1ecbc33d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 87153412b3996b3f1a69617a53cd4e85d270cf1c55e68483c1fa049969dce52d
MD5 b67ff90fe4e875d4d0f0337c07cb9fdc
BLAKE2b-256 900b50ae0c2c229bdff5565563eea2572edc29a946eebaaf600424b8d59f27f3

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