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

Uploaded CPython 3.14Windows x86-64

hermes_core_python-0.3.4-cp314-cp314-manylinux_2_34_x86_64.whl (906.7 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ x86-64

hermes_core_python-0.3.4-cp314-cp314-macosx_11_0_arm64.whl (740.5 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

hermes_core_python-0.3.4-cp313-cp313-win_amd64.whl (686.2 kB view details)

Uploaded CPython 3.13Windows x86-64

hermes_core_python-0.3.4-cp313-cp313-manylinux_2_34_x86_64.whl (906.3 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

hermes_core_python-0.3.4-cp313-cp313-macosx_11_0_arm64.whl (742.1 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hermes_core_python-0.3.4-cp312-cp312-win_amd64.whl (686.1 kB view details)

Uploaded CPython 3.12Windows x86-64

hermes_core_python-0.3.4-cp312-cp312-manylinux_2_34_x86_64.whl (906.2 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

hermes_core_python-0.3.4-cp312-cp312-macosx_11_0_arm64.whl (741.5 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.3.4-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 64d3eec19b2f32af33c231dabba178730ac8d18c0c8200df60579a9df7f6d681
MD5 c3543e9a43b52a492e015f05b8aa18ef
BLAKE2b-256 46de2fdd1053b6a77de2f34bfa21dbcf783db92f76fa984257dd30582e72f417

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.3.4-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 8c287fb8c1f029517b8c7748ade371726ec44a946b9171468bc7922097af56f4
MD5 4df7056120b60becd6db7a3787675fcf
BLAKE2b-256 29d8f7110a6cf1ab543730b33ca21a8e5ddf0edfb876d64243c620c6d471f92c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.3.4-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ee8a2f1f8163c59f7cb1fa8539ecce9d5e9db631a6c2817f5635156e0533c1ee
MD5 e202f68286f877cb48c5105d5d879dcb
BLAKE2b-256 324d92f1b099c679da9f4f5f640e8c2ce45c66ce8c3fca1b27002f4da2235e5d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.3.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 7b9d40aa3da9ee8550c9c66699110d518a33ab16a3f43a78e0ddc635174345cb
MD5 00e27aca792c5a630b32bf3758537ce3
BLAKE2b-256 88a7b79b5b60a75f998629787b238b4632a22640c1c7d4872823204011bbd8e4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.3.4-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 9809a985298b1259f3297f7d7051913c71018b3f3a94a1ab543ed5456174e7ea
MD5 7a876fa417fe20b951b6385d07da6224
BLAKE2b-256 d560c8e77bc7bdc8e93c30a4b2545bdfe8b3bf81b9ed7d5f2a312c88f2e2836f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.3.4-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b9b508530237cb4039f4f121d4b3b56317f422d5eafe3e6bb7cff5b62af42c9a
MD5 13d9e511c24f436de4658fa36f930d21
BLAKE2b-256 a3f8f85c82f5f8ebf506d3388c2cbaf9f9a076dc47849fd03a3f332a7ea060e2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.3.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 83c09f6e7f6a8dd1360218add6f1df6951291daad692e4006bc46b960e8f3e3d
MD5 05f39dd7dcaabf0ad12eda9e872efc26
BLAKE2b-256 acb333cb0f5fb71d5550d285f38640d2f69af03112efc135bd67d28fed8c27e0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.3.4-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 a1167d892d941457b1b4ceda6bac13e5ea39bee0001ebcda6d946a27bd958564
MD5 b0c7c085001b5fab4cf8589b12827fa3
BLAKE2b-256 006784536fbcac31416604b0a9126c8234e9bcb998f8fd5a284fc2cb56fbe094

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.3.4-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 be8fc14d5b0f8e16b39fc925f7de9d6f48b9f96b36b477326664444a2fbab65a
MD5 376920feb8e8444d705281ddbecdb507
BLAKE2b-256 4a64c7158ea556d6daa9563a5846385d2f507f23ecce6239128306b5485c97af

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