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

Uploaded CPython 3.14Windows x86-64

hermes_core_python-0.3.7-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.3.7-cp314-cp314-macosx_11_0_arm64.whl (843.3 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

hermes_core_python-0.3.7-cp313-cp313-win_amd64.whl (787.3 kB view details)

Uploaded CPython 3.13Windows x86-64

hermes_core_python-0.3.7-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.3.7-cp313-cp313-macosx_11_0_arm64.whl (842.3 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hermes_core_python-0.3.7-cp312-cp312-win_amd64.whl (787.3 kB view details)

Uploaded CPython 3.12Windows x86-64

hermes_core_python-0.3.7-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.3.7-cp312-cp312-macosx_11_0_arm64.whl (842.1 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.3.7-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 7067b8a72d45aab2482ac0103bbc2376f722f6470c8aa7a5235efdd97912fe2b
MD5 b56d2c441cdbe40bbbc6f62327144c90
BLAKE2b-256 3b1d284aec44d31ef6f7193350de3fed387abd47c6f75ddefb191d38e75bac87

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.3.7-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 816a8fab2cf51ff405664a494c13ac1cf416f64f03e8a86aaa27c2ba6f02919b
MD5 585a7137123deb7dc5fd5b3f1ce92cb7
BLAKE2b-256 402699323748bdb2782c88840d8b10a917afc37a31b4388cedac705815ab6732

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.3.7-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9de09e6883e01be258ab567ddc1898b4d4b1cd5fc9783444e07353eb58ee90ae
MD5 5047f62a60f92bfbda8b70c826a67360
BLAKE2b-256 0084b799e2890c2f849064e539c4bbc301f7efafe5884d1bd248273eabb22491

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.3.7-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 76536c51cdb41b4a046f45ec8db924fadc4944bc879192dda65505d846484583
MD5 7370120f9ea2f6b612b5b5e4857d29b4
BLAKE2b-256 ea9c511b271670ec51f88a00c30b30d61cb7f4d3b83d8526ade7e7ef9615c1f3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.3.7-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 0ccc7a3ca25e0c529bbfe769798232eab8caa20dca568e0ee65e36610db518dc
MD5 033b1c2da4ad034615d7b6b20b77724d
BLAKE2b-256 1540360f147db754d1e3d225fa8fb9623857f31c09c504e18d49c0cad5816dfd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.3.7-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9e35504830377061f635c315ae57343265b58cf505aabac0aecf727056ddff98
MD5 c6cac013872791f19b97945c0691793c
BLAKE2b-256 71df7a51503d3e5b7dc0bea5355909f7322e86f8f1a3196883f543583cb34c3c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.3.7-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 fb773bb22eec6bd368a704e7a7cda8304883c9cdc3bca149db525812c23a80fe
MD5 599b0c96241972105b589904ef6682f6
BLAKE2b-256 9fcb53a95982804c0fa2135702be984ebf1c61637e3352b784b0d640bb3c48c9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.3.7-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 e4866bb0f0f155fbefc0f0748133d1c1a24640e5d109a24bff8aa2bf09a415b7
MD5 8b4d30b61d506793ebfd0d8f16bd933e
BLAKE2b-256 73cfd0b670d6c973e1048ef60b753acab15c84cc5e34342f38a42a62475bd242

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.3.7-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 95e4421510cf701942c549b1490fa84b940dc9fcc7a339c31443df5303bab351
MD5 af8de136e9a6efb57f7ead59c9f0c16c
BLAKE2b-256 ea7e8d71c68f36f3eed452da4814b3caa30180221e56d0917b1ebbb4acf2274d

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