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

Uploaded CPython 3.14Windows x86-64

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

Uploaded CPython 3.14macOS 11.0+ ARM64

hermes_core_python-0.4.2-cp313-cp313-win_amd64.whl (787.7 kB view details)

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

hermes_core_python-0.4.2-cp312-cp312-win_amd64.whl (787.6 kB view details)

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.2-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 9fede2f82a0e077f69ec7664613935c33d4f455eefe0fc16220b135e33efcbac
MD5 a6a713d64acf257f476f5fcdc377fdac
BLAKE2b-256 ba75e0e90f302ad61c5d6acea1f8264df77b8f9164e342d1cca4cafe5b07c6dd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.2-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 ee2c86c7f95078584b3a729d503864fdac1fd5a13b46a12b7f7c9b00e3a6601c
MD5 bce3cdfcf437126407fe84a344e2a1ee
BLAKE2b-256 8821d5138dd53a21211e21e4478905a0b0e5b0874a3fd1d1fff0b23c9de1506e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.2-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6f92e29fcf4f837ec1ddb2f070c01890bfeabc49bcf07d961eb36a4c81bb51a1
MD5 591d1c51e510a64273839fa003678375
BLAKE2b-256 fad879ee654b2871d1502a43fe91c1f8d9650d24faf3d0d4a4089089d41e33a9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 3f610de2ef5b0ff19bc49487725a82606d54e41af421e610501a5803b184aec6
MD5 e656bc12d99fb136bb445563030b8165
BLAKE2b-256 681c89e4d3cc34da44079f301fb9ae5c647796ca4f37260ce3f2e6da2d458e2e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.2-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 9b5f2b9af237759575bf83272f3da3a5e2feff111b0c366d73fe9264da57b312
MD5 71ec3719f9465199d8601b5a360a3386
BLAKE2b-256 c8e833b8bc50146f01686f29245de6616bbbea7738bc8d0484b2404f696f4149

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 aa844f3248a51829b3b396b0c894216adad907a88a7c92627ecad506ce7e7935
MD5 ed9626821da20272a25a1b3fc4fc17ff
BLAKE2b-256 f6a84d989b1dbd8b9c1649adc869fd0a5769e04e1b4f00be7f742b9f66f3c45b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d1d4125dc686a7cb188b9aef7cdeaf9e64492dbb1ae07827e6333752ab0a7646
MD5 8205bcc0507721165cd725eebdc8dc02
BLAKE2b-256 046ecaea991abcf04d9216a545df0dbedb36aa19edb47adb1c67a8906cd4e452

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.2-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 4e9f13f27b110dd9b5a386143f6208c398aeb1e072043ce2305e0bd8cebe31ec
MD5 b7d33b9540bf3875587a0693e211585d
BLAKE2b-256 6d5d22a2dc239aa73059e0a5ceaa973c34929be209cd6bc3ec8be38e5c475e63

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 73146886f79c703ab2102c37290ce7346e46d579e17d4f83b8742bbf124a7465
MD5 7d184c1055760f42c43d762aed9e54ec
BLAKE2b-256 7e430fab39b3d4f37dc8bac70464357ad96fcd34a904abdda5623d01ee1c5eef

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