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

Uploaded CPython 3.14Windows x86-64

hermes_core_python-0.4.8-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.8-cp314-cp314-macosx_11_0_arm64.whl (843.3 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

hermes_core_python-0.4.8-cp313-cp313-win_amd64.whl (785.6 kB view details)

Uploaded CPython 3.13Windows x86-64

hermes_core_python-0.4.8-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.8-cp313-cp313-macosx_11_0_arm64.whl (842.5 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hermes_core_python-0.4.8-cp312-cp312-win_amd64.whl (785.6 kB view details)

Uploaded CPython 3.12Windows x86-64

hermes_core_python-0.4.8-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.8-cp312-cp312-macosx_11_0_arm64.whl (842.2 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.8-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 fe2175b8a1fe1344478ff17870d506a0cb0ccf41f4857c2ed84987f2b44fc873
MD5 42b662fd42d4ad5eb62715e9880914ee
BLAKE2b-256 6d69a9c6be9ae15702cbd71aadbca1a0b327e61b4abbdd33ec4fff48eae1e6d2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.8-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 e4665e3b31f0a392ff0d9744ca5f37d8791e1439ccaf61b69457f4a7bae6432f
MD5 c3546a4e34ea503761dc10de2f888e1f
BLAKE2b-256 df1f6b4f0bbf8ebc6a91b3e032f7c02d63b331bb6da57d93857bbda86e7c66fa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.8-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a397c898d8a57af403ed217e18057497a8af6c920b719fefc3efee5dcdb8fcae
MD5 c8d5281ef155bfdee7eea9c0f8ac43de
BLAKE2b-256 014f269849ccd16107fdd9371c7a59ef6f645ef0a0b558a4c01fbbd4dd1750db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.8-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 20a6ed3cf95b40d0c692bcc590f919e968de6f2bc67acd70d30806133b4383e3
MD5 d257c4f587b91ce0d64baa12497893b6
BLAKE2b-256 d0a6adc1cf6d74fadd75dbb7aae1b63965d6d23334ce7fa40e02177aed3975e8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.8-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 dc24e4f9a2111bd68703144de504615e28a15a1d27727382d21ef5f81f018492
MD5 223e6f03ada71f1fae0b9696c757df11
BLAKE2b-256 e51aa328c35c1df54d75455399101fe3177ff4ae50c2cc569412ef07530ded3e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.8-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f2447793c1e96a6029591a041191e5219f9be8456eb5ad71c205be5524045669
MD5 264fa4556c279e9cf3b1c828e2358975
BLAKE2b-256 69b4e02aaa2f798bc58baa968dc6062096329986a0b2b91ed8d9be7e9bbecd3e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.8-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 c5fab0d2037dc24eb46eb44387ec52a80449cc9d9e854887afe7d4e0afc01d1c
MD5 587b4c41d140829436199780625094f0
BLAKE2b-256 1a0e5741073679b51109903f72f49d976b2d98588271eaf95caaf780b849bee6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.8-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 d7f25fb1903be9025d4050682e0ee8fd6b7e3fde17f4c0509fad63575059ee7b
MD5 3aec6a2b38fbb2707c980884965655ef
BLAKE2b-256 bce77e9e8c0612518b0136189e74bc9c21abc37f8bd9bf91e59e2facd43fcc2c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.8-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8f18e12a1f5f36e92466294bad091d428ab683cae1694e9a59f4a155ad0ddc05
MD5 54d04c9f77861b28ee87dce07c9973be
BLAKE2b-256 eff1fd7adbb4c9030517e14c876e2d63bb75ba566496ce2e8fd067e515f12264

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