hermes-core-python 0.4.1__cp313-cp313-macosx_11_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
hermes_core/__init__.py
ADDED
|
Binary file
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: hermes-core-python
|
|
3
|
+
Version: 0.4.1
|
|
4
|
+
Classifier: Development Status :: 4 - Beta
|
|
5
|
+
Classifier: Intended Audience :: Developers
|
|
6
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
14
|
+
Classifier: Programming Language :: Rust
|
|
15
|
+
Classifier: Topic :: Text Processing :: Indexing
|
|
16
|
+
Summary: Python bindings for Hermes search engine
|
|
17
|
+
Keywords: search,full-text-search,indexing,ir
|
|
18
|
+
Home-Page: https://github.com/SpaceFrontiers/hermes
|
|
19
|
+
Author: izihawa
|
|
20
|
+
License: MIT
|
|
21
|
+
Requires-Python: >=3.9
|
|
22
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
23
|
+
Project-URL: Documentation, https://github.com/SpaceFrontiers/hermes
|
|
24
|
+
Project-URL: Homepage, https://github.com/SpaceFrontiers/hermes
|
|
25
|
+
Project-URL: Repository, https://github.com/SpaceFrontiers/hermes
|
|
26
|
+
|
|
27
|
+
# Hermes
|
|
28
|
+
|
|
29
|
+
A high-performance, embeddable full-text search engine written in Rust.
|
|
30
|
+
|
|
31
|
+
## Features
|
|
32
|
+
|
|
33
|
+
- **Fast indexing** - Parallel segment building and compression
|
|
34
|
+
- **BM25 ranking** - Industry-standard relevance scoring
|
|
35
|
+
- **WAND optimization** - Efficient top-k query processing
|
|
36
|
+
- **Multiple platforms** - Native, WASM, and Python bindings
|
|
37
|
+
- **Flexible schema** - SDL-based schema definition language
|
|
38
|
+
- **Compression** - Zstd compression with configurable levels
|
|
39
|
+
- **Slice caching** - Optimized for cold-start latency
|
|
40
|
+
|
|
41
|
+
## Packages
|
|
42
|
+
|
|
43
|
+
| Package | Description | Registry |
|
|
44
|
+
| -------------------- | -------------------------------------------- | --------------------------------------------------- |
|
|
45
|
+
| `hermes-core` | Core search engine library | [crates.io](https://crates.io/crates/hermes-core) |
|
|
46
|
+
| `hermes-tool` | CLI for index management and data processing | [crates.io](https://crates.io/crates/hermes-tool) |
|
|
47
|
+
| `hermes-server` | gRPC server for remote search | [crates.io](https://crates.io/crates/hermes-server) |
|
|
48
|
+
| `hermes-core-python` | Python bindings | [PyPI](https://pypi.org/project/hermes-core-python) |
|
|
49
|
+
| `hermes-wasm` | WASM bindings for browsers | [npm](https://www.npmjs.com/package/hermes-wasm) |
|
|
50
|
+
|
|
51
|
+
## Quick Start
|
|
52
|
+
|
|
53
|
+
### Installation
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# Install CLI tool
|
|
57
|
+
cargo install hermes-tool
|
|
58
|
+
|
|
59
|
+
# Or use as a library
|
|
60
|
+
cargo add hermes-core
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Create an Index
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# Create index from SDL schema
|
|
67
|
+
hermes-tool create -i ./my_index -s schema.sdl
|
|
68
|
+
|
|
69
|
+
# Index documents from JSONL
|
|
70
|
+
cat documents.jsonl | hermes-tool index -i ./my_index --stdin
|
|
71
|
+
|
|
72
|
+
# Or from compressed file
|
|
73
|
+
zstdcat dump.zst | hermes-tool index -i ./my_index --stdin -p 50000
|
|
74
|
+
|
|
75
|
+
# Merge segments
|
|
76
|
+
hermes-tool merge -i ./my_index
|
|
77
|
+
|
|
78
|
+
# Show index info
|
|
79
|
+
hermes-tool info -i ./my_index
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Schema Definition (SDL)
|
|
83
|
+
|
|
84
|
+
```sdl
|
|
85
|
+
index documents {
|
|
86
|
+
field title: text [indexed, stored]
|
|
87
|
+
field content: text [indexed]
|
|
88
|
+
field author: text [indexed, stored]
|
|
89
|
+
field published_at: u64 [indexed, stored]
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Data Processing Tools
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
# Calculate SimHash for near-duplicate detection
|
|
97
|
+
cat docs.jsonl | hermes-tool simhash -f title -o title_hash
|
|
98
|
+
|
|
99
|
+
# Sort documents by field
|
|
100
|
+
cat docs.jsonl | hermes-tool sort -f score -N -r
|
|
101
|
+
|
|
102
|
+
# Pipeline example
|
|
103
|
+
zstdcat dump.zst \
|
|
104
|
+
| hermes-tool simhash -f title -o hash \
|
|
105
|
+
| hermes-tool sort -f hash -N \
|
|
106
|
+
| hermes-tool index -i ./my_index --stdin
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Using as a Library
|
|
110
|
+
|
|
111
|
+
```rust
|
|
112
|
+
use hermes_core::{Index, IndexConfig, FsDirectory};
|
|
113
|
+
|
|
114
|
+
#[tokio::main]
|
|
115
|
+
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
116
|
+
let dir = FsDirectory::new("./my_index");
|
|
117
|
+
let config = IndexConfig::default();
|
|
118
|
+
let index = Index::open(dir, config).await?;
|
|
119
|
+
|
|
120
|
+
println!("Documents: {}", index.num_docs());
|
|
121
|
+
|
|
122
|
+
Ok(())
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Python Usage
|
|
127
|
+
|
|
128
|
+
```python
|
|
129
|
+
import hermes_core
|
|
130
|
+
|
|
131
|
+
# Open index
|
|
132
|
+
index = hermes_core.Index("./my_index")
|
|
133
|
+
|
|
134
|
+
# Search
|
|
135
|
+
results = index.search("query text", limit=10)
|
|
136
|
+
for doc in results:
|
|
137
|
+
print(doc.score, doc.fields)
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### WASM Usage
|
|
141
|
+
|
|
142
|
+
```javascript
|
|
143
|
+
import init, { HermesIndex } from "hermes-wasm";
|
|
144
|
+
|
|
145
|
+
await init();
|
|
146
|
+
const index = await HermesIndex.open("/ipfs/Qm.../");
|
|
147
|
+
const results = await index.search("query text", 10);
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Development
|
|
151
|
+
|
|
152
|
+
### Prerequisites
|
|
153
|
+
|
|
154
|
+
- Rust 1.92+
|
|
155
|
+
- Python 3.12+ (for Python bindings)
|
|
156
|
+
- Node.js 20+ (for WASM)
|
|
157
|
+
- wasm-pack (for WASM builds)
|
|
158
|
+
|
|
159
|
+
### Building
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
# Build all packages
|
|
163
|
+
cargo build --release
|
|
164
|
+
|
|
165
|
+
# Build WASM
|
|
166
|
+
cd hermes-wasm && wasm-pack build --release --target web
|
|
167
|
+
|
|
168
|
+
# Build Python wheel
|
|
169
|
+
cd hermes-core-python && maturin build --release
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Testing
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
cargo test --all-features
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Linting
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
# Install pre-commit hooks
|
|
182
|
+
pip install pre-commit
|
|
183
|
+
pre-commit install
|
|
184
|
+
|
|
185
|
+
# Run linters
|
|
186
|
+
cargo fmt --all
|
|
187
|
+
cargo clippy --all-targets --all-features
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## License
|
|
191
|
+
|
|
192
|
+
MIT
|
|
193
|
+
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
hermes_core/__init__.py,sha256=lHEG14zT2WOZBNOzhMfO8uLSd0sIFnsMSRGY7zI9yqg,127
|
|
2
|
+
hermes_core/hermes_core.cpython-313-darwin.so,sha256=-2irbXm0_fZYsFin0NNLh24abh5IwDBPBIYBtV2XdR8,2160512
|
|
3
|
+
hermes_core_python-0.4.1.dist-info/METADATA,sha256=0wKVrmjxGrKEnQEIjrGf3eMnauA-Z7TZY68R1J7_i5o,5050
|
|
4
|
+
hermes_core_python-0.4.1.dist-info/WHEEL,sha256=V0PyzvBcSARU334gfbMpVsvFu6xR7hFdhQVohqdzf7E,105
|
|
5
|
+
hermes_core_python-0.4.1.dist-info/RECORD,,
|