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
Metadata
Release files for meilisearch-status-check-decorator 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| meilisearch-status-check-decorator-0.1.3.tar.gz | 3.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| meilisearch_status_check_decorator-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.9 kB
Release files / meilisearch-status-check-decorator-0.1.3.tar.gz
| Download URL | meilisearch-status-check-decorator-0.1.3.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
acfe13dff3fa1ab3b582cc25c279aefd364b96bb000c72d2d6dcb56d2fa22586
|
|
BLAKE2b-256 checksum How to use checksums |
ab259d96c4a0af10c1e169f31b132531fcf776b4dfca924968f51a9afeefdc11
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.11 CPython/3.9.7 Linux/5.8.0-1042-azure
|
Release files / meilisearch_status_check_decorator-0.1.3-py3-none-any.whl
| Download URL | meilisearch_status_check_decorator-0.1.3-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
19bcce1e6249ddd09f05da173bbd5ec27139826e1a88e0cae0edeb9d79588784
|
|
BLAKE2b-256 checksum How to use checksums |
6c9bc75e5fc62eea674d8c069af16f0f42bffd92d1d3fb6a6f63ce5edf4008fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.11 CPython/3.9.7 Linux/5.8.0-1042-azure
|