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

Uploaded CPython 3.14Windows x86-64

hermes_core_python-0.3.5-cp314-cp314-manylinux_2_34_x86_64.whl (906.5 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ x86-64

hermes_core_python-0.3.5-cp314-cp314-macosx_11_0_arm64.whl (739.8 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

hermes_core_python-0.3.5-cp313-cp313-win_amd64.whl (685.9 kB view details)

Uploaded CPython 3.13Windows x86-64

hermes_core_python-0.3.5-cp313-cp313-manylinux_2_34_x86_64.whl (905.8 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

hermes_core_python-0.3.5-cp313-cp313-macosx_11_0_arm64.whl (741.5 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hermes_core_python-0.3.5-cp312-cp312-win_amd64.whl (685.8 kB view details)

Uploaded CPython 3.12Windows x86-64

hermes_core_python-0.3.5-cp312-cp312-manylinux_2_34_x86_64.whl (905.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

hermes_core_python-0.3.5-cp312-cp312-macosx_11_0_arm64.whl (741.1 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.3.5-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 c0dffb06b2d7a2bb4e4cf7fcf806ccf8a7c6e7daf9f2c65fb6ab9ce3e681c411
MD5 5dd9b1aa3f82c07a382b4f80e6c0d590
BLAKE2b-256 7729b578ead5233819cb38dcec58c5dee6738bea2543997bf1b0fa91870c884c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.3.5-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 c43859ff4279aa4e5f9d89bb8dc699b46baaba45b5ab84bf2fd24ea11f5bc768
MD5 f6d179b0c396114bbe26829074ff5c8f
BLAKE2b-256 f65b9b4607900cb9dc0d3f0c33dbca80a0f339abc9388617c0a6b5c4a79c73fd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.3.5-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f9ad8b5d672ca2283a61ffe65e9c7c8aa6d60978ec56c01b3bbd935b8949b804
MD5 c9fcdd6e73111ca152c1810d95617c86
BLAKE2b-256 74069b49d75e8d94b3d538264902fedf251a2b55ce652185132d15cc0ad851d3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.3.5-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 f6ef29dfdc48454c32aa94902fb7a7c1deae37816679cb011ee1f6f166519595
MD5 3bdc61686e7ef7d839b447a67cfe08d3
BLAKE2b-256 8974c1f2884531b641dcb696d13389fa0738e085dff9abdf55b0524b3c927c06

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.3.5-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 c2fd9ce2613d734f9248eb4d84b4601247bac0bd355b9faf48595d06d2442d76
MD5 5bd419df81616e1a71604bdf0d6aeeb6
BLAKE2b-256 8b20cf819338e34367a9c7801b4f0bd3b2a7fd344d7f0e5190522a5fc017564d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.3.5-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7deb45b555729d288b87a9a1e6d8d11b528b7bbb33efc2094db89a220ba7ee75
MD5 65de3a04768cdd44315a507414ea48f3
BLAKE2b-256 4ffb25f5cab96255535353e674bf5f15b775ed4a72f65e2b560e48a5a5068c61

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.3.5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 60e26b897eb526e916fbb05a26b5566926606c3849152abbab3a342be8ecc460
MD5 fae78e98b1688a014b25da5a7ec39474
BLAKE2b-256 a6e07da32f565bb0a9ce2a6f9aa0055bb001870ccc71531b3b58bb76c8ee719a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.3.5-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 ac8822bd9118eadb4af0422d76cb5c5212ca399edc6658d855970bf0df66fd11
MD5 ae74665cb610bad865a401d99bde1941
BLAKE2b-256 ae103aed5c3d46a64c9cb3e9230b760cec05aeef4b4647aba7a0d5abd7d28423

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.3.5-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3b96b0cbe07687c8f92ab1634d9a6c5823d8320d5f2becdcbed4521afbd787e0
MD5 8d211d0738acbefc870aca1a210e30e6
BLAKE2b-256 b33a85e13099c5f0018562bb18cd10570cb970ce735d11c7ad76d38b12c6b076

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