meilisearch-java
meilisearch-java copied to clipboard
Provide a generic to http get methods
Pull Request
What does this PR do?
Most of the methods had to use the jsonHandler
after the call to the get
method through the client. The purpose of this PR is to bypass this step to simplify the call to the get method via the client:
public String[] getRankingRuleSettings(String uid) throws MeilisearchException {
String urlPath = "/indexes/" + uid + "/settings/synonyms";
return httpClient.jsonHandler.decode(httpClient.get(urlPath, String.class), String[].class);
}
became
public String[] getRankingRuleSettings(String uid) throws MeilisearchException {
String urlPath = "/indexes/" + uid + "/settings/ranking-rules";
return httpClient.get(urlPath, String[].class);
}
Note:
This method still need a call to the decode
method from jsonHandler
public Map<String, String[]> getSynonymsSettings(String uid) throws MeilisearchException {
String urlPath = "/indexes/" + uid + "/settings/synonyms";
return httpClient.jsonHandler.decode(httpClient.get(urlPath, String.class), Map.class);
}