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

Uploaded CPython 3.14Windows x86-64

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

Uploaded CPython 3.14macOS 11.0+ ARM64

hermes_core_python-0.4.3-cp313-cp313-win_amd64.whl (785.4 kB view details)

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

hermes_core_python-0.4.3-cp312-cp312-win_amd64.whl (785.4 kB view details)

Uploaded CPython 3.12Windows x86-64

hermes_core_python-0.4.3-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.3-cp312-cp312-macosx_11_0_arm64.whl (842.2 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.3-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 acab1c6adc9d724a7ddcd20a1aec8190075ce36efdea7b233c8dd4f6ef5a1eff
MD5 a5132937b2696bfc2f806ba6d6634745
BLAKE2b-256 c887b87265dd62f432659cf3834250fde6a45050c3dfcf8200277a1264d8fa66

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.3-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 06db2036f2f170d617552d5a653f58b3ff5588ccd32342e317f5a4017377ce6c
MD5 d7facad9ba29dbffc904e95bee6795b2
BLAKE2b-256 32d1f02cfef3fa19f4d8c278f129346045ab05df9a64aa2166563ef92f3b3a15

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.3-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d4831fbfe55a9ee512b59e12c6c1b66757ee299ac07c01141a08d666f29fa262
MD5 1dd2adc95d15184ebab4fee90b56456f
BLAKE2b-256 d6512e44d32eaee048997cc0991ba7f1f5f67f1562b6030d664b8deae402752a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 392dc2ef170fa7a0d16534411eb66b8fc0431ffcc7ebacaa6d165d875141b4ed
MD5 4ff80ec9d16eabd5095addea4e2d2c77
BLAKE2b-256 9fa56392604cb87e1653831d86a456015fafd52ec53abb5ad1fc1dc1a8a43d1a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.3-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 bb4201d0f061bec9c3c0ff40ffddaec26fbbed8c347a61c4bff998cdf0a8a738
MD5 21d5b10df90299d96faefcfb1ea3f58b
BLAKE2b-256 c8d1e81b88219f133f6eb53d98fbdf12254f7055b01c5cf9bd4f052b18c47dd6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 de09f845b72bf1ab07ad8dc4b122f222a9efce9d7144747e94c32d46f28587ee
MD5 f99085d2177b0f0eee127c5a7a41ebb3
BLAKE2b-256 68ab13f006a00a24231202cc4296360f847b0c28182f712e1b16910624744cef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 2c6f5977d70a46acd3bbcda89ecd90d2716cf21b18729fade646ee1935e6dc81
MD5 d00422a55562a83db504e8ad2de70524
BLAKE2b-256 f118e0df7547594bf6b7548de0c6cdfbdbcb8683f29c4aabe15f943b6e052991

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.3-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 bbeabf7cc1225fab0eb4cfe35621c2e0bb31b06c2a935975e89b8ae9c421d130
MD5 356bda2ba231d80c711666f07992f840
BLAKE2b-256 46baa85a743b71d56e293839afaddc0dab29d94fe346d443259fa860305a6189

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_core_python-0.4.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 09d929633c94d1121dcc6f69811d9e38c493cb54905c0de3680221d89590a2d2
MD5 d981aa2513206347229e7f3bf6b10a9f
BLAKE2b-256 3f01eb1c9b3d46872bbb6cd91102d2df01309ad22ebf713d7c565c0547ac21fc

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