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

Uploaded CPython 3.14Windows x86-64

hermes_core_python-0.4.15-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.15-cp314-cp314-macosx_11_0_arm64.whl (852.1 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

hermes_core_python-0.4.15-cp313-cp313-win_amd64.whl (792.0 kB view details)

Uploaded CPython 3.13Windows x86-64

hermes_core_python-0.4.15-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.15-cp313-cp313-macosx_11_0_arm64.whl (853.0 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hermes_core_python-0.4.15-cp312-cp312-win_amd64.whl (792.0 kB view details)

Uploaded CPython 3.12Windows x86-64

hermes_core_python-0.4.15-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.15-cp312-cp312-macosx_11_0_arm64.whl (852.8 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.15-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 dc2187113062509d71d14970ebef6fecb699f0d742887d02f56f1a0af5f5d2a7
MD5 52e3f2d21c03dfce2aad09674923bbb5
BLAKE2b-256 275c4d7dc10125f48d66b6c99042ddb9b8ab70c3e8fabc484d4e0f4e0c78d422

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.15-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 6f1d4a2a7109cb11bd76731affeebcad3fd461f15ca6f0e8b8ee50a21c96d204
MD5 f0c0707ba495d59f5fb52190f52b5aa3
BLAKE2b-256 651ddc07764bb15df1793c0e8c08fff2a31ee8db9cd78890c7e05f0293e78a57

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.15-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f25247505120e6be754f47f774cf6a592913b9b802cd7598c53a673115f3194d
MD5 2ec2920fb34d17a24021fd35cbe6113f
BLAKE2b-256 817bc3d62d978cb4a89e176719c96e9ee2fddf5bdc86ad6889e11b294acb0b7c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.15-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 229e1b49e9579ba5329fad6766214e9bf7ee305103e875f894c52a72e703f6e5
MD5 dc7bbfbd32251015151b3cf83e96e02d
BLAKE2b-256 f3c0beed9b52b0b5352e0e702e43e6cbf1a6517b725392bfe699f3b12896c018

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.15-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 84d8d901d9135b9bb56daa28280897cacbce5805696c5a125641b49033d446c5
MD5 9a5fc66ba37371cd745ac68ee0de67c5
BLAKE2b-256 51eeb28ef2ae1f87d8a30f6d4f8f56126a243daa532fdd4d2a131b01d799f464

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.15-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 31e72ec76732dfb71a4856bf845e55cf1861d04321a9ccb1591ad3b24c31be7f
MD5 5b45dc9dbce23e30f1e8e3375a3b21a9
BLAKE2b-256 982c6715a60821b8c156c775f7b2e4e32c95fda609e266bd16d42522a4ba3c43

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.15-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4a450d92e5602bdf2899fb89db33ab1e7b921fbbab92f65e245f0a7146aecc32
MD5 2b249e6c85d3dc12c4582b28f920f644
BLAKE2b-256 94d49f384714a0ebda78a759e139a8209c64168b5004a2c509fe5784f0657439

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.15-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 8519d46e1a8f22702aafd59d58ca96e4ab3dac45162b601c92b6bc6949b99eb0
MD5 7b4ec7b4a7f4cecc0e61ce13d91f09f1
BLAKE2b-256 bf9e7bc115c70695c95aa6e59ef2dba8175a4c01be2e6b7589b703ad375a75b1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.15-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 88cba770575022c7bc5fcfcda8258b6f0422e48909d9e01f4a9d3be1e8c9f03b
MD5 b6e754237fe1123ac78f06d8aabe06f1
BLAKE2b-256 3a4641b5dfd05bb15514aa9a40ec7895daf0250b62ab63376d35de5bc9becfbe

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