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

Uploaded CPython 3.14Windows x86-64

hermes_core_python-0.5.0-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.5.0-cp314-cp314-macosx_11_0_arm64.whl (869.4 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

hermes_core_python-0.5.0-cp313-cp313-win_amd64.whl (829.3 kB view details)

Uploaded CPython 3.13Windows x86-64

hermes_core_python-0.5.0-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.5.0-cp313-cp313-macosx_11_0_arm64.whl (867.9 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hermes_core_python-0.5.0-cp312-cp312-win_amd64.whl (829.3 kB view details)

Uploaded CPython 3.12Windows x86-64

hermes_core_python-0.5.0-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.5.0-cp312-cp312-macosx_11_0_arm64.whl (867.7 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.5.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 e319aa8910d83b42fcd06d1c4d45a8fbbef3a0a2ade0326abd26b754f5560448
MD5 988829e4c1116d754d3bee846fcf8887
BLAKE2b-256 3b9f901f6db59e0ee24803128f02dafad3e89978e1e668079140db0ca3a873d5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.5.0-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 c5a515a72743729b39870f60fb055b89601628069b469a418bb90117913f2c62
MD5 65a2db664074f97ff0f4d87f73ef40c7
BLAKE2b-256 8a533b1405a57d1be3d397270ebf8bccc69e41696e58b957056c13f46f1b4b45

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.5.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 31e782c81be7f788195dc60c9038d6246421d27f3026134ab9a489374a999d24
MD5 84f129a5d67f40bcf6bbc6624cb87e01
BLAKE2b-256 3e701610cb2139d09cc6d49c2938eaa42303957a03ddd2771a47414e67aa0156

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.5.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 ede8dc97f656dbfa2c482f18b88cfe8fe84208837205089b4f06523b975a3f6b
MD5 3d503b00fd7f2ca13013c9e51da40183
BLAKE2b-256 b56b1098d139cdb65c9a48168290f18fa24ca904612961cc61afd863ca055137

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.5.0-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 7c3333452f69f6f64a997587c8915cdb2c5b6c999c3d61b2c687ef82df576bf2
MD5 adfd4989cb11431aa6a4c0a2fc349435
BLAKE2b-256 ec81e88d2ca803b99008a5a252250b175b125cd00cfe11df17e43371d7005bff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.5.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 39a54eeff74850f774c49352b7949fd2baf9f7c65ff386fd44ea941bf33068a5
MD5 b48e3017930f59c5ac16aac750ae1ad9
BLAKE2b-256 d599c9527a0087df70a8eedba2d7ae9ae05c80e8102f010c0fa6061b55239405

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.5.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 3bd440d8fca784c43ada43057ac10e1e873f4a14f876d6f72d418a2860dc73fb
MD5 22085f68394809ba89d3d97e339110a8
BLAKE2b-256 c828897fa2a7bda3877dcf9d8f15ff7b02372aa65f253142b41081c8c66ca9f5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.5.0-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 b638fe95a4669505a82ab02f62fa9d9dbd3a9a4caa23a3a2694ecde7a5fc8175
MD5 bfa6daa5c84455e140ebe78121b10243
BLAKE2b-256 5634964239baf2435d44f7ae60da0deea92018cbad1f1b5ee8211ce402851604

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.5.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 99ec62adac5cb16ad5d596a871bf7ca0f060af44cf4389a7eecd0de7fd4874d3
MD5 c2b39521b7225d5bf087d92abb1652a2
BLAKE2b-256 451f35ae9f7fc2efce9568e5375e66b3c3c11d942c54677eb313815323769637

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