Skip to content
This repository was archived by the owner on Jan 31, 2022. It is now read-only.

Commit 23f768a

Browse files
author
Clément Le Provost
committed
Use getVersion=2 when retrieving settings
… except in offline sync where the legacy format is required for synonyms. Fixes #157.
1 parent 9ae1bca commit 23f768a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

algoliasearch/src/main/java/com/algolia/search/saas/Index.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ public Request getSettingsAsync(@NonNull CompletionHandler completionHandler) {
458458
return getClient().new AsyncTaskRequest(completionHandler) {
459459
@NonNull
460460
@Override JSONObject run() throws AlgoliaException {
461-
return getSettings();
461+
return getSettings(2);
462462
}
463463
}.start();
464464
}
@@ -972,8 +972,8 @@ protected JSONObject waitTask(String taskID) throws AlgoliaException {
972972
*
973973
* @throws AlgoliaException
974974
*/
975-
protected JSONObject getSettings() throws AlgoliaException {
976-
return client.getRequest("/1/indexes/" + encodedIndexName + "/settings", false);
975+
protected JSONObject getSettings(int formatVersion) throws AlgoliaException {
976+
return client.getRequest("/1/indexes/" + encodedIndexName + "/settings?getVersion=" + formatVersion, false);
977977
}
978978

979979
/**

algoliasearch/src/offline/java/com/algolia/search/saas/MirroredIndex.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ public void run()
457457

458458
// Fetch settings.
459459
{
460-
JSONObject settingsJSON = this.getSettings();
460+
JSONObject settingsJSON = this.getSettings(1);
461461
settingsFile = new File(tmpDir, "settings.json");
462462
String data = settingsJSON.toString();
463463
Writer writer = new OutputStreamWriter(new FileOutputStream(settingsFile), "UTF-8");

0 commit comments

Comments
 (0)