Metadata-Version: 2.4
Name: milli
Version: 1.41.0
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Rust
Classifier: Typing :: Typed
License-File: LICENSE
Requires-Python: >=3.10
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Documentation, https://github.com/AlexAltea/milli-py/blob/master/docs/index.md
Project-URL: Issues, https://github.com/AlexAltea/milli-py/issues
Project-URL: Repository, https://github.com/AlexAltea/milli-py.git

# milli-py

[![ci-badge](https://github.com/AlexAltea/milli-py/actions/workflows/ci.yml/badge.svg)](https://github.com/AlexAltea/milli-py/actions/workflows/ci.yml)
[![](https://img.shields.io/pypi/v/milli.svg)](https://pypi.python.org/pypi/milli)

Python bindings for [Milli](https://github.com/meilisearch/meilisearch/tree/main/milli), the embeddable Rust-based search engine powering [Meilisearch](https://www.meilisearch.com/).

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:

```sh
pip install milli
```

## Usage

Basic usage of the *milli-py*:

```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`](./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](https://github.com/AlexAltea/curator/blob/master/curator/databases/omdb.py#L9): 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!

