Skip to content

Commit d360cb5

Browse files
committed
Implement localized-attributes settings sub-methods
1 parent 359c288 commit d360cb5

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

meilisearch/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class Paths:
4141
embedders = "embedders"
4242
search_cutoff_ms = "search-cutoff-ms"
4343
proximity_precision = "proximity-precision"
44+
localized_attributes = "localized-attributes"
4445

4546
def __init__(
4647
self,

meilisearch/index.py

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2042,6 +2042,68 @@ def reset_proximity_precision(self) -> TaskInfo:
20422042

20432043
return TaskInfo(**task)
20442044

2045+
# LOCALIZED ATTRIBUTES SETTINGS
2046+
2047+
def get_localized_attributes(self) -> Union[List[Dict[str, List[str]]], None]:
2048+
"""Get the proximity_precision of the index.
2049+
2050+
Returns
2051+
-------
2052+
settings:
2053+
localized_attributes of the index.
2054+
2055+
Raises
2056+
------
2057+
MeilisearchApiError
2058+
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
2059+
"""
2060+
return self.http.get(self.__settings_url_for(self.config.paths.localized_attributes))
2061+
2062+
def update_localized_attributes(
2063+
self, body: Union[List[Dict[str, List[str]]], None]
2064+
) -> TaskInfo:
2065+
"""Update the localized_attributes of the index.
2066+
2067+
Parameters
2068+
----------
2069+
body:
2070+
localized_attributes
2071+
2072+
Returns
2073+
-------
2074+
task_info:
2075+
TaskInfo instance containing information about a task to track the progress of an asynchronous process.
2076+
https://www.meilisearch.com/docs/reference/api/tasks#get-one-task
2077+
2078+
Raises
2079+
------
2080+
MeilisearchApiError
2081+
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
2082+
"""
2083+
task = self.http.put(self.__settings_url_for(self.config.paths.localized_attributes), body)
2084+
2085+
return TaskInfo(**task)
2086+
2087+
def reset_localized_attributes(self) -> TaskInfo:
2088+
"""Reset the localized_attributes of the index
2089+
2090+
Returns
2091+
-------
2092+
task_info:
2093+
TaskInfo instance containing information about a task to track the progress of an asynchronous process.
2094+
https://www.meilisearch.com/docs/reference/api/tasks#get-one-task
2095+
2096+
Raises
2097+
------
2098+
MeilisearchApiError
2099+
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
2100+
"""
2101+
task = self.http.delete(
2102+
self.__settings_url_for(self.config.paths.localized_attributes),
2103+
)
2104+
2105+
return TaskInfo(**task)
2106+
20452107
@staticmethod
20462108
def _batch(
20472109
documents: Sequence[Mapping[str, Any]], batch_size: int

0 commit comments

Comments
 (0)