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

Uploaded CPython 3.14Windows x86-64

hermes_core_python-1.0.2-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.2-cp314-cp314-macosx_11_0_arm64.whl (907.4 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

hermes_core_python-1.0.2-cp313-cp313-win_amd64.whl (866.4 kB view details)

Uploaded CPython 3.13Windows x86-64

hermes_core_python-1.0.2-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.2-cp313-cp313-macosx_11_0_arm64.whl (909.8 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hermes_core_python-1.0.2-cp312-cp312-win_amd64.whl (866.2 kB view details)

Uploaded CPython 3.12Windows x86-64

hermes_core_python-1.0.2-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.2-cp312-cp312-macosx_11_0_arm64.whl (909.7 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for hermes_core_python-1.0.2-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 d25a9c4c04dcedd4627faa91afada746a395124b89d562d3a57ab99b94a25cf0
MD5 72713e90f7277a5a3beb77039a741755
BLAKE2b-256 45da5f3ea135a8733f7fdac168f9522c4a34cfa18ca7d530507d527a4f121753

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-1.0.2-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 a0c161bdb6e5ff9bf7fa19265195e455dff811c63dd3b83d7ca34655da982696
MD5 4d42f1e64d6560fa90a84c2774c0d73e
BLAKE2b-256 2af6fab616db2a9fcf240011b0962b9027197299117d0d48aee82f1e98de3499

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-1.0.2-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8fa11669e6b8970f8ef4c092c650680e9896d3eefc1c5251704e8d0bd4d71379
MD5 f96ae8155bff158c71b65d657714e115
BLAKE2b-256 e710421cc59c147a6a1b9a9948ab11a2bc50453b97010a3768fa90af2dfc7b51

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-1.0.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 2f42ace47501997f1566f49ced1d8b78224f364510fddf108ac76feed1869e1c
MD5 9830fff3388e2cfa115739f221efd6d8
BLAKE2b-256 50d9a4feb3d7a0dbf3ab61cc32708f6eee07e1449140e8dfa24990f42f125bb3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-1.0.2-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 375c6a8bf44715428ff7763f30702fd1309057946d8fd413653b19e63c6f2b7e
MD5 f0f7cf434f8c03fb9a17bea88b6d6a88
BLAKE2b-256 d01f86bacbb01b4586e6d3cd4cd06f332539dc9717cb4fb0593f96e246343ca0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-1.0.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a7d4c24179e1bcced14d0d837cd921089b851336e8f9d7b9b358cf6a7992b2f8
MD5 a6824dfed661b11054e5293f330c6162
BLAKE2b-256 c19729194d2f4d10835f6b5be7956b8de2bcd065a4d5c7362a27b6b80bfc78bb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-1.0.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 8c59feaf0964c89212c622eebac423e725a8de5fbde31499f9e2e5c721b0e6b9
MD5 2f5693080b148a091748aed706b34b70
BLAKE2b-256 37f58407c946d46eaaac8ebc12c4fb2f092e8a3e75c920572b7a8d3af76d970d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-1.0.2-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 979f60a88433bb440405f1315e6485045e6ac197f860cade0df9da0723aee764
MD5 9d92ddd32ae5c77d647ad394004033f8
BLAKE2b-256 b3972e331c4b2da18169e3eb3f71c8c88fe9e2ab36590b857b18e2bcfff2f610

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-1.0.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e1341a1abeaf66ca00e3c35cf26975243a6b807c473ba868807f3d352a35c6a5
MD5 40986692c11dd04d8edb2c4ea06c1633
BLAKE2b-256 deada45487fa84fb689fb30127926d960a81ab9aad8d44826203e0e2598bd9ce

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