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

Uploaded CPython 3.14Windows x86-64

hermes_core_python-1.0.1-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.1-cp314-cp314-macosx_11_0_arm64.whl (908.1 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

hermes_core_python-1.0.1-cp313-cp313-win_amd64.whl (863.2 kB view details)

Uploaded CPython 3.13Windows x86-64

hermes_core_python-1.0.1-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.1-cp313-cp313-macosx_11_0_arm64.whl (908.4 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hermes_core_python-1.0.1-cp312-cp312-win_amd64.whl (863.0 kB view details)

Uploaded CPython 3.12Windows x86-64

hermes_core_python-1.0.1-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.1-cp312-cp312-macosx_11_0_arm64.whl (908.5 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for hermes_core_python-1.0.1-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 eae8456515b6090ee5cc1c187d45442dcc2db4e15a7d14db969174bc2dcb82a8
MD5 54532321be48b87c7d388261fe780e38
BLAKE2b-256 84a911715380fd1ff771bdcc0f73401b2a68726023043898e1496e9df7056345

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-1.0.1-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 404fee1d024a28f5c1fd39ee31c8046f4987116bcd3de2ff2e19a0a548047a44
MD5 6c7158201738dc1ecf2666692a01e119
BLAKE2b-256 dd6c3c66693e3fbefd572f8594e9ba326882cc195e1306f1d7d4566ba1b40a96

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-1.0.1-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8cc1e1cd6f3ab4d90001516e9a119c927481beb1e5a94d1a42f11e2071093512
MD5 3bebce712e2178f2944b826227cd425e
BLAKE2b-256 e486152c62e6f8db7e637e29e5daec5f1cdd2347f38aeb3dfa53b75698a90fb4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-1.0.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 08c04b154bedfae5da0ba28afdaf8debb5a488ccb169ff6b777e529e21750ab5
MD5 18ea1a37ddbf38770ff9bf5be7b3eed1
BLAKE2b-256 ca94bfd40e154fcd131f4c7e959c49c94c094fad81d2aed7e2e208af1331fe95

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-1.0.1-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 bab7486a31c7da32824a9963d0f3519d64e5de95c940a9d3a86f8f8faaf1fa7b
MD5 dea160fa8d1c0509f9ac24f0d3a2f393
BLAKE2b-256 3e5f8bd5fffd2da8d8ec6b6f9c444cf120c1a628e4cda727e7e9d84d78b7e562

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-1.0.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1d8369a4a6a419258b6dc8519db3af277931a0c68c00d09d42a01955c2461aba
MD5 83a84051a1881f5dcae3a19ff745ba35
BLAKE2b-256 ce725af95932cc7da142fd0aa7ef7598d951bd17d0e495330a192e553fc7c37b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-1.0.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b9d1f325da465d9d8565e24f1558591e491c79c8b4c699a0402f861168e563de
MD5 517420c6fcb8143535963ad446fd33a0
BLAKE2b-256 25f9dfb90258910b5722c9583189af6c227420934f98a43f0368869cba1c477f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-1.0.1-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 10f49c74f206231059b8b0bea1c8f14830d09170f24a381e8b422dd240199110
MD5 8a613d3990d9cf5637ac8da9be8e700a
BLAKE2b-256 e933805e1e6d88497be0cef39ad816e3bed2a19248ae200cb9371b9a6193e0d9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-1.0.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3caa731a019e15b8dd0af38d59d1255125cae96023758bfdd36c66773586dcfb
MD5 469d8bbb9bbacf563f8a72710dd416c2
BLAKE2b-256 78e000c32f4aa85c00e0da3cb3be03efdcb33186544bce6cc6eebf6541cfd93a

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