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

Update HTTP methods #475

Merged
merged 1 commit into from
Jun 15, 2022
Merged
Changes from all commits
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
22 changes: 11 additions & 11 deletions meilisearch/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def update(self, primary_key: str) -> Dict[str, Any]:
An error containing details about why Meilisearch can't process your request. Meilisearch error codes are described here: https://docs.meilisearch.com/errors/#meilisearch-errors
"""
payload = {'primaryKey': primary_key}
return self.http.put(f'{self.config.paths.index}/{self.uid}', payload)
return self.http.patch(f'{self.config.paths.index}/{self.uid}', payload)

def fetch_info(self) -> 'Index':
"""Fetch the info of the index.
Expand Down Expand Up @@ -638,7 +638,7 @@ def update_settings(self, body: Dict[str, Any]) -> Dict[str, Any]:
MeiliSearchApiError
An error containing details about why Meilisearch can't process your request. Meilisearch error codes are described here: https://docs.meilisearch.com/errors/#meilisearch-errors
"""
return self.http.post(
return self.http.patch(
f'{self.config.paths.index}/{self.uid}/{self.config.paths.setting}',
body
)
Expand Down Expand Up @@ -701,7 +701,7 @@ def update_ranking_rules(self, body: List[str]) -> Dict[str, Any]:
MeiliSearchApiError
An error containing details about why Meilisearch can't process your request. Meilisearch error codes are described here: https://docs.meilisearch.com/errors/#meilisearch-errors
"""
return self.http.post(
return self.http.put(
self.__settings_url_for(self.config.paths.ranking_rules),
body
)
Expand Down Expand Up @@ -762,7 +762,7 @@ def update_distinct_attribute(self, body: Dict[str, Any]) -> Dict[str, Any]:
MeiliSearchApiError
An error containing details about why Meilisearch can't process your request. Meilisearch error codes are described here: https://docs.meilisearch.com/errors/#meilisearch-errors
"""
return self.http.post(
return self.http.put(
self.__settings_url_for(self.config.paths.distinct_attribute),
body
)
Expand Down Expand Up @@ -823,7 +823,7 @@ def update_searchable_attributes(self, body: List[str]) -> Dict[str, Any]:
MeiliSearchApiError
An error containing details about why Meilisearch can't process your request. Meilisearch error codes are described here: https://docs.meilisearch.com/errors/#meilisearch-errors
"""
return self.http.post(
return self.http.put(
self.__settings_url_for(self.config.paths.searchable_attributes),
body
)
Expand Down Expand Up @@ -884,7 +884,7 @@ def update_displayed_attributes(self, body: List[str]) -> Dict[str, Any]:
MeiliSearchApiError
An error containing details about why Meilisearch can't process your request. Meilisearch error codes are described here: https://docs.meilisearch.com/errors/#meilisearch-errors
"""
return self.http.post(
return self.http.put(
self.__settings_url_for(self.config.paths.displayed_attributes),
body
)
Expand Down Expand Up @@ -945,7 +945,7 @@ def update_stop_words(self, body: List[str]) -> Dict[str, Any]:
MeiliSearchApiError
An error containing details about why Meilisearch can't process your request. Meilisearch error codes are described here: https://docs.meilisearch.com/errors/#meilisearch-errors
"""
return self.http.post(
return self.http.put(
self.__settings_url_for(self.config.paths.stop_words),
body
)
Expand Down Expand Up @@ -1006,7 +1006,7 @@ def update_synonyms(self, body: Dict[str, List[str]]) -> Dict[str, Any]:
MeiliSearchApiError
An error containing details about why Meilisearch can't process your request. Meilisearch error codes are described here: https://docs.meilisearch.com/errors/#meilisearch-errors
"""
return self.http.post(
return self.http.put(
self.__settings_url_for(self.config.paths.synonyms),
body
)
Expand Down Expand Up @@ -1067,7 +1067,7 @@ def update_filterable_attributes(self, body: List[str]) -> Dict[str, Any]:
MeiliSearchApiError
An error containing details about why Meilisearch can't process your request. Meilisearch error codes are described here: https://docs.meilisearch.com/errors/#meilisearch-errors
"""
return self.http.post(
return self.http.put(
self.__settings_url_for(self.config.paths.filterable_attributes),
body
)
Expand Down Expand Up @@ -1129,7 +1129,7 @@ def update_sortable_attributes(self, body: List[str]) -> Dict[str, Any]:
MeiliSearchApiError
An error containing details about why Meilisearch can't process your request. Meilisearch error codes are described here: https://docs.meilisearch.com/errors/#meilisearch-errors
"""
return self.http.post(
return self.http.put(
self.__settings_url_for(self.config.paths.sortable_attributes),
body
)
Expand Down Expand Up @@ -1190,7 +1190,7 @@ def update_typo_tolerance(self, body: Dict[str, Any]) -> Dict[str, Any]:
MeiliSearchApiError
An error containing details about why Meilisearch can't process your request. Meilisearch error codes are described here: https://docs.meilisearch.com/errors/#meilisearch-errors
"""
return self.http.post(
return self.http.patch(
self.__settings_url_for(self.config.paths.typo_tolerance),
body
)
Expand Down