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

Uploaded CPython 3.14Windows x86-64

hermes_core_python-0.4.6-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.6-cp314-cp314-macosx_11_0_arm64.whl (843.4 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

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

Uploaded CPython 3.13Windows x86-64

hermes_core_python-0.4.6-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.6-cp313-cp313-macosx_11_0_arm64.whl (842.6 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

hermes_core_python-0.4.6-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.6-cp312-cp312-macosx_11_0_arm64.whl (842.4 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.6-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 bd579fe4595e0940fff48e7e317d1fe01fc14df644d451a3b9c4666357bd18d5
MD5 09beaf603e0e4e4afb38cafb93ac9156
BLAKE2b-256 0b22ed388cba285109024812bd765433f83a1ccf9edbe44abc7b773761de3bd6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.6-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 45ac4fec48786045cf99c258b9f070b841d914a44d32866c58cd0f9d0f8d3e0d
MD5 6bbed1fcc26a9a2b57e1c7236b79c2bc
BLAKE2b-256 9d1e1dfc741427703e44c4a57d8ca0c817257cbaaf1e4cfa8734ebe8074cee9a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.6-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3e0749506c6cb2f34aa69acdd82c619f2c62413e20c4b61a40fcf41793ad30b5
MD5 ae204239a3224bb4dca11aaf1770c866
BLAKE2b-256 213880c50a13b28c75c9694af2ba9b4c0ad2d69b9b0dfebc11ea1a42037cb175

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.6-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 9513ae7bc1eaa8610c63479b82251f9c0a27e6a7ddba30fbca52a66b4e240abe
MD5 59484b85e817037e7da406eef9a8ecd1
BLAKE2b-256 0d670f6619436f946307e753e72b5355cb26a8b58f602f2d1df964197c5ba187

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.6-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 dc43593b3c0887edfc07c00560ebbdc7e1200f649a76edc29a8e097b7fe558ac
MD5 f8a324603dec7f13e6472bcf1b7b7429
BLAKE2b-256 923902600ad26a41c573181723a84caaa18d5075f5ab342b549a029849a10eb7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.6-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dd173c256aedd4a190bbaae826f71eeaee37b5e7e3ed0a91dd7a7a2ff25001c4
MD5 f533dc4a9b543de1bf01134108cc5771
BLAKE2b-256 9e3e151870e8054b051cff2c313d69a2c6e382cf6c3e83732630edc175f05e40

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.6-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 306bbd5c3840865818e156d5e1fee441fd920391f2e46fd57e29c6cf7a3ccd42
MD5 8468b2a8dc99dffe1f8f89ba5777b5f9
BLAKE2b-256 736097ba5944e4a1aab2e7532b100c6b1d1a9084bdaf8a68c34e1e4b0eb6aad8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.6-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 fb64ebfdf46bdd68c43f28060b23690b08d04d510911ff25c2d08ff98a65e929
MD5 ec4a8b667ea0a46b507d5d3d541df7f0
BLAKE2b-256 26e1190576e6430ed0d1415d5426be71cf46d3cfcd43c564baceaa282fef511a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.6-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c3d2f5e08d3c49fe7ba92d55fc6b2bf7b7c57f605c8419d0f03a3f022e019c2e
MD5 235449fe544970334a1509510524d0fe
BLAKE2b-256 2667baebb9ea87304d34374ad695f55be52683e90f3660529edf6883a2958b0f

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