The MeiliSearch API asyncio client for Python
Project description
AioMeiliSearch
The MeiliSearch API asyncio client for Python
Introduction
AioMeilisearch is a asynchronous python client for MeiliSearch.
MeiliSearch is an open source, blazingly fast and hyper relevant search-engine. For more information about features in this documentation.
Summary
MeiliSearch's API is a standard RESTful HTTP API, so it comes with SDKs for all kinds of programing languages. One official python client is called meilisearch-python, it does a good job, with a great python http library called requests.
async/await is new feature of python3.4+. In some cases we need to support this feature, so here we are.
AioMeilisearch supprts async/await, writed with aiohttp.
Any python api in the MeiliSearch officia document has a awaitable version by AioMeilisearch.
Feature
- async/await
Requirements
- python3.6+
- aiohttp
Installation
pip3 install aiomeilisearch
Usage
Index
import aiomeilisearch
client = aiomeilisearch.Client('http://127.0.0.1:7700', 'masterKey')
async def create_index():
# create a index, with primaryKey "id"
# An index is where the documents are stored.
return await client.create_index('movies', {'primaryKey': 'id'})
index = await create_index()
Documents
async def add_documents():
# add documents to index
documents = [
{ 'id': 1, 'title': 'Carol', 'genres': ['Romance', 'Drama'] },
{ 'id': 2, 'title': 'Wonder Woman', 'genres': ['Action', 'Adventure'] },
{ 'id': 3, 'title': 'Life of Pi', 'genres': ['Adventure', 'Drama'] },
{ 'id': 4, 'title': 'Mad Max: Fury Road', 'genres': ['Adventure', 'Science Fiction'] },
{ 'id': 5, 'title': 'Moana', 'genres': ['Fantasy', 'Action']},
{ 'id': 6, 'title': 'Philadelphia', 'genres': ['Drama'] },
]
await index.add_documents(documents)
Get a document
await index.get_document(1)
Search documents
await client.index("movies").search('飞天大盗')
await client.index("movies").search('The Great Gatsby', filter=["is_tv=True", ["year=1925", "year=2013"]])
settings
await client.index('movies').get_settings()
await client.index('movies').update_displayed_attributes(["id", 'title', 'year'])
await client.index('movies').update_filterable_attributes(["year", 'is_tv'])
await client.index('movies').update_searchable_attributes(['title', 'original_title', ])
...
Demos
https://github.com/ziyoubaba/aiomeilisearch/tree/main/demos
Documentation
- MeiliSearch all the python apis here. Don't forget 'await'.
- AioMeilisearch, Maybe later...
License
Under MIT license.
Changelog
version 1.0.0
- based with the version v0.23.0 of MeiliSearch.
welcom contribution
Source code
The latest developer version is available in a GitHub repository: https://github.com/ziyoubaba/aiomeilisearch
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file aiomeilisearch-1.0.1.tar.gz
.
File metadata
- Download URL: aiomeilisearch-1.0.1.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1db027aebaecc43d4d16bb08882abc1fa3546c8f333a2da79a7b66c656c53606 |
|
MD5 | 591d03a7aa6f68ceb454f1d470ff3e08 |
|
BLAKE2b-256 | 325669c64c4d1db9c27e9a975f81d86c847b734122b56a7af75cdae355b99e50 |
File details
Details for the file aiomeilisearch-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: aiomeilisearch-1.0.1-py3-none-any.whl
- Upload date:
- Size: 13.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d69823c54c789d99ffe50b69aff597f4f5190596ae1a20631421fd6236335780 |
|
MD5 | 8aaa39431281738e84fd29b4f62f02fa |
|
BLAKE2b-256 | 8c8f67853159918c3664d3d0b02b63a1b734dd79a5baf06eeed255b1f0177229 |