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

Uploaded CPython 3.14Windows x86-64

hermes_core_python-0.4.13-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.13-cp314-cp314-macosx_11_0_arm64.whl (851.6 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

hermes_core_python-0.4.13-cp313-cp313-win_amd64.whl (793.1 kB view details)

Uploaded CPython 3.13Windows x86-64

hermes_core_python-0.4.13-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.13-cp313-cp313-macosx_11_0_arm64.whl (852.2 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hermes_core_python-0.4.13-cp312-cp312-win_amd64.whl (793.0 kB view details)

Uploaded CPython 3.12Windows x86-64

hermes_core_python-0.4.13-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.13-cp312-cp312-macosx_11_0_arm64.whl (851.8 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.13-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 e5b57dcdab68d3a6801620d5dcc00a372b0f5c64bcca8a52af4c25f2014eb701
MD5 ea070e77ebcfc99d7a65331922da0299
BLAKE2b-256 384060d7db22d8d287383e309128f5699f7215136133320c0c1ba6a08a5edd01

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.13-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 340f095ffb4607c48da17746d939dd1447c625923ba3f6fa8be8f5d7e747cca5
MD5 71793d658e2082d5ee7fb82fb624a4c3
BLAKE2b-256 578e89b47e1ba90fa7dd2c8034b5085d14816a0866f6457e255b1ec53b7df40d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.13-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ed600a81de2bc997ca943d8d43df90e8b30c9b2fe61098762493461038eedb4d
MD5 f1de346368bede4e5c35a782d41d2a59
BLAKE2b-256 2df057a43dcd3b02558294ababe699750cb928ebc20948a50283b7c4aa62d4a5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.13-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 84faf7f05925b6054a7959acf43ac674340e037a9c7b8bebe1f6a415a644fa3c
MD5 93ed4f55a32d5adfa207d57396e296df
BLAKE2b-256 ce729afce677f2e472cd11c05b581c7d1acbd2d9d85fc02a890162a505fd3fb2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.13-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 4366f459cf1d3c5220528e559b7afca6ead8fb71b51c464ec00de306d0c33b53
MD5 f94bc7f9388cbfbe4700df8fc911e20a
BLAKE2b-256 46101f2e79f1de77301fad51728a1addcfd181a32109fd63e6dbd91179f0ed9f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.13-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e608c67476ba2365cd5199e8f7c746189cd8c3a7b66933b00ed87eb3d184a563
MD5 a72c6a0d178409d69fea31942d31564b
BLAKE2b-256 bf5f0aded82180b54e3bb6338d36c7f8006f99178deab8ed26928a0ccc07c73d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.13-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 db3b0ad074ca05ab1d08801c7e7b9c72715b607214dbdd26bdbe35e1aff8d2df
MD5 cffdf33da666efdaedc713b8a3f786e3
BLAKE2b-256 d3caa128a52d7531972ce21d06fac5962fed5b74c49ff7908f9cde85ba62a3d6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.13-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 4269455779dca671a2302d08a13b191a0ee026ad87bd0e07af807671dc55ac76
MD5 a71337469b171e334b6f86537fd72e91
BLAKE2b-256 bcceef90d91262c566ff0aba9cd6ce6d8974070c03daf360b1b79e1da86fd927

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.13-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 49ab8b719caf3d63d3e9379c8035996150395ba09993f4c393bac85648ac366d
MD5 7aef7f99a0a8d56896a201948d71dafb
BLAKE2b-256 07e9c58d25c5b83c8b707d5c2cc327385e2e6ece4a15c4e321b425dcfa5c5782

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