|
29 | 29 | Faceting,
|
30 | 30 | HuggingFaceEmbedder,
|
31 | 31 | IndexStats,
|
| 32 | + LocalizedAttributes, |
32 | 33 | OpenAiEmbedder,
|
33 | 34 | Pagination,
|
34 | 35 | ProximityPrecision,
|
@@ -2042,6 +2043,73 @@ def reset_proximity_precision(self) -> TaskInfo:
|
2042 | 2043 |
|
2043 | 2044 | return TaskInfo(**task)
|
2044 | 2045 |
|
| 2046 | + # LOCALIZED ATTRIBUTES SETTINGS |
| 2047 | + |
| 2048 | + def get_localized_attributes(self) -> Union[List[LocalizedAttributes], None]: |
| 2049 | + """Get the localized_attributes of the index. |
| 2050 | +
|
| 2051 | + Returns |
| 2052 | + ------- |
| 2053 | + settings: |
| 2054 | + localized_attributes of the index. |
| 2055 | +
|
| 2056 | + Raises |
| 2057 | + ------ |
| 2058 | + MeilisearchApiError |
| 2059 | + 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 |
| 2060 | + """ |
| 2061 | + response = self.http.get(self.__settings_url_for(self.config.paths.localized_attributes)) |
| 2062 | + |
| 2063 | + if not response: |
| 2064 | + return None |
| 2065 | + |
| 2066 | + return [LocalizedAttributes(**attrs) for attrs in response] |
| 2067 | + |
| 2068 | + def update_localized_attributes( |
| 2069 | + self, body: Union[List[Mapping[str, List[str]]], None] |
| 2070 | + ) -> TaskInfo: |
| 2071 | + """Update the localized_attributes of the index. |
| 2072 | +
|
| 2073 | + Parameters |
| 2074 | + ---------- |
| 2075 | + body: |
| 2076 | + localized_attributes |
| 2077 | +
|
| 2078 | + Returns |
| 2079 | + ------- |
| 2080 | + task_info: |
| 2081 | + TaskInfo instance containing information about a task to track the progress of an asynchronous process. |
| 2082 | + https://www.meilisearch.com/docs/reference/api/tasks#get-one-task |
| 2083 | +
|
| 2084 | + Raises |
| 2085 | + ------ |
| 2086 | + MeilisearchApiError |
| 2087 | + 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 |
| 2088 | + """ |
| 2089 | + task = self.http.put(self.__settings_url_for(self.config.paths.localized_attributes), body) |
| 2090 | + |
| 2091 | + return TaskInfo(**task) |
| 2092 | + |
| 2093 | + def reset_localized_attributes(self) -> TaskInfo: |
| 2094 | + """Reset the localized_attributes of the index |
| 2095 | +
|
| 2096 | + Returns |
| 2097 | + ------- |
| 2098 | + task_info: |
| 2099 | + TaskInfo instance containing information about a task to track the progress of an asynchronous process. |
| 2100 | + https://www.meilisearch.com/docs/reference/api/tasks#get-one-task |
| 2101 | +
|
| 2102 | + Raises |
| 2103 | + ------ |
| 2104 | + MeilisearchApiError |
| 2105 | + 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 |
| 2106 | + """ |
| 2107 | + task = self.http.delete( |
| 2108 | + self.__settings_url_for(self.config.paths.localized_attributes), |
| 2109 | + ) |
| 2110 | + |
| 2111 | + return TaskInfo(**task) |
| 2112 | + |
2045 | 2113 | @staticmethod
|
2046 | 2114 | def _batch(
|
2047 | 2115 | documents: Sequence[Mapping[str, Any]], batch_size: int
|
|
0 commit comments