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

Uploaded CPython 3.14Windows x86-64

hermes_core_python-0.4.0-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.0-cp314-cp314-macosx_11_0_arm64.whl (843.4 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

hermes_core_python-0.4.0-cp313-cp313-win_amd64.whl (786.8 kB view details)

Uploaded CPython 3.13Windows x86-64

hermes_core_python-0.4.0-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.0-cp313-cp313-macosx_11_0_arm64.whl (842.4 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hermes_core_python-0.4.0-cp312-cp312-win_amd64.whl (786.8 kB view details)

Uploaded CPython 3.12Windows x86-64

hermes_core_python-0.4.0-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.0-cp312-cp312-macosx_11_0_arm64.whl (842.2 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 6557af87689c219b2b688f79614331e2e77a9a57267f5339f1b009705a1f8542
MD5 48c61360b6749af399bba7573987b1a5
BLAKE2b-256 598749427da0322e692456edfb19a4201dfacb369c93ae8a45076f75ab14f356

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.0-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 9f931c708163645be19d1a278a4b634b846ceaed406606d312890f6b6b426115
MD5 ded629363221e62f25bf88d740c438bc
BLAKE2b-256 1d2b27c15862835ed9c99ac4e69c4941c266736d0ba388c984e267b91fe863c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2b473ae32493b30e66ed1855057eba7699dae7b069d7f752e4688d602af73df7
MD5 18d69858961517cb06c3fc611da19684
BLAKE2b-256 2500f4d8397c5c4aa65e8f8d63c36d012d0803cd05f73e4209b552c4b2155d0d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 7c316c7316594464ed3cb977d9c35c97fb660697c0303d943d8ee77edb681667
MD5 79852a639b3d2d8d1afffb7e36fdb9dc
BLAKE2b-256 a609afb7c27488dc153745afa90b416f166b412dc06d75b4d4bed3e0fb444567

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.0-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 fa9709dd9c2706a7a3c7424f2532fb2e353108897313a8220349c7511e83a515
MD5 3a819d442a4bf19ae4db59e04863c0e9
BLAKE2b-256 218ab25ca428d11ad6383e6fccf2f13d3894ae203fb96d004d62a017a90b111d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e3c950009bfb2a0124fb7845acf17a3ae9ae4802d51f2db5230b00fd6bc9b7b5
MD5 2e31e06c1e8af4a229412920ff4a290d
BLAKE2b-256 cd10028be34c469b2f6d154a2c56234e57772c95a783d09811355f8f1ea2e679

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 484ad7bcfd2e1da788e0d50109dc0c8ab099ca50063276a97670b9f74359e833
MD5 697bd6f858172e952d7c610efa1d2df5
BLAKE2b-256 597ceec1e7693af5c905f5239a3b6ad0e71712ccd99554d5b280fd09dfe370c3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.0-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 3b10e08c73a2e114be7a6171c7979a474e3965840e5cab614b0a839f969c5c0f
MD5 94118fb2cc1f6a903f143aaf29496abb
BLAKE2b-256 3423493fa7361085771373b6081798ad9a5cb8021556ff8e999a5a26aaf53af8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5974542cea2688d20dd3749cb44d5797a5dd851737c5e45259e146eb2dea44a2
MD5 c26dfb2ae9de8958d20a5eb8d8af9479
BLAKE2b-256 d0c6a9d1b3ad08cf084a150aa807cb87fa28f3b8a74eb25453e64d36ce93fdf0

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