A decorator to check for indexing status errors
Project description
MeiliSearch Status Check Decorator
This package provides a decorator for the MeiliSearch Python client that will check for a failed status when adding documents.
Instillation
pip install meilisearch-status-check-decorator
Useage
Add documents with no errors
In this example there will be no errors so the documents will be added and the decorator will not print anything.
from meilisearch import Client
from meilisearch_status_check_decorator import status_check
index = Client("http://localhost:7700", "masterKey").index("test")
@status_check(index=index)
def good_insert():
documents = [
{
"id": 1,
"name": "test 1",
},
{
"id": 2,
"name": "test 2",
}
]
index.add_documents(documents)
Add documents with errors
In this example an error will be returned because a primary key cannot be inferred
from meilisearch import Client
from meilisearch_status_check_decorator import status_check
index = Client("http://localhost:7700", "masterKey").index("test")
@status_check(index=index)
def bad_insert():
documents = [
{
"name": "test 1",
},
{
"name": "test 2",
}
]
index.add_documents(documents)
This will result in an error similar to the following being printed:
FAILED: {'status': 'failed', 'updateId': 0, 'type': {'name': 'DocumentsAddition'}, 'message': 'missing primary key', 'errorCode': 'missing_primary_key', 'errorType': 'invalid_request_error', 'errorLink': 'https://docs.meilisearch.com/errors#missing_primary_key', 'duration': 0.025, 'enqueuedAt': '2021-08-29T17:06:59.877177189Z', 'processedAt': '2021-08-29T17:06:59.906190045Z'}
Contributing
Contributions to this project are welcome. If you are interesting in contributing please see our contributing guide
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
Built Distribution
File details
Details for the file meilisearch-status-check-decorator-0.1.3.tar.gz
.
File metadata
- Download URL: meilisearch-status-check-decorator-0.1.3.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.11 CPython/3.9.7 Linux/5.8.0-1042-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | acfe13dff3fa1ab3b582cc25c279aefd364b96bb000c72d2d6dcb56d2fa22586 |
|
MD5 | 1c4aea666188d490d4b8f4c7bed2ad48 |
|
BLAKE2b-256 | ab259d96c4a0af10c1e169f31b132531fcf776b4dfca924968f51a9afeefdc11 |
File details
Details for the file meilisearch_status_check_decorator-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: meilisearch_status_check_decorator-0.1.3-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.11 CPython/3.9.7 Linux/5.8.0-1042-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19bcce1e6249ddd09f05da173bbd5ec27139826e1a88e0cae0edeb9d79588784 |
|
MD5 | 14e515029449c4b4fe9f74f7f8a606ad |
|
BLAKE2b-256 | 6c9bc75e5fc62eea674d8c069af16f0f42bffd92d1d3fb6a6f63ce5edf4008fe |