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
index.add({"title": "Hello World", "body": "Getting started", "tag": "intro", "price": 9.99})
index.add({"title": "Search Engine", "body": "Full-text search", "tag": "tech", "price": 29.99})
index.commit()

# 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.1.1.tar.gz (309.4 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.1.1-cp312-cp312-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for lucisearch-0.1.1.tar.gz
Algorithm Hash digest
SHA256 1e789ad17b30919e9f8cac7331261d9b054b7c78e9e95761f72307af2a1954b4
MD5 5617e0c4115fe8e23cdebc45bbd2e78d
BLAKE2b-256 8e2166541c432ca3048ea5929e887f84e8ef9f3978f092230ffad4d633dc40e6

See more details on using hashes here.

File details

Details for the file lucisearch-0.1.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lucisearch-0.1.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6bf6526a8b571773e1fd291408892b4e4931834a75294485b5fa5844442f63ee
MD5 fe8de149db51b5d6ee4f3563dc9c3df1
BLAKE2b-256 b0cad269f0c8ff4d7ab1a8afd25bf0474719bf453b3aed9c528bd2bb712a9a63

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