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

Uploaded CPython 3.14Windows x86-64

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

Uploaded CPython 3.14macOS 11.0+ ARM64

hermes_core_python-0.4.4-cp313-cp313-win_amd64.whl (784.9 kB view details)

Uploaded CPython 3.13Windows x86-64

hermes_core_python-0.4.4-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.4-cp313-cp313-macosx_11_0_arm64.whl (842.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hermes_core_python-0.4.4-cp312-cp312-win_amd64.whl (784.9 kB view details)

Uploaded CPython 3.12Windows x86-64

hermes_core_python-0.4.4-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.4-cp312-cp312-macosx_11_0_arm64.whl (842.3 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.4-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 be8c486beabcd196f9e1789f8cb0623c3e9df951442a4ef41012fb3ff6926ada
MD5 700e607317cfc2888d6901fcacb347f0
BLAKE2b-256 c4b7e6a2133f8225fe1f07445e9da8e4b3e7ddee4b2450ccd3c401986a014582

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.4-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 aeb44d4b1ae9e7d6f762cd0ebef2686c061f37fe27bf13a731853957da148a8e
MD5 b470cf237a40b27b264eed6ff8ea442f
BLAKE2b-256 71469a6aa41296df027daabaaa41e97f40551e5cae5e1310334efc7560c07ca2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.4-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 222d6a1c3be77fbf36f1178cac746d72ae9fab5d39d54992c23d9733eb0ab7f5
MD5 3dfcdfb1ef533e5a746827f3ebc3fc45
BLAKE2b-256 510d8c1477d0dd9be6bd0628a692c2aad2eca3fa7a1dcc7da29260cd5be518a0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 bad4da5123193299893a568d5f5b4ba6c70853ace813ba7c858115a3e8dd8259
MD5 f91824f7dcdc5de48ec1736e56c3413e
BLAKE2b-256 a9b687826a52dcb252ffac93f98d22902a34a4244d0a6257e9f150c2fdebbaae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.4-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 69c8bb7a8855dc0ec8e1f30513f2498d81d15349dcf73b6006c9ab3131d53f01
MD5 786ba537e77405d0ae2df57ec374dc58
BLAKE2b-256 a3019fbc22d0a25852b52c3de27f310bd87fc8687deb86547713955b9bc265eb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.4-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 00d4a9992615419ceb4b688c85981a64eab29ce4d48ac69e17484e31e3d098e3
MD5 eb2d60058ad05b00f11156b34b740bd3
BLAKE2b-256 e1430a9eae3e6993535742c8b1913e8db16246cf5793e857ead5e9b29aee136e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b7c1332688e433d416479d72d4072b08b66dc5ff5ae7dcc32f8f030457c7aa25
MD5 57ed83ce9f07aa652f64255b26dc4f52
BLAKE2b-256 ab6c3d38c2929389b614414d1783c18b022697fe71632eeb454ff774fc50ef27

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.4-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 2270bd2cf1f249cd668dc4f6f0101ed176935a3828e4cc9b3f9a8ca0b3f426b2
MD5 ccf34ce4ae598e20e8966345c334ac84
BLAKE2b-256 0df52d35c1bdca295268e90d1b0429c8f75c854dcc59e87485b96c7b58efb248

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.4-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e9e3886408902a3857f65db6d80345c3268f526e9a275ae1fc1006764b9944c4
MD5 8e5fcc59747d959f3f2898c5a5d15941
BLAKE2b-256 29fa8ef408f0d249f3744d52218b0bf5f5995c1e0ab3af0b5e541b3b4f2dbbcc

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