Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve documentation for Index.add_documents() methods #1057

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions meilisearch/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,17 +484,17 @@ def add_documents_in_batches(

def add_documents_json(
self,
str_documents: str,
str_documents: bytes,
primary_key: Optional[str] = None,
*,
serializer: Optional[Type[JSONEncoder]] = None,
) -> TaskInfo:
"""Add string documents from JSON file to the index.
"""Add documents to the index from a byte-encoded JSON string.

Parameters
----------
str_documents:
String of document from a JSON file.
Byte-encoded JSON string.
primary_key (optional):
The primary-key used in index. Ignored if already set up.
serializer (optional):
Expand All @@ -518,16 +518,16 @@ def add_documents_json(

def add_documents_csv(
self,
str_documents: str,
str_documents: bytes,
primary_key: Optional[str] = None,
csv_delimiter: Optional[str] = None,
) -> TaskInfo:
"""Add string documents from a CSV file to the index.
"""Add documents to the index from a byte-encoded CSV string.

Parameters
----------
str_documents:
String of document from a CSV file.
Byte-encoded CSV string.
primary_key (optional):
The primary-key used in index. Ignored if already set up.
csv_delimiter:
Expand All @@ -548,15 +548,15 @@ def add_documents_csv(

def add_documents_ndjson(
self,
str_documents: str,
str_documents: bytes,
primary_key: Optional[str] = None,
) -> TaskInfo:
"""Add string documents from a NDJSON file to the index.
"""Add documents to the index from a byte-encoded NDJSON string.

Parameters
----------
str_documents:
String of document from a NDJSON file.
Byte-encoded NDJSON string.
primary_key (optional):
The primary-key used in index. Ignored if already set up.

Expand All @@ -575,24 +575,24 @@ def add_documents_ndjson(

def add_documents_raw(
self,
str_documents: str,
str_documents: bytes,
content_type: str,
primary_key: Optional[str] = None,
content_type: Optional[str] = None,
samuelbradshaw marked this conversation as resolved.
Show resolved Hide resolved
csv_delimiter: Optional[str] = None,
*,
serializer: Optional[Type[JSONEncoder]] = None,
) -> TaskInfo:
"""Add string documents to the index.
"""Add documents to the index from a byte-encoded string.

Parameters
----------
str_documents:
String of document.
Byte-encoded string.
content_type:
The content MIME type: 'application/json', 'application/x-dnjson', or 'text/csv'.
primary_key (optional):
The primary-key used in index. Ignored if already set up.
type:
The type of document. Type available: 'csv', 'json', 'jsonl'.
csv_delimiter:
csv_delimiter (optional):
One ASCII character used to customize the delimiter for CSV.
Note: The csv delimiter can only be used with the Content-Type text/csv.
serializer (optional):
Expand Down
Loading