| Crates.io | heroindex |
| lib.rs | heroindex |
| version | 0.1.3 |
| created_at | 2025-12-25 07:25:31.898596+00 |
| updated_at | 2025-12-25 08:14:28.563863+00 |
| description | A Tantivy-based indexing server with OpenRPC socket interface |
| homepage | https://forge.ourworld.tf/lhumina_research/hero_index_server |
| repository | https://forge.ourworld.tf/lhumina_research/hero_index_server |
| max_upload_size | |
| id | 2004292 |
| size | 149,365 |
A high-performance full-text search server built on Tantivy, exposing an OpenRPC interface over Unix sockets.
Repository: https://forge.ourworld.tf/lhumina_research/hero_index_server
Looking for the client library? See heroindex_client for easy integration into your Rust applications.
rpc.discovercargo install heroindex
git clone https://forge.ourworld.tf/lhumina_research/hero_index_server.git
cd hero_index_server
cargo build --release
heroindex --dir /var/lib/heroindex --socket /tmp/heroindex.sock
Use heroindex_client to connect:
use heroindex_client::HeroIndexClient;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), heroindex_client::Error> {
let mut client = HeroIndexClient::connect("/tmp/heroindex.sock").await?;
// Create an index
client.db_create("articles", json!({
"fields": [
{"name": "title", "type": "text", "stored": true, "indexed": true},
{"name": "body", "type": "text", "stored": true, "indexed": true}
]
})).await?;
// Add documents
client.db_select("articles").await?;
client.doc_add(json!({"title": "Hello", "body": "World"})).await?;
client.commit().await?;
client.reload().await?;
// Search
let results = client.search(
json!({"type": "match", "field": "body", "value": "world"}),
10, 0
).await?;
println!("Found {} results", results.total_hits);
Ok(())
}
heroindex [OPTIONS]
Options:
-d, --dir <DIR> Base directory for all indexes
-s, --socket <SOCKET> Unix socket path for RPC interface
-h, --help Print help
-V, --version Print version
Define your index schema with these field types:
| Type | Description | Options |
|---|---|---|
text |
Full-text searchable (tokenized) | stored, indexed, fast, tokenizer |
str |
Exact match string (keyword) | stored, indexed, fast |
u64 |
Unsigned 64-bit integer | stored, indexed, fast |
i64 |
Signed 64-bit integer | stored, indexed, fast |
f64 |
64-bit floating point | stored, indexed, fast |
date |
DateTime (RFC 3339) | stored, indexed, fast |
bool |
Boolean | stored, indexed, fast |
json |
JSON object | stored, indexed |
bytes |
Binary data | stored, indexed, fast |
ip |
IP address | stored, indexed, fast |
{
"fields": [
{"name": "id", "type": "str", "stored": true, "indexed": true},
{"name": "title", "type": "text", "stored": true, "indexed": true, "tokenizer": "en_stem"},
{"name": "content", "type": "text", "stored": true, "indexed": true},
{"name": "views", "type": "u64", "stored": true, "indexed": true, "fast": true},
{"name": "rating", "type": "f64", "stored": true, "indexed": true, "fast": true},
{"name": "published", "type": "date", "stored": true, "indexed": true, "fast": true},
{"name": "active", "type": "bool", "stored": true, "indexed": true},
{"name": "metadata", "type": "json", "stored": true, "indexed": true}
]
}
{"type": "match", "field": "content", "value": "search terms"}
{"type": "term", "field": "id", "value": "abc123"}
{"type": "fuzzy", "field": "title", "value": "serch", "distance": 2}
{"type": "phrase", "field": "content", "value": "exact phrase match"}
{"type": "prefix", "field": "title", "value": "hel"}
{"type": "range", "field": "views", "gte": 100, "lt": 1000}
{"type": "regex", "field": "title", "value": "test.*"}
{
"type": "boolean",
"must": [{"type": "match", "field": "content", "value": "rust"}],
"should": [{"type": "match", "field": "title", "value": "tutorial"}],
"must_not": [{"type": "term", "field": "status", "value": "draft"}]
}
| Method | Description |
|---|---|
rpc.discover |
Get OpenRPC schema |
server.ping |
Health check |
server.stats |
Server statistics |
db.list |
List all databases |
db.create |
Create database with schema |
db.delete |
Delete a database |
db.select |
Select database for operations |
db.info |
Get database info |
schema.get |
Get current schema |
doc.add |
Add single document |
doc.add_batch |
Add multiple documents |
doc.delete |
Delete by term |
index.commit |
Commit changes |
index.reload |
Reload to see changes |
search.query |
Execute search |
search.count |
Count matches |
doc.add_batch is much faster than individual addsen_stem for English, raw for keywordsMIT License - see LICENSE for details.
Built on the excellent Tantivy search engine library.