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

Uploaded CPython 3.14Windows x86-64

hermes_core_python-0.4.19-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.4.19-cp314-cp314-macosx_11_0_arm64.whl (908.7 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

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

Uploaded CPython 3.13Windows x86-64

hermes_core_python-0.4.19-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.4.19-cp313-cp313-macosx_11_0_arm64.whl (909.0 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

hermes_core_python-0.4.19-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.4.19-cp312-cp312-macosx_11_0_arm64.whl (909.1 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.19-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 401f1f20e2364a920b662da913869b2b03001dbfe9a860192bef09d640f1ed1d
MD5 7eb9dbe9ebc1e730caaf46d83eb2186e
BLAKE2b-256 a89fa883e755758f93c42684b0cc24940c42f2f171d9cd204123e01699fd0648

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.19-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 2e74bb6e9e337388f199049adaadd3b534d2fe8d8e84f68880ea333a7652619a
MD5 9b659f5bf61bb33c364beae293e25b1e
BLAKE2b-256 0791e69f765ee0f2fef422a814c0b149e3eb146c4178887001b4a1b9d6e41f7b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.19-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 019dd4281dda91d431d0b1b305f14f0ae43ac5d617dc292c6cc605dd4e0f8542
MD5 b756961c214a4e5c552618edcb7b3f37
BLAKE2b-256 1ed26239fe01ef0673e6c8ceaca2988af7b66f85ee87a007f0a3e7e0fcb116e0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.19-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 865ea46a00a31b4a73f324128c7f09637c223d40f5f7be02945e7f4b9d2a76f8
MD5 d94497420b12b62840c4ecf7ce3ae928
BLAKE2b-256 8cb234c076b6720a6f555dbb2214d49af84585364f4f1a7f8252d3ee53e169c5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.19-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 2d29154ad41db874baa230a57910cc2241c16aa98e246a0dc345079e8f7ff288
MD5 5a1daeb42b6cca97fba47ece0871ee52
BLAKE2b-256 571038f06909aa0a26401e7431fcf5ee8ecfbb6b2cd4dd16c239d4df53775d3a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.19-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2f3a80a16f03efa6c551924316e6e4e6eb5596df1362264c9b8ed1b55c7388da
MD5 c900e098c5826c9e0eafd445c1c4d6e8
BLAKE2b-256 b03119abaac32a81a64557656cae42497e3d9da43cf218506326250cbe02c907

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.19-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 726cb0f92b617e218c29a59e15844a3373c60f55991a93edfa879c4edfcea72c
MD5 60ae71adba034d24b7a5ec3721410e98
BLAKE2b-256 b3d1a99af7e20a811ab9ee46aaa5870a54659841bf9a724573d3974383a80bde

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.19-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 bcccde8c64b4770f19a0b416dc01eefbefbab68418b2152d785b1953a8a2fb6f
MD5 855a1e30711c41683e059ef56535ce0a
BLAKE2b-256 f206da17a35bc5160e988fe543d481f064f85b96a768c43826d69583c62627d5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.19-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 77521d408329357a40c4c853f248fdd31dacae363d06429c4609e7acd6db64f3
MD5 5ea1beaaf127f511956943cb49df2085
BLAKE2b-256 d037f55819334d389ff00d4fdb34ae8e27d7a13041ae3f27998b722c304452af

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