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

Uploaded CPython 3.14Windows x86-64

hermes_core_python-1.0.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-1.0.0-cp314-cp314-macosx_11_0_arm64.whl (908.5 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

hermes_core_python-1.0.0-cp313-cp313-win_amd64.whl (862.6 kB view details)

Uploaded CPython 3.13Windows x86-64

hermes_core_python-1.0.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-1.0.0-cp313-cp313-macosx_11_0_arm64.whl (908.9 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hermes_core_python-1.0.0-cp312-cp312-win_amd64.whl (862.4 kB view details)

Uploaded CPython 3.12Windows x86-64

hermes_core_python-1.0.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-1.0.0-cp312-cp312-macosx_11_0_arm64.whl (909.0 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for hermes_core_python-1.0.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 169be8b1471cde10f3684413aecfdaf6f3aa6374c7a2bbafa1bfe7b35ca33fa4
MD5 6db5fb19c6085a50e2332c8606b9dad4
BLAKE2b-256 891e32ecc1bf4117c28d1fa1d1ab899489e3b71474748b9a77152260063f7dda

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-1.0.0-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 223eb529e69cc801a4cb16f6e2aa80bf51f3edae65526315a440dc9d92c60dff
MD5 590d3b97b5eea9dcb4cbaf2e51965354
BLAKE2b-256 1329a7b5c4cfeeb39d43d4fb8eb0ac8e3b7c322d60f5e2519d325e82e147d85e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-1.0.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b81c8722d6cbeb379b4125e9d82a19bee6669e461db4819ad5da6b69b4b37e31
MD5 c1621c1bcef35280b4f1c01221b40364
BLAKE2b-256 3d16fd25288a01c7da92f6e4ac745b9e77567890b0158e31bdc86cb4d3b62bee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-1.0.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 55b4a4fc4c5d19acdedc93c80071c0a9b6b1acf59b24f568d688c51867a7ad34
MD5 b58f832b1463edb659e89803e0aaef23
BLAKE2b-256 98e66a7ced377e95c5b437c5a1a0fc145653c41322babac591a36ff926319a53

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-1.0.0-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 5a51744daf6ab298dffa16aeadac30e9b8a1f47a77d55d5781f1d9f5a5fa177a
MD5 5ac78ed242c915ed8864488cb2c1bd36
BLAKE2b-256 948f4156c23205f0ac28615ff80047acdd3888c2f1f0ae1c0b2f1779d7d6d56f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-1.0.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4598edd7e446e48b43b67d4f31e0951151b9e115ca72347a3600992c8aecf820
MD5 18307658b19e694bee2f3ad1d22779a8
BLAKE2b-256 f12afb1f92f79d29514f9ee0f6a3d7981ded6f53ebb8d6d33e01640c8b1f1019

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-1.0.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 322f01ab5d78cc2cc9e974f39dbd62477b373831e6541770e4ca5b385b1d7bec
MD5 ed4b7169d1a7acf1b96a9d9e7813a8d2
BLAKE2b-256 9c277758636eb063956d2013c3222b37b8c249572ebf04851c6e190a03834b96

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-1.0.0-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 78daa8b85472737fdf5c47858aa2f1c031878a929c4d6adde3e6332b7f7f9915
MD5 67d09fac8659c28263b1c17833872cbb
BLAKE2b-256 7e6d79b7084f9b6cfbbd460dad10eaaffc677304715832ba60ba3dd6b7dcc2dd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-1.0.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 704b81c819cfaa9bfa39466862ca1bd68101c5edd2c222600e5597755b196441
MD5 31e3892aac46554e30100bba449436ac
BLAKE2b-256 87d1bdf9ba22d98bed9a45bb982d10f9c78b94d556943902a2360f5899de6df2

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