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

Uploaded CPython 3.14Windows x86-64

hermes_core_python-0.4.12-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.12-cp314-cp314-macosx_11_0_arm64.whl (842.8 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

hermes_core_python-0.4.12-cp313-cp313-win_amd64.whl (785.3 kB view details)

Uploaded CPython 3.13Windows x86-64

hermes_core_python-0.4.12-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.12-cp313-cp313-macosx_11_0_arm64.whl (841.9 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hermes_core_python-0.4.12-cp312-cp312-win_amd64.whl (785.3 kB view details)

Uploaded CPython 3.12Windows x86-64

hermes_core_python-0.4.12-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.12-cp312-cp312-macosx_11_0_arm64.whl (841.5 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.12-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 eafdfea21466347eadb9a490161d522267c9384229a666168e37ca87264f2efd
MD5 bbc7165f00d2913cddbbe7203241c864
BLAKE2b-256 70968cc25893604c3567b017b41053acd4ea6341438662ae8adadd9a7fd2caa9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.12-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 220cec23b3290c482a4df7a0fb337b6abbcbf796c3ace68913328f89582b6fda
MD5 31c38dc9b3e09091f702fc963331b2f8
BLAKE2b-256 4213c8b637dbbec1cf9f165a407cf954a431f8ffbd4f26a72ed4d5e10fc6315c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.12-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 97d90d5df49592e90205c471b68fbc253743fec258151cd8e5484fb75d13da37
MD5 be19b318ac481cdfe97cad4ffa074fca
BLAKE2b-256 e351f3da9b69c792edfd5517792e08c0d20e967c05a263f4ab5db53b4cd70226

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.12-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 d33db1f903e7f21ced41c863d7e1d58942741872d13068624f05e53f1b6e8772
MD5 904dc9e486fd0e5afe275fe95cedddac
BLAKE2b-256 822d382784f244c88506471895088204799c2c6a6a78f2f5ab38b46c86b2c156

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.12-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 697fd387898f8bd418531cfdaa1516894fba58cdc20151e3e9265269e84eb7ca
MD5 fdbc058d2cc0772504d061188ed3edf0
BLAKE2b-256 f411f30f679cc8531d4735a9678ef8cc2f7a745a9ac921cf5d271d811e0a20a0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.12-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0160bd3fb163edd8a9a13b3d48e0bb77e14124aafd9f73ec8bc14eaeea3d6704
MD5 636b5eba8922a1886d9da37c696207e7
BLAKE2b-256 f12a6b5ac4529b9745126b1c03c1a0b9e607262b32f68f7d4b5dfd24376c9dff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.12-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 8b2f8811e684a1c92539525e03fe53d140466179fce43f14e07ac7980ffaf9b4
MD5 0a1af135c3761da9390f1f5bcdbb1f69
BLAKE2b-256 64cc6f6c0dcfd1ee421d0ed41ef4032362ea9581b15146abd8f4c05ebf840f46

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.12-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 831fbed238f8cdf2a3a23a930b73e0881c7d08b5b2b4d2895aad18924528bcb8
MD5 7ab92a73a8f7384c4e33b1d84c627ae5
BLAKE2b-256 d1fcb4b8c193568cf23f712eb6548de803897e7f69d00bd82aa572a69fac37d5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.12-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 503fe8bda5b9bdc2787559a02773e9621ab3de5018fd2ce418f78606afe39d84
MD5 49f520aca805939ffac6b75dca06c7e2
BLAKE2b-256 1dbda40eee34f70be1108a8b8733a587822eaf7567c2a4af0a92df63162d9809

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