Skip to main content

An embeddable, in-process search engine written in Rust

Project description

lucisearch

An embeddable, in-process search engine written in Rust with Python bindings.

Features

  • Full-text search with BM25 scoring, phrase queries, fuzzy matching
  • Structured queries — term, range, bool, geo_distance, geo_shape, nested
  • Aggregations — terms, stats, histogram, date_histogram, cardinality, percentiles, and 12 more
  • Sort by field with keyword, numeric, boolean columns
  • Paginationfrom/size and cursor-based search_after
  • Document CRUD — get, delete, update by _id, delete by query
  • Hybrid search — dense vector kNN + text via RRF fusion
  • 2-8x faster than Elasticsearch on every supported feature
  • No server, no cluster, no HTTP — just pip install and search

Quick Start

import luci

# Create an index
index = luci.Index.create("my_index.luci", {
    "properties": {
        "title": {"type": "text"},
        "body": {"type": "text"},
        "tag": {"type": "keyword"},
        "price": {"type": "float"},
    }
})

# Add documents (bulk for multiple, add for single)
index.bulk([
    {"title": "Hello World", "body": "Getting started", "tag": "intro", "price": 9.99},
    {"title": "Search Engine", "body": "Full-text search", "tag": "tech", "price": 29.99},
])

# Search (ES-compatible query DSL)
results = index.search({
    "query": {"match": {"title": "hello"}},
    "size": 10
})

for hit in results["hits"]:
    print(hit["_score"], hit["_source"]["title"])

# Sort by field
results = index.search({
    "query": {"match_all": {}},
    "sort": [{"price": "asc"}],
    "size": 5
})

# Aggregations
results = index.search({
    "query": {"match_all": {}},
    "aggs": {"by_tag": {"terms": {"field": "tag"}}},
    "size": 0
})

# CRUD operations
doc = index.get("my_doc_id")
index.update("my_doc_id", {"price": 19.99})
index.delete("my_doc_id")
index.delete_by_query({"term": {"tag": "draft"}})

Performance

Benchmarked on 100,000 documents (Apple M5 Max):

vs Elasticsearch

Query Luci ES Speedup
sort_numeric 1074μs 2149μs 2.0x
fields_only 281μs 1225μs 4.4x
explain 404μs 1368μs 3.4x
from_0 369μs 1046μs 2.8x
rescore 362μs 1994μs 5.5x
source_disabled 275μs 897μs 3.3x
collapse 3332μs 5308μs 1.6x

vs Tantivy

Query Luci Tantivy Speedup
match_phrase 190μs 409μs 2.1x
match_all 272μs 488μs 1.8x
from_1000 273μs 519μs 1.9x
no_source 68μs 140μs 2.0x
bool_must 280μs 362μs 1.3x

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 Distribution

lucisearch-0.2.0.tar.gz (344.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lucisearch-0.2.0-cp39-cp39-macosx_11_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

Details for the file lucisearch-0.2.0.tar.gz.

File metadata

  • Download URL: lucisearch-0.2.0.tar.gz
  • Upload date:
  • Size: 344.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.12.6

File hashes

Hashes for lucisearch-0.2.0.tar.gz
Algorithm Hash digest
SHA256 2dbf21ea022f22dfa87f407019f61ebc813a23ecb763eeb67c2a4e512a6e8d61
MD5 fe7f066a605dd5f1f697f269730b8a28
BLAKE2b-256 48788ffcb20f7f89891d87d5823fe6b4c3968ddf7ddf72a55c7ac85941999e0d

See more details on using hashes here.

File details

Details for the file lucisearch-0.2.0-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lucisearch-0.2.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 96e70ecaab29ea46d4ad3bb5a5359be3584f20e323f273899f86c1a6a1863425
MD5 70399df27e99c6689b210d5f2254eeb2
BLAKE2b-256 a84db8fb49bc5b1b0b030081d31811759c3d71b47cebbaa73706d1d3fe86253e

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