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

Uploaded CPython 3.14Windows x86-64

hermes_core_python-0.4.17-cp314-cp314-manylinux_2_34_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ x86-64

hermes_core_python-0.4.17-cp314-cp314-macosx_11_0_arm64.whl (868.0 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

hermes_core_python-0.4.17-cp313-cp313-win_amd64.whl (830.2 kB view details)

Uploaded CPython 3.13Windows x86-64

hermes_core_python-0.4.17-cp313-cp313-manylinux_2_34_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

hermes_core_python-0.4.17-cp313-cp313-macosx_11_0_arm64.whl (866.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hermes_core_python-0.4.17-cp312-cp312-win_amd64.whl (830.2 kB view details)

Uploaded CPython 3.12Windows x86-64

hermes_core_python-0.4.17-cp312-cp312-manylinux_2_34_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

hermes_core_python-0.4.17-cp312-cp312-macosx_11_0_arm64.whl (866.5 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.17-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 9af932657b282b791f923002111b8859c32f1fa5139bec45169e5e7d93556062
MD5 5671f42c1225933051a3a1ab17697484
BLAKE2b-256 6fac31105138a4d3711f00bbdf75769ec9e48057adc228da6f12c4d8da8e46e9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.17-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 bad8cad50a03544d54c18a1b3c3515979e776e160ec7e9cdcb84585302b46846
MD5 5370184ee5d003dd92c4114e792b707d
BLAKE2b-256 4bbd62fdd0aa7492edbe44f6e55e06284ead790b22424c34b82db4b80b419003

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.17-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 197db71d8e59f23de0d312253e91bd5e58465355ee458657621e6b023df894f9
MD5 417d31c8c1892ab04ca00271c453b628
BLAKE2b-256 cb3a1ca72cdb7ccfbfd364c5a89cb1e9202591c51d428b5e0d7f952a3b9f3222

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.17-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 fecfb17f382175ae51a9137aac3c0589ede69eb3b203ddbf74faf844869ae295
MD5 f459f161d91e57758d35e80a9b35ddc2
BLAKE2b-256 4cf6816ecb08d73f189f94a4c577ee6ead4741747a6bc6f9ca732957944152eb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.17-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 2bc73671118458b110504ca7c6d70a40b890f23eb1486437bdb37f0bdc2886a8
MD5 1bbbbedb849ae7eadb6fe7f8eba0d6ee
BLAKE2b-256 62678ebea183cb1cbdd7e95a9865e9d01a8ea8c32a591285f9fdc95810700d64

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.17-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 834ce76f5603ec47273385607d7d22be9807b75d6f5d675c0333d2f209370235
MD5 976c553f42e2191af689a86a92d57177
BLAKE2b-256 09a0de8a53aa9a00ce50ab293f91167fd77931dd66a95a36b5afbe787fba139a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.17-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 0ac1c513a55aca5491fc8ff389b2c76fa19f845bfb8792aaef74537d538e2b2b
MD5 374b3058996c4c1c9ee45d4ddc7098d0
BLAKE2b-256 4d39674f72a7d93eb3aaa15d2e87eb1fdf400ef95afc4917a0bd804b89d2fdc5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.17-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 ba9cfc27a6e730224efe3bcd1e2d984d5c835634c91f64d4e85505b398f851ff
MD5 4be9976f5bea0f20e54306d1096318af
BLAKE2b-256 25f623499ec389aabdb6fce21fb15b01936d5c816a1ad7706d6b2a4e1711fd5a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.17-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 92390c5bf66a6e75dc7da0acf8b258b00e3feb34a2af2d7bd7599657de145a60
MD5 5c66a0c6d9d8584fe76b4fd3c1c7b5ab
BLAKE2b-256 93d50479d03f107a65065690a107dcfd50d9deead8029426408b37e2a8344b44

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