Skip to main content

Async library for MeiliSearch

Project description

Tests pypi versions

AIO_MEILISEARCH

Async Wrapper over Meilisearch REST API with type hints

pip install aio_meilisearch

Usage

from typing import TypedDict, List, Optional
import httpx
from aio_meilisearch import (
    MeiliSearch,
    MeiliConfig,
    Index,
    SearchResponse,
)


class MovieDict(TypedDict):
    id: str
    name: str
    genres: List[str]
    url: str
    year: int


http = httpx.AsyncClient()

meilisearch = MeiliSearch(
    meili_config=MeiliConfig(
        base_url='http://localhost:7700',
        private_key='PRIVATE_KEY',
        public_key='PUBLIC_KEY',
    ),
    http_client=http,
)


index: Index[MovieDict] = await meilisearch.create_index(name="movies", pk="id")

await index.update_settings(
    {
        "searchableAttributes": ["name", "genres"],
        "displayedAttributes": [
            "name",
            "genres",
            "id",
            "url",
            "year",
        ],
        "attributesForFaceting": ["genres", "year"],
    }
)

movie_list: List[MovieDict] = [
    {
        "name": "Oblivion",
        "genres": ["action", "adventure", "sci-fi"],
        "id": "tt1483013",
        "url": "https://www.imdb.com/title/tt1483013/",
        "year": 2013,
    }
]

await index.documents.add_many(movie_list)

response: SearchResponse[MovieDict] = await index.documents.search(query="action")

Contributing

Prerequisites:

  • poetry
  • nox
  • nox-poetry

Install them on your system:

pip install poetry nox nox-poetry

Run tests:

nox

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

aio_meilisearch-0.1.1.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

aio_meilisearch-0.1.1-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aio_meilisearch-0.1.1.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.9.1 Linux/5.10.3-arch1-1

File hashes

Hashes for aio_meilisearch-0.1.1.tar.gz
Algorithm Hash digest
SHA256 bf6b8864ecc9f82e965ebdcf8715281099f08ed02151ada0c177f1a8655cba21
MD5 ce3606ffc0fec2a0da7a944d22e71350
BLAKE2b-256 c62877559408679fc1def67a772ac8a33f9496685edd30f989969a6ee5b2ad1f

See more details on using hashes here.

File details

Details for the file aio_meilisearch-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: aio_meilisearch-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.9.1 Linux/5.10.3-arch1-1

File hashes

Hashes for aio_meilisearch-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 df43bf0f35fed190e6a2b3deb6295bd4346dc4d62e5f042fdd3c1ef41410f60c
MD5 0525873ce14c40c136b2d808ff52f49b
BLAKE2b-256 74f57e18b6f09a58479c77b3e0c9c38f3ca564c8298b4a4ead7a16bed8ab1b4e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page