Skip to content

Commit 8b9c6c6

Browse files
Improve documentation (byte strings); fix content type (not optional)
1 parent 9eed5bd commit 8b9c6c6

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

meilisearch/index.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -484,17 +484,17 @@ def add_documents_in_batches(
484484

485485
def add_documents_json(
486486
self,
487-
str_documents: str,
487+
str_documents: bytes,
488488
primary_key: Optional[str] = None,
489489
*,
490490
serializer: Optional[Type[JSONEncoder]] = None,
491491
) -> TaskInfo:
492-
"""Add string documents from JSON file to the index.
492+
"""Add documents to the index from a byte-encoded JSON string.
493493
494494
Parameters
495495
----------
496496
str_documents:
497-
String of document from a JSON file.
497+
Byte-encoded JSON string.
498498
primary_key (optional):
499499
The primary-key used in index. Ignored if already set up.
500500
serializer (optional):
@@ -518,16 +518,16 @@ def add_documents_json(
518518

519519
def add_documents_csv(
520520
self,
521-
str_documents: str,
521+
str_documents: bytes,
522522
primary_key: Optional[str] = None,
523523
csv_delimiter: Optional[str] = None,
524524
) -> TaskInfo:
525-
"""Add string documents from a CSV file to the index.
525+
"""Add documents to the index from a byte-encoded CSV string.
526526
527527
Parameters
528528
----------
529529
str_documents:
530-
String of document from a CSV file.
530+
Byte-encoded CSV string.
531531
primary_key (optional):
532532
The primary-key used in index. Ignored if already set up.
533533
csv_delimiter:
@@ -548,15 +548,15 @@ def add_documents_csv(
548548

549549
def add_documents_ndjson(
550550
self,
551-
str_documents: str,
551+
str_documents: bytes,
552552
primary_key: Optional[str] = None,
553553
) -> TaskInfo:
554-
"""Add string documents from a NDJSON file to the index.
554+
"""Add documents to the index from a byte-encoded NDJSON string.
555555
556556
Parameters
557557
----------
558558
str_documents:
559-
String of document from a NDJSON file.
559+
Byte-encoded NDJSON string.
560560
primary_key (optional):
561561
The primary-key used in index. Ignored if already set up.
562562
@@ -575,24 +575,24 @@ def add_documents_ndjson(
575575

576576
def add_documents_raw(
577577
self,
578-
str_documents: str,
578+
str_documents: bytes,
579+
content_type: str,
579580
primary_key: Optional[str] = None,
580-
content_type: Optional[str] = None,
581581
csv_delimiter: Optional[str] = None,
582582
*,
583583
serializer: Optional[Type[JSONEncoder]] = None,
584584
) -> TaskInfo:
585-
"""Add string documents to the index.
585+
"""Add documents to the index from a byte-encoded string.
586586
587587
Parameters
588588
----------
589589
str_documents:
590-
String of document.
590+
Byte-encoded string.
591+
content_type:
592+
The content MIME type: 'application/json', 'application/x-dnjson', or 'text/csv'.
591593
primary_key (optional):
592594
The primary-key used in index. Ignored if already set up.
593-
type:
594-
The type of document. Type available: 'csv', 'json', 'jsonl'.
595-
csv_delimiter:
595+
csv_delimiter (optional):
596596
One ASCII character used to customize the delimiter for CSV.
597597
Note: The csv delimiter can only be used with the Content-Type text/csv.
598598
serializer (optional):

0 commit comments

Comments
 (0)