milli-py
Python bindings for Milli, the embeddable Rust-based search engine powering Meilisearch.
Due to limitations around Rust lifecycles, methods available via IndexDocuments
and Search
have been integrated directly into the Index
class. This sacrifices/simplifies functionality available in the original milli package.
Install the package via:
pip install milli
Usage
Basic usage of the milli-py:
import milli
index = milli.Index("path/to/index")
index.add_documents([
{ "id": 0, "title": "Hello world", "content": "This is a sample" },
{ "id": 1, "title": "Hello moon", "content": "This is another sample" },
{ "id": 2, "title": "Hello sun", "content": "This is yet another sample" },
])
results = index.search("wrold")
document = index.get_document(results[0])
assert(document['title'] == "Hello world")
Documentation
Full documentation for milli-py is available at docs/index.md
.
View it online at https://github.com/AlexAltea/milli-py/blob/master/docs/index.md.
Examples
Real-world examples of milli-py in action:
- Curator: Searching 140k movies (~10 MB csv, ~140 MB index) in around 36ms to obtain metadata from OMDB and auto-rename/tag movie collections.
Do you have other interesting examples? Let me know!