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

Commit 38c1c90

Browse files
committed
chore: Formatting
1 parent 209a647 commit 38c1c90

File tree

2 files changed

+64
-66
lines changed

2 files changed

+64
-66
lines changed

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

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -65,24 +65,24 @@ public class Client extends AbstractClient {
6565

6666
/**
6767
* Create a new Algolia Search client targeting the default hosts.
68-
*
68+
* <p>
6969
* NOTE: This is the recommended way to initialize a client is most use cases.
7070
*
7171
* @param applicationID The application ID (available in your Algolia Dashboard).
72-
* @param apiKey A valid API key for the service.
72+
* @param apiKey A valid API key for the service.
7373
*/
7474
public Client(@NonNull String applicationID, @NonNull String apiKey) {
7575
this(applicationID, apiKey, null);
7676
}
7777

7878
/**
7979
* Create a new Algolia Search client with explicit hosts to target.
80-
*
80+
* <p>
8181
* NOTE: In most use cases, you should the default hosts. See {@link Client#Client(String, String)}.
8282
*
8383
* @param applicationID The application ID (available in your Algolia Dashboard).
84-
* @param apiKey A valid API key for the service.
85-
* @param hosts An explicit list of hosts to target, or null to use the default hosts.
84+
* @param apiKey A valid API key for the service.
85+
* @param hosts An explicit list of hosts to target, or null to use the default hosts.
8686
*/
8787
public Client(@NonNull String applicationID, @NonNull String apiKey, @Nullable String[] hosts) {
8888
super(applicationID, apiKey, hosts, hosts);
@@ -131,7 +131,6 @@ public Client(@NonNull String applicationID, @NonNull String apiKey, @Nullable S
131131
*
132132
* @param indexName The name of the index.
133133
* @return A new proxy to the specified index.
134-
*
135134
* @deprecated You should now use {@link #getIndex(String)}, which re-uses instances with the same name.
136135
*/
137136
public Index initIndex(@NonNull String indexName) {
@@ -148,7 +147,7 @@ public Index initIndex(@NonNull String indexName) {
148147
Index index = null;
149148
WeakReference<Object> existingIndex = indices.get(indexName);
150149
if (existingIndex != null) {
151-
index = (Index)existingIndex.get();
150+
index = (Index) existingIndex.get();
152151
}
153152
if (index == null) {
154153
index = new Index(this, indexName);
@@ -164,7 +163,7 @@ public Index initIndex(@NonNull String indexName) {
164163
/**
165164
* List existing indexes.
166165
*
167-
* @param requestOptions Request-specific options.
166+
* @param requestOptions Request-specific options.
168167
* @param completionHandler The listener that will be notified of the request's outcome.
169168
* @return A cancellable request.
170169
*/
@@ -191,8 +190,8 @@ public Request listIndexesAsync(@NonNull CompletionHandler completionHandler) {
191190
/**
192191
* Delete an index.
193192
*
194-
* @param indexName Name of index to delete.
195-
* @param requestOptions Request-specific options.
193+
* @param indexName Name of index to delete.
194+
* @param requestOptions Request-specific options.
196195
* @param completionHandler The listener that will be notified of the request's outcome.
197196
* @return A cancellable request.
198197
*/
@@ -209,7 +208,7 @@ protected JSONObject run() throws AlgoliaException {
209208
/**
210209
* Delete an index.
211210
*
212-
* @param indexName Name of index to delete.
211+
* @param indexName Name of index to delete.
213212
* @param completionHandler The listener that will be notified of the request's outcome.
214213
* @return A cancellable request.
215214
*/
@@ -222,9 +221,9 @@ public Request deleteIndexAsync(final @NonNull String indexName, CompletionHandl
222221
* If the destination index already exists, its specific API keys will be preserved and the source index specific
223222
* API keys will be added.
224223
*
225-
* @param srcIndexName Name of index to move.
226-
* @param dstIndexName The new index name.
227-
* @param requestOptions Request-specific options.
224+
* @param srcIndexName Name of index to move.
225+
* @param dstIndexName The new index name.
226+
* @param requestOptions Request-specific options.
228227
* @param completionHandler The listener that will be notified of the request's outcome.
229228
* @return A cancellable request.
230229
*/
@@ -243,8 +242,8 @@ protected JSONObject run() throws AlgoliaException {
243242
* If the destination index already exists, its specific API keys will be preserved and the source index specific
244243
* API keys will be added.
245244
*
246-
* @param srcIndexName Name of index to move.
247-
* @param dstIndexName The new index name.
245+
* @param srcIndexName Name of index to move.
246+
* @param dstIndexName The new index name.
248247
* @param completionHandler The listener that will be notified of the request's outcome.
249248
* @return A cancellable request.
250249
*/
@@ -310,9 +309,9 @@ public String toString() {
310309
/**
311310
* Run multiple queries, potentially targeting multiple indexes, with one API call.
312311
*
313-
* @param queries The queries to run.
314-
* @param strategy The strategy to use.
315-
* @param requestOptions Request-specific options.
312+
* @param queries The queries to run.
313+
* @param strategy The strategy to use.
314+
* @param requestOptions Request-specific options.
316315
* @param completionHandler The listener that will be notified of the request's outcome.
317316
* @return A cancellable request.
318317
*/
@@ -329,8 +328,8 @@ protected JSONObject run() throws AlgoliaException {
329328
/**
330329
* Run multiple queries, potentially targeting multiple indexes, with one API call.
331330
*
332-
* @param queries The queries to run.
333-
* @param strategy The strategy to use.
331+
* @param queries The queries to run.
332+
* @param strategy The strategy to use.
334333
* @param completionHandler The listener that will be notified of the request's outcome.
335334
* @return A cancellable request.
336335
*/
@@ -341,8 +340,8 @@ public Request multipleQueriesAsync(final @NonNull List<IndexQuery> queries, fin
341340
/**
342341
* Batch operations.
343342
*
344-
* @param operations List of operations.
345-
* @param requestOptions Request-specific options.
343+
* @param operations List of operations.
344+
* @param requestOptions Request-specific options.
346345
* @param completionHandler The listener that will be notified of the request's outcome.
347346
* @return A cancellable request.
348347
*/
@@ -359,7 +358,7 @@ protected JSONObject run() throws AlgoliaException {
359358
/**
360359
* Batch operations.
361360
*
362-
* @param operations List of operations.
361+
* @param operations List of operations.
363362
* @param completionHandler The listener that will be notified of the request's outcome.
364363
* @return A cancellable request.
365364
*/
@@ -377,7 +376,7 @@ public Request batchAsync(final @NonNull JSONArray operations, CompletionHandler
377376
* @param requestOptions Request-specific options.
378377
* @return a JSON Object in the form:
379378
* { "items": [ {"name": "contacts", "createdAt": "2013-01-18T15:33:13.556Z"},
380-
* {"name": "notes", "createdAt": "2013-01-18T15:33:13.556Z"}]}
379+
* {"name": "notes", "createdAt": "2013-01-18T15:33:13.556Z"}]}
381380
*/
382381
protected JSONObject listIndexes(@Nullable RequestOptions requestOptions) throws AlgoliaException {
383382
return getRequest("/1/indexes/", /* urlParameters: */ null, false, requestOptions);
@@ -387,7 +386,7 @@ protected JSONObject listIndexes(@Nullable RequestOptions requestOptions) throws
387386
* Delete an index
388387
*
389388
* @param requestOptions Request-specific options.
390-
* @param indexName the name of index to delete
389+
* @param indexName the name of index to delete
391390
* @return an object containing a "deletedAt" attribute
392391
*/
393392
protected JSONObject deleteIndex(String indexName, @Nullable RequestOptions requestOptions) throws AlgoliaException {
@@ -401,8 +400,8 @@ protected JSONObject deleteIndex(String indexName, @Nullable RequestOptions requ
401400
/**
402401
* Move an existing index.
403402
*
404-
* @param srcIndexName the name of index to copy.
405-
* @param dstIndexName the new index name that will contains a copy of srcIndexName (destination will be overriten if it already exist).
403+
* @param srcIndexName the name of index to copy.
404+
* @param dstIndexName the new index name that will contains a copy of srcIndexName (destination will be overriten if it already exist).
406405
* @param requestOptions Request-specific options.
407406
*/
408407
protected JSONObject moveIndex(String srcIndexName, String dstIndexName, @Nullable RequestOptions requestOptions) throws AlgoliaException {
@@ -460,7 +459,7 @@ protected JSONObject multipleQueries(List<IndexQuery> queries, String strategy,
460459
/**
461460
* Custom batch
462461
*
463-
* @param actions the array of actions
462+
* @param actions the array of actions
464463
* @param requestOptions Request-specific options.
465464
* @throws AlgoliaException if the response is not valid json
466465
*/

algoliasearch/src/test/java/com/algolia/search/saas/IndexTest.java

Lines changed: 36 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,7 @@ public void setUp() throws Exception {
133133
public void tearDown() {
134134
try {
135135
client.deleteIndex(indexName, /* requestOptions: */ null);
136-
}
137-
catch (AlgoliaException e) {
136+
} catch (AlgoliaException e) {
138137
fail(e.getMessage());
139138
}
140139
AssertCompletionHandler.checkAllHandlers();
@@ -1079,8 +1078,8 @@ public void doRequestCompleted(JSONObject content, AlgoliaException error) {
10791078
public void partialUpdateObjectsNoCreate() throws Exception {
10801079
final List<String> newIds = Arrays.asList("unknown", "none");
10811080
final JSONArray partialObjects = new JSONArray()
1082-
.put(new JSONObject().put("objectID", newIds.get(0)).put("city", "Paris"))
1083-
.put(new JSONObject().put("objectID", newIds.get(1)).put("city", "Berlin"));
1081+
.put(new JSONObject().put("objectID", newIds.get(0)).put("city", "Paris"))
1082+
.put(new JSONObject().put("objectID", newIds.get(1)).put("city", "Berlin"));
10841083

10851084
index.partialUpdateObjectsAsync(partialObjects, false, new AssertCompletionHandler() {
10861085
@Override
@@ -1139,44 +1138,44 @@ public void doRequestCompleted(JSONObject content, AlgoliaException error) {
11391138
@Test
11401139
public void searchForFacFacetValues() throws Exception {
11411140
final JSONObject setSettingsTask = index.setSettings(new JSONObject()
1142-
.put("attributesForFaceting", new JSONArray()
1143-
.put("searchable(series)")
1144-
.put("kind")),
1141+
.put("attributesForFaceting", new JSONArray()
1142+
.put("searchable(series)")
1143+
.put("kind")),
11451144
/* forwardToReplicas: */ false,
11461145
/* requestOptions: */ null
11471146
);
11481147

11491148
final JSONObject addObjectsResult = index.addObjects(new JSONArray()
1150-
.put(new JSONObject()
1151-
.put("objectID", "1")
1152-
.put("name", "Snoopy")
1153-
.put("kind", new JSONArray().put("dog").put("animal"))
1154-
.put("born", 1950)
1155-
.put("series", "Peanuts"))
1156-
.put(new JSONObject()
1157-
.put("objectID", "2")
1158-
.put("name", "Woodstock")
1159-
.put("kind", new JSONArray().put("bird").put("animal"))
1160-
.put("born", 1960)
1161-
.put("series", "Peanuts"))
1162-
.put(new JSONObject()
1163-
.put("objectID", "3")
1164-
.put("name", "Charlie Brown")
1165-
.put("kind", new JSONArray().put("human"))
1166-
.put("born", 1950)
1167-
.put("series", "Peanuts"))
1168-
.put(new JSONObject()
1169-
.put("objectID", "4")
1170-
.put("name", "Hobbes")
1171-
.put("kind", new JSONArray().put("tiger").put("animal").put("teddy"))
1172-
.put("born", 1985)
1173-
.put("series", "Calvin & Hobbes"))
1174-
.put(new JSONObject()
1175-
.put("objectID", "5")
1176-
.put("name", "Calvin")
1177-
.put("kind", new JSONArray().put("human"))
1178-
.put("born", 1985)
1179-
.put("series", "Calvin & Hobbes")),
1149+
.put(new JSONObject()
1150+
.put("objectID", "1")
1151+
.put("name", "Snoopy")
1152+
.put("kind", new JSONArray().put("dog").put("animal"))
1153+
.put("born", 1950)
1154+
.put("series", "Peanuts"))
1155+
.put(new JSONObject()
1156+
.put("objectID", "2")
1157+
.put("name", "Woodstock")
1158+
.put("kind", new JSONArray().put("bird").put("animal"))
1159+
.put("born", 1960)
1160+
.put("series", "Peanuts"))
1161+
.put(new JSONObject()
1162+
.put("objectID", "3")
1163+
.put("name", "Charlie Brown")
1164+
.put("kind", new JSONArray().put("human"))
1165+
.put("born", 1950)
1166+
.put("series", "Peanuts"))
1167+
.put(new JSONObject()
1168+
.put("objectID", "4")
1169+
.put("name", "Hobbes")
1170+
.put("kind", new JSONArray().put("tiger").put("animal").put("teddy"))
1171+
.put("born", 1985)
1172+
.put("series", "Calvin & Hobbes"))
1173+
.put(new JSONObject()
1174+
.put("objectID", "5")
1175+
.put("name", "Calvin")
1176+
.put("kind", new JSONArray().put("human"))
1177+
.put("born", 1985)
1178+
.put("series", "Calvin & Hobbes")),
11801179
/* requestOptions: */ null
11811180
);
11821181

0 commit comments

Comments
 (0)