You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
974: Allow passing a custom serializer for documents r=sanders41 a=sanders41
# Pull Request
`@LaundroMat` FYI in case you want to test this to see if it solves your issue.
## Related issue
Fixes#973
## What does this PR do?
- Allows passing a custom JSONEncoder to serialize documents with types that the default encoder can't handle.
## PR checklist
Please check if your PR fulfills the following requirements:
- [x] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
- [x] Have you read the contributing guidelines?
- [x] Have you made sure that the title is accurate and descriptive of the changes?
Thank you so much for contributing to Meilisearch!
Co-authored-by: Paul Sanders <[email protected]>
Note that Meilisearch will rebuild your index whenever you update `filterableAttributes`. Depending on the size of your dataset, this might take time. You can track the process using the [task](https://www.meilisearch.com/docs/reference/api/tasks#get-tasks).
@@ -205,7 +233,6 @@ index.search(
205
233
206
234
This package guarantees compatibility with [version v1.x of Meilisearch](https://github.com/meilisearch/meilisearch/releases/latest), but some features may not be present. Please check the [issues](https://github.com/meilisearch/meilisearch-python/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22+label%3Aenhancement) for more info.
207
235
208
-
209
236
## 💡 Learn more
210
237
211
238
The following sections in our main documentation website may interest you:
List of documents. Each document should be a dictionary.
413
430
primary_key (optional):
414
431
The primary-key used in index. Ignored if already set up.
432
+
serializer (optional):
433
+
A custom JSONEncode to handle serializing fields that the build in json.dumps
434
+
cannot handle, for example UUID and datetime.
415
435
416
436
Returns
417
437
-------
@@ -425,14 +445,16 @@ def add_documents(
425
445
An error containing details about why Meilisearch can't process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors
"""Add string documents from JSON file to the index.
475
502
@@ -479,6 +506,9 @@ def add_documents_json(
479
506
String of document from a JSON file.
480
507
primary_key (optional):
481
508
The primary-key used in index. Ignored if already set up.
509
+
serializer (optional):
510
+
A custom JSONEncode to handle serializing fields that the build in json.dumps
511
+
cannot handle, for example UUID and datetime.
482
512
483
513
Returns
484
514
-------
@@ -491,7 +521,9 @@ def add_documents_json(
491
521
MeilisearchApiError
492
522
An error containing details about why Meilisearch can't process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors
One ASCII character used to customize the delimiter for CSV.
572
606
Note: The csv delimiter can only be used with the Content-Type text/csv.
607
+
serializer (optional):
608
+
A custom JSONEncode to handle serializing fields that the build in json.dumps
609
+
cannot handle, for example UUID and datetime.
573
610
574
611
Returns
575
612
-------
@@ -583,11 +620,15 @@ def add_documents_raw(
583
620
An error containing details about why Meilisearch can't process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors
List of documents. Each document should be a dictionary.
598
639
primary_key (optional):
599
640
The primary-key used in index. Ignored if already set up
641
+
serializer (optional):
642
+
A custom JSONEncode to handle serializing fields that the build in json.dumps
643
+
cannot handle, for example UUID and datetime.
600
644
601
645
Returns
602
646
-------
@@ -610,7 +654,7 @@ def update_documents(
610
654
An error containing details about why Meilisearch can't process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors
"""Update documents as a json string in the index.
649
695
@@ -653,6 +699,9 @@ def update_documents_json(
653
699
String of document from a JSON file.
654
700
primary_key (optional):
655
701
The primary-key used in index. Ignored if already set up
702
+
serializer (optional):
703
+
A custom JSONEncode to handle serializing fields that the build in json.dumps
704
+
cannot handle, for example UUID and datetime.
656
705
657
706
Returns
658
707
-------
@@ -665,7 +714,9 @@ def update_documents_json(
665
714
MeilisearchApiError
666
715
An error containing details about why Meilisearch can't process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors
One ASCII character used to customize the delimiter for CSV.
719
772
Note: The csv delimiter can only be used with the Content-Type text/csv.
773
+
serializer (optional):
774
+
A custom JSONEncode to handle serializing fields that the build in json.dumps
775
+
cannot handle, for example UUID and datetime.
720
776
721
777
Returns
722
778
-------
@@ -730,14 +786,15 @@ def update_documents_raw(
730
786
An error containing details about why Meilisearch can't process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors
0 commit comments