From b10b3134dd4a846b3fba83180a3d9fb7d5bdd826 Mon Sep 17 00:00:00 2001 From: Lindsay Burton Date: Fri, 23 Jan 2026 13:53:32 -0800 Subject: [PATCH 1/4] Adding updated files --- java/.DS_Store | Bin 0 -> 6148 bytes java/README.md | 10 +- java/pom.xml | 23 ++- java/relevancy-1__top_1000_searches.json | 7 + java/relevancy-1_records.json | 9 ++ java/relevancy-1_rules.json | 25 ++++ java/relevancy-1_settings.json | 62 ++++++++ java/relevancy-1_synonyms.json | 28 ++++ java/src/.DS_Store | Bin 0 -> 6148 bytes java/src/main/.DS_Store | Bin 0 -> 6148 bytes java/src/main/java/.DS_Store | Bin 0 -> 6148 bytes java/src/main/java/Backup.java | 90 ++++++++++++ java/src/main/java/Contact.java | 5 + java/src/main/java/GenerateKey.java | 65 +++++++++ java/src/main/java/Indexing.java | 143 ++++++++++++------- java/src/main/java/RestApiReturnTopHits.java | 60 ++++++++ java/src/main/java/Restore.java | 95 ++++++++++++ java/src/main/java/Rules.java | 65 +++++++++ java/src/main/java/Settings.java | 48 +++++++ java/src/main/java/Simple.java | 33 ++--- 20 files changed, 686 insertions(+), 82 deletions(-) create mode 100644 java/.DS_Store create mode 100644 java/relevancy-1__top_1000_searches.json create mode 100644 java/relevancy-1_records.json create mode 100644 java/relevancy-1_rules.json create mode 100644 java/relevancy-1_settings.json create mode 100644 java/relevancy-1_synonyms.json create mode 100644 java/src/.DS_Store create mode 100644 java/src/main/.DS_Store create mode 100644 java/src/main/java/.DS_Store create mode 100644 java/src/main/java/Backup.java create mode 100644 java/src/main/java/GenerateKey.java create mode 100644 java/src/main/java/RestApiReturnTopHits.java create mode 100644 java/src/main/java/Restore.java create mode 100644 java/src/main/java/Rules.java create mode 100644 java/src/main/java/Settings.java diff --git a/java/.DS_Store b/java/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..0869a0b8a17b942a65e6f71ae87f67b6a5dd24f5 GIT binary patch literal 6148 zcmeHK%}*0S6n|5y-GayhE#g@*yJeU|ArB7z1eumH?LBcBw1dow~cFAR*}= zpcgM*P5c8)JbKbUK#yKM_z!sTjBh?FAH}N>voD$Xy_xsk%)H<3%A}!9d?8agbbWD2H4(>K@}+O+#xu$f2oNU zb}Z;vhW5Fj1`vlV%)%7Rz$3&Vj4O#9|0m+Zv4}SC!Gq#aFEVhlms$6#ro+ejXjUED z4~B=okw{zg-1(RiQ#zEj+*4Z51x8Twb;Da>twl;5v#A^Al5N!sYGRtYfnmFr#{=w= zg)Xa)ZMQ`0I<2`SpU38eL5VBzf_i0l_vXmN_-I-io4mW1)^;aHhtt~au{(QvaV43$ zbuU}kbSf@=$%w#14^KTVof4by3Kf~PUEGrSkT1=AzN>08qj-DAh0cpzYIjd>ccMF) zO!i&szua^6T0!kKjpAn6V=JAe4)t`WW);*fAM>3nQg^|#wlL3pU~LCE`vsbMjs;|` z(vyR(#hohpBn~?GpbtFDa#zZpU7Fw6@U0+!NMB~N6+P-W3)Hs*o4U)ZeD=Vq%()vB zXJjjwuQHRrWO+VfOH6**@I1pUTl&tLW0;mR@9H!NXeDoB7Hs8w%3Reb+HN^@|EJ(E zp32-1nhL2VtxBS)NhGOHrMFyPbg64$(1Ng}G7qJT0)zOn=3o_`Lj&HxJ9rPD;Vb-r zU$9R)Ngo*?gCtGH$pp!eDUu~CWStn~nTU@xAMtfLo&@5fA|LTq&T}2=ma&I-l*`o}Z zpw2!T7-|wT5*q^1fDMX$-A{BId<1-Sk|#HVSWvP nJOnFw9dm_U#r;^gpiN^6Vn$*^Aoiey9|D|)unHOYrwsfC7ftwH literal 0 HcmV?d00001 diff --git a/java/README.md b/java/README.md index bbcf903..3ff3d40 100644 --- a/java/README.md +++ b/java/README.md @@ -31,5 +31,11 @@ Once setup, you can run each of the script in this folder using your favorite Ja | File | Description | | ---------------------------- | -------------------------------------------- | -| [Simple.java](./src/main/java/Simple.java) | Index a single object and run a search query | -| [Indexing.java](./src/main/java/Indexing.java) | Showcase of the main indexing methods | +| [Simple.java](./src/main/java/Simple.java) | Index a single object and run a search query | +| [Indexing.java](./src/main/java/Indexing.java) | Showcase of the main indexing methods | +| [Settings.java](./src/main/java/Settings.java) | Change index settings | +| [Rules.java](./src/main/java/Rules.java) | Export rules and add a new rule to an index | +| [Backup.java](./src/main/java/Backup.java) | Backup an index | +| [Restore.java](./src/main/java/Restore.java) | Restore an index | +| [RestApiReturnTopHits.java](./src/main/java/RestApiReturnTopHits.java) | Get top 1000 searches with Analytics API Client | +| [GenerateKey.java](./src/main/java/GenerateKey.java) | Generate API key | diff --git a/java/pom.xml b/java/pom.xml index 90e1262..43fb9ca 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -21,28 +21,23 @@ - - com.algolia - algoliasearch-core - 3.0.0 - - + com.algolia - algoliasearch-apache - 3.0.0 + algoliasearch + 4.34.2 - org.asynchttpclient - async-http-client - 2.8.1 + io.github.cdimascio + dotenv-java + 3.0.0 - io.github.cdimascio - dotenv-java - 2.2.0 + com.fasterxml.jackson.core + jackson-databind + 2.17.0 diff --git a/java/relevancy-1__top_1000_searches.json b/java/relevancy-1__top_1000_searches.json new file mode 100644 index 0000000..07cfd81 --- /dev/null +++ b/java/relevancy-1__top_1000_searches.json @@ -0,0 +1,7 @@ +{ + "searches" : [ { + "search" : "", + "count" : 7, + "nbHits" : 1 + } ] +} \ No newline at end of file diff --git a/java/relevancy-1_records.json b/java/relevancy-1_records.json new file mode 100644 index 0000000..5961cc0 --- /dev/null +++ b/java/relevancy-1_records.json @@ -0,0 +1,9 @@ +[ { + "objectID" : "1", + "_highlightResult" : null, + "_snippetResult" : null, + "_rankingInfo" : null, + "_distinctSeqID" : null, + "name" : "Foo", + "email" : "" +} ] \ No newline at end of file diff --git a/java/relevancy-1_rules.json b/java/relevancy-1_rules.json new file mode 100644 index 0000000..ed4ce25 --- /dev/null +++ b/java/relevancy-1_rules.json @@ -0,0 +1,25 @@ +[ { + "objectID" : "a-rule-id", + "conditions" : [ { + "pattern" : "flower", + "anchoring" : "contains", + "alternatives" : null, + "context" : null, + "filters" : null + } ], + "consequence" : { + "params" : null, + "promote" : [ { + "objectID" : "439957720", + "position" : 0 + } ], + "filterPromotes" : null, + "hide" : null, + "userData" : null + }, + "description" : null, + "enabled" : null, + "validity" : null, + "tags" : null, + "scope" : null +} ] \ No newline at end of file diff --git a/java/relevancy-1_settings.json b/java/relevancy-1_settings.json new file mode 100644 index 0000000..7e12d16 --- /dev/null +++ b/java/relevancy-1_settings.json @@ -0,0 +1,62 @@ +{ + "attributesForFaceting" : [ "name" ], + "replicas" : null, + "paginationLimitedTo" : 1000, + "unretrievableAttributes" : null, + "disableTypoToleranceOnWords" : null, + "attributesToTransliterate" : null, + "camelCaseAttributes" : null, + "decompoundedAttributes" : null, + "indexLanguages" : null, + "disablePrefixOnAttributes" : null, + "allowCompressionOfIntegerArray" : null, + "numericAttributesForFiltering" : null, + "separatorsToIndex" : "", + "searchableAttributes" : [ "actors", "genre" ], + "userData" : null, + "customNormalization" : null, + "attributeForDistinct" : null, + "maxFacetHits" : null, + "keepDiacriticsOnCharacters" : null, + "customRanking" : [ "desc(rating)" ], + "attributesToRetrieve" : null, + "ranking" : [ "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom" ], + "relevancyStrictness" : null, + "attributesToHighlight" : null, + "attributesToSnippet" : null, + "highlightPreTag" : "", + "highlightPostTag" : "", + "snippetEllipsisText" : null, + "restrictHighlightAndSnippetArrays" : null, + "hitsPerPage" : 20, + "minWordSizefor1Typo" : 5, + "minWordSizefor2Typos" : 8, + "typoTolerance" : "true", + "allowTyposOnNumericTokens" : null, + "disableTypoToleranceOnAttributes" : null, + "ignorePlurals" : false, + "removeStopWords" : false, + "queryLanguages" : null, + "decompoundQuery" : null, + "enableRules" : null, + "enablePersonalization" : null, + "queryType" : "prefixLast", + "removeWordsIfNoResults" : "none", + "mode" : null, + "semanticSearch" : null, + "advancedSyntax" : null, + "optionalWords" : null, + "disableExactOnAttributes" : null, + "exactOnSingleWordQuery" : "attribute", + "alternativesAsExact" : [ "ignorePlurals", "singleWordSynonym" ], + "advancedSyntaxFeatures" : null, + "distinct" : false, + "replaceSynonymsInHighlight" : null, + "minProximity" : null, + "responseFields" : null, + "maxValuesPerFacet" : 100, + "sortFacetValuesBy" : null, + "attributeCriteriaComputedByMinProximity" : null, + "renderingContent" : null, + "enableReRanking" : null +} \ No newline at end of file diff --git a/java/relevancy-1_synonyms.json b/java/relevancy-1_synonyms.json new file mode 100644 index 0000000..b35efbf --- /dev/null +++ b/java/relevancy-1_synonyms.json @@ -0,0 +1,28 @@ +[ { + "objectID" : "syn-1764984393671-13", + "type" : "synonym", + "synonyms" : [ "sequel", "2" ], + "input" : null, + "word" : null, + "corrections" : null, + "placeholder" : null, + "replacements" : null +}, { + "objectID" : "_settings_syn_2", + "type" : "synonym", + "synonyms" : [ "sequel", "2" ], + "input" : null, + "word" : null, + "corrections" : null, + "placeholder" : null, + "replacements" : null +}, { + "objectID" : "_settings_syn_1", + "type" : "synonym", + "synonyms" : [ "sequel", "2" ], + "input" : null, + "word" : null, + "corrections" : null, + "placeholder" : null, + "replacements" : null +} ] \ No newline at end of file diff --git a/java/src/.DS_Store b/java/src/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..a9d14d18ec85c22f65ded23f3d8d941fb971c793 GIT binary patch literal 6148 zcmeHKO;6N77@ika>4HdsUBs_s<6cZyl@Ae#2TQ>i;sHVlE&*KH-Lh7?Gi%#rMMAPa zK+j%H`~luQ=?~DOR}cOHFP`z8kAi^4n=#TinR(uMKW6$q&2&115HK5+5khoAh=z@0 zsuR0k2>0`LOxlzsg$R6(S)Y|1pE)?@6DE={kTCFXGr;$5iqwcrJVKA`UlV=T_k@Td z_T!vpSXcY}om2O{Fd82I3~lYHQ>Qz$4y{XDvmUdi71>cEH0@x8j}{s8omjV>CC_b^ z^vpD)k?m185D8wz#gNs99<8vZ$r`j0id;)Nw6vBk=@)i(u8mBLj}~%clec#Zxt+<; z;X>}_*sa~&w3f}^xU*2&^lOy8ki-LinS^vJjNv6J`xSZREmaYGj4S%0>v2u#&aN}v zXM6PCzW&}!Z#J79I5&8{@8YGB-tXAu&1%4(b(;AsF#U#G(tARzc(%;weBf?jrNzj7 z7FphNboCucSa2(k4or*Nb&Saz7{sLa1J|W1)xfLFZES>YRQyR_=Bt$h=KJ$3^dgVZ zeUUQiV$!_y9(2P1T!A4dz&K2R0aLI5E3ghWJdycr@k_p}=2HM6D*G>a%L=H^ zXccX7{NeBuHc}*LT_>#Wq}+sogn>UZz`qYUY#a@REs5gOft|PlAoAY`A*hRAf5aR& zAQ}o=648PJG8Iv#g1TaWx;cPMN57%sTM}hD0kJa9qgDoWLjiU1fSd>?U`R~*gn@*C z!wj^`q0Z0$d$@;xbN@e_l#CJv5(fS&1|T(K&6rq{I$Mtw$IsdvwsmY=cw9@ONWo4W i$3o#p@gO!K=*w{h(NNfuh!&LOM?lb!bO{50m4P1t6Vu56 literal 0 HcmV?d00001 diff --git a/java/src/main/.DS_Store b/java/src/main/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..2b800012979f62f605896b3edc846cf06663de17 GIT binary patch literal 6148 zcmeHKO;6N77@ika>4HdsUBs_s<6cZyl@Ae#2TQ>i;sHVlE&*KH-Le+S%-VK$MMAPa zK+j%H`~luQ=?~DOR}cOHFP`0`LOxlzsg$R6(S)Y|1pE)?@6DE={kTCFXGr;$5ifj^_G>Cm<|C;E#{#}SD zVn5DlhBdX%-#Rtl3!~xTPtew$I(523>(IKiHR~~JT9F;qL(>jc_-K(a--&hGS@PUw zNzY6(8rdFo1CiiWTnt%#=+O#mnygMMp~$tQLrZJvl73-#_u9zB_-G+FHhFumklURc z9WLZHUsf-l_)tS*MxL0@JU%CA}xaif7A=&IfJ-D=kLu z)5!9kp{wsm!h&0QbYNQCsbNg!z#t~QAGj`EsRmwUZet^KqvB8cGGDD6FyEhNp%;0K zF0YE!BX@h2ZZKStKfzp$yTTN`3~JM09RlL3NQ{6V89eCzzVE`4VyB*Eq=+D)qDydL}mXaH>`mA zj8@SW#~%(qVIxI?)^)<_PRdOfNErAt1N{4t!^Y82*petd9oUI003!d55Q4h+^+(Kc z1EQg@B@rzsAX5=#DyS<4sG9@Gbo3i4z9mtn6A&xoJZfc7Hxy7856Fpd0*1t-PZ&rT zILtu19P0f1zlVGHH~0U;Ny#W-AYtIYVgOPz){KcIsk8N1ar~^!VOz(>g~zodiWKbB jaV!*m6c1t(g1#JA5DkSbiD*Gdegp&!NtZD2R~h&L9t+dG literal 0 HcmV?d00001 diff --git a/java/src/main/java/.DS_Store b/java/src/main/java/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..3fa7933f7f1bcc5b9917b6143e77abd7101389b2 GIT binary patch literal 6148 zcmeHKOHRWu5Pc3sDiowHSw85^1%gD2Smq2Ig$u$P&!{2^*&*B0y1}J zxJHd<&fL%WdqcUX>eaHUm&}m`lGA5j(O3h{u^?-W4c_s<+P%$upZVEgp5hieRAjym zaS~Zw?a>P6Z~4=)2AScq!R-0aw5kI8X(+XN!#|ie9<` zu7E4BS3tfGDP1r#Y!u_CgM}Q@q<VPpmfGl%gYQK zMWrLek@*}OIoJ&)#L*c~V>&{n=%p**3bYkC(&kk5|C{0af1BhjSHKlGCxF>_@rzMw~AJe3MDGi($Yq4_}|%HV}7@TUrV18)6P AB>(^b literal 0 HcmV?d00001 diff --git a/java/src/main/java/Backup.java b/java/src/main/java/Backup.java new file mode 100644 index 0000000..44644d9 --- /dev/null +++ b/java/src/main/java/Backup.java @@ -0,0 +1,90 @@ +import java.io.File; +import java.io.IOException; +import java.util.concurrent.ExecutionException; + +import com.algolia.api.SearchClient; +import com.algolia.model.search.*; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.databind.node.ObjectNode; + +import io.github.cdimascio.dotenv.Dotenv; + +public class Backup { + + public static void main(String[] args) throws ExecutionException, InterruptedException, IOException { + Backup.run(); + } + + public static void run() throws ExecutionException, InterruptedException, IOException { + + Dotenv dotenv = Dotenv.configure().load(); + + String appID = dotenv.get("ALGOLIA_APP_ID"); + String apiKey = dotenv.get("ALGOLIA_API_KEY"); + String indexName = dotenv.get("ALGOLIA_INDEX_NAME"); + + // Start the API client + // https://www.algolia.com/doc/libraries/sdk/methods/search#java + try (SearchClient client = new SearchClient(appID, apiKey)) { + + // Initialize ObjectMapper + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.enable(SerializationFeature.INDENT_OUTPUT); + + // Get all records from an index + // https://www.algolia.com/doc/api-reference/api-methods/browse/#get-all-records-from-an-index + // Use an API key with `browse` ACL + BrowseResponse respRecords = client.browse(indexName, Hit.class); + + // Write records to file + File recordsFile = new File(indexName + "_records.json"); + objectMapper.writeValue(recordsFile, respRecords.getHits()); + + // Retrieve settings for an index + // https://www.algolia.com/doc/api-reference/api-methods/get-settings/#retrieve-settings-for-an-index + + // Export settings + SettingsResponse respSettings = client.getSettings(indexName, 2); + + // Write settings to file + File settingsFile = new File(indexName + "_settings.json"); + objectMapper.writeValue(settingsFile, respSettings); + + // The following settings will export as null if the default value is used and the setting hasn't been modified + // typoTolerance, ignorePlurals, removeStopWords, distinct, reRankingApplyFilter, primary + // Remove these settings if the values are null to prevent errors while restoring + + //Get the file + ObjectNode settingsFileContent = (ObjectNode) objectMapper.readTree(settingsFile); + + // Create array of settings + String[] settingsValues = {"typoTolerance", "ignorePlurals", "removeStopWords", "distinct", "reRankingApplyFilter", "primary"}; + + for (int i = 0; i < settingsValues.length; i++) { + if (settingsFileContent.has(settingsValues[i]) && settingsFileContent.get(settingsValues[i]).isNull()) { + settingsFileContent.remove(settingsValues[i]); + } + } + + objectMapper.writeValue(settingsFile, settingsFileContent); + + // Export rules + // https://www.algolia.com/doc/api-reference/api-methods/export-rules/ + Iterable respRules = client.browseRules(indexName, new SearchRulesParams()); + + // Transform rules iterator to Array and then to JSON + File rulesFile = new File(indexName + "_rules.json"); + objectMapper.writeValue(rulesFile, respRules); + + // Export synonyms + // https://www.algolia.com/doc/api-reference/api-methods/export-synonyms/ + Iterable respSynonyms = client.browseSynonyms(indexName, new SearchSynonymsParams()); + + // Transform synonyms iterator to Array and then to JSON + File synonymsFile = new File(indexName + "_synonyms.json"); + objectMapper.writeValue(synonymsFile, respSynonyms); + + } + } +} diff --git a/java/src/main/java/Contact.java b/java/src/main/java/Contact.java index fc48bb5..4bcc262 100644 --- a/java/src/main/java/Contact.java +++ b/java/src/main/java/Contact.java @@ -33,6 +33,11 @@ public Contact setEmail(String email) { return this; } + public Contact setObjectID(String objectID) { + this.objectID = objectID; + return this; + } + public String getObjectID() { return objectID; } diff --git a/java/src/main/java/GenerateKey.java b/java/src/main/java/GenerateKey.java new file mode 100644 index 0000000..3760276 --- /dev/null +++ b/java/src/main/java/GenerateKey.java @@ -0,0 +1,65 @@ +import java.io.IOException; +import java.util.Arrays; +import java.util.concurrent.ExecutionException; + +import com.algolia.api.SearchClient; +import com.algolia.model.search.*; + +import io.github.cdimascio.dotenv.Dotenv; + +public class GenerateKey { + + public static void main(String[] args) throws ExecutionException, InterruptedException, IOException { + GenerateKey.run(); + } + + public static void run() throws ExecutionException, InterruptedException, IOException { + + Dotenv dotenv = Dotenv.configure().load(); + + String appID = dotenv.get("ALGOLIA_APP_ID"); + String apiKey = dotenv.get("ALGOLIA_API_KEY"); + String indexName = dotenv.get("ALGOLIA_INDEX_NAME"); + + // Start the API client + // https://www.algolia.com/doc/libraries/sdk/methods/search#java + try (SearchClient client = new SearchClient(appID, apiKey)) { + + // Create a new restricted search-only API key + AddApiKeyResponse apiKeyResp = client.addApiKey( + new ApiKey() + .setAcl(Arrays.asList(Acl.SEARCH, Acl.ADD_OBJECT)) + .setDescription("Restricted search-only API key for algolia.com") + .setMaxQueriesPerIPPerHour(100) + ); + + client.waitForApiKey(apiKeyResp.getKey(), ApiKeyOperation.ADD); + + // Make sure new key has been created + String newKey = apiKeyResp.getKey(); + + if (newKey == apiKeyResp.getKey()) { + System.out.println("Key generated successfully: " + newKey); + } else { + System.out.println("Error while creating key\n"); + } + + // Test the created key + System.out.println("Testing key"); + + // Initialise a new client with the generated key + SearchClient newClient = new SearchClient(appID, newKey); + + // Test the new generated key by performing a search + try { + SearchResponse newKeySearchResp = newClient.searchSingleIndex(indexName, Hit.class); + System.out.println(newKeySearchResp.getHits()); + } + catch(Exception e) { + System.out.println("Failed search with the new key\n"); + } + + newClient.close(); + } + } +} \ No newline at end of file diff --git a/java/src/main/java/Indexing.java b/java/src/main/java/Indexing.java index 01e6277..97e773d 100644 --- a/java/src/main/java/Indexing.java +++ b/java/src/main/java/Indexing.java @@ -1,19 +1,14 @@ -import com.algolia.search.*; -import com.algolia.search.models.indexing.BatchIndexingResponse; -import com.algolia.search.models.indexing.Query; -import com.algolia.search.models.indexing.SearchResult; -import com.algolia.search.models.settings.IndexSettings; -import com.algolia.search.models.indexing.BatchOperation; -import com.algolia.search.models.indexing.BatchRequest; -import com.algolia.search.models.indexing.ActionEnum; import java.io.IOException; -import java.lang.StackWalker.Option; -import java.util.List; import java.util.Arrays; +import java.util.List; import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; + +import com.algolia.api.SearchClient; +import com.algolia.model.search.*; + import io.github.cdimascio.dotenv.Dotenv; public class Indexing { @@ -26,14 +21,13 @@ public static void run() throws ExecutionException, InterruptedException, IOExce Dotenv dotenv = Dotenv.configure().load(); - // Start the API client - // https://www.algolia.com/doc/api-client/getting-started/instantiate-client-index/ - try (SearchClient searchClient = - DefaultSearchClient.create(dotenv.get("ALGOLIA_APP_ID"), dotenv.get("ALGOLIA_API_KEY"))) { + String appID = dotenv.get("ALGOLIA_APP_ID"); + String apiKey = dotenv.get("ALGOLIA_API_KEY"); + String indexName = dotenv.get("ALGOLIA_INDEX_NAME"); - // Create an index (or connect to it, if an index with the name `ALGOLIA_INDEX_NAME` already exists) - // https://www.algolia.com/doc/api-client/getting-started/instantiate-client-index/#initialize-an-index - SearchIndex index = searchClient.initIndex(dotenv.get("ALGOLIA_INDEX_NAME"), Contact.class); + // Start the API client + // https://www.algolia.com/doc/libraries/sdk/methods/search#java + try (SearchClient client = new SearchClient(appID, apiKey)) { // Define some objects to add to our index // https://www.algolia.com/doc/api-client/methods/indexing/#object-and-record @@ -43,43 +37,57 @@ public static void run() throws ExecutionException, InterruptedException, IOExce ); // We don't have any objects (yet) in our index - SearchResult searchResults = index.search(new Query("")); - System.out.println("Current objects: " + searchResults.getHits()); + CompletableFuture> searchResults = client.searchSingleIndexAsync(indexName, Hit.class); + System.out.println("Current objects: " + searchResults.get().getHits()); // Save Objects: Add mutliple new objects to an index. // https://www.algolia.com/doc/api-reference/api-methods/add-objects/?client=java System.out.println("Save Objects - Adding multiple objects: " + contacts); - index.saveObjects(contacts, true).waitTask(); - - searchResults = index.search(new Query("")); - System.out.println("Current objects: " + searchResults.getHits()); + + List saveObjects = client.saveObjects(indexName,contacts); + + client.waitForTask(indexName, saveObjects.get(0).getTaskID()); + + searchResults = client.searchSingleIndexAsync(indexName, Hit.class); + System.out.println("Current objects: " + searchResults.get().getHits()); // Save Objects: Replace an existing object with an updated set of attributes. // https://www.algolia.com/doc/api-reference/api-methods/save-objects/?client=java System.out.println("Save Objects - Replacing objects’s attributes on: " + contacts.get(0)); Contact firstContact = contacts.get(0).setName("FooBar"); - index.saveObject(firstContact).waitTask(); + SaveObjectResponse saveObj = client.saveObject(indexName,firstContact); + + client.waitForTask(indexName, saveObj.getTaskID()); - searchResults = index.search(new Query("")); - System.out.println("Current objects: " + searchResults.getHits()); + searchResults = client.searchSingleIndexAsync(indexName, Hit.class); + System.out.println("Current objects: " + searchResults.get().getHits()); // Partial Update Objects: Update one or more attributes of an existing object. // https://www.algolia.com/doc/api-reference/api-methods/partial-update-objects/?client=java System.out.println("Save Objects - Updating object’s attributes on: " + contacts.get(0)); firstContact.setEmail("test@test.com"); - index.partialUpdateObject(firstContact).waitTask(); - searchResults = index.search(new Query("")); - System.out.println("Current objects: " + searchResults.getHits()); + UpdatedAtWithObjectIdResponse partialUpdateResp = client.partialUpdateObject( + indexName, + firstContact.getObjectID(), + firstContact + ); + + client.waitForTask(indexName, partialUpdateResp.getTaskID()); + + searchResults = client.searchSingleIndexAsync(indexName, Hit.class); + System.out.println("Current objects: " + searchResults.get().getHits()); // Delete Objects: Remove objects from an index using their objectID. // https://www.algolia.com/doc/api-reference/api-methods/delete-objects/?client=java String objectIDToDelete = contacts.get(0).getObjectID(); System.out.println("Delete Objects - Deleting object with objectID: " + objectIDToDelete); - index.deleteObject(objectIDToDelete).waitTask(); + List deleteObjResp = client.deleteObjects(indexName, Arrays.asList(objectIDToDelete)); + + client.waitForTask(indexName, deleteObjResp.get(0).getTaskID()); - searchResults = index.search(new Query("")); - System.out.println("Current objects: " + searchResults.getHits()); + searchResults = client.searchSingleIndexAsync(indexName, Hit.class); + System.out.println("Current objects: " + searchResults.get().getHits()); // Replace All Objects: Clears all objects from your index and replaces them with a new set of objects. // https://www.algolia.com/doc/api-reference/api-methods/replace-all-objects/?client=java @@ -88,10 +96,17 @@ public static void run() throws ExecutionException, InterruptedException, IOExce new Contact("4", "NewBar", Optional.empty()) ); System.out.println("Replace All Objects - Clears all objects and replaces them with: " + newContacts); - index.replaceAllObjects(newContacts, true); + ReplaceAllObjectsResponse replaceAllObjResp = client.replaceAllObjects( + indexName, + newContacts, + 2, + Arrays.asList(ScopeType.SETTINGS, ScopeType.SYNONYMS) + ); + + client.waitForTask(indexName, replaceAllObjResp.getBatchResponses().get(0).getTaskID()); - searchResults = index.search(new Query("")); - System.out.println("Current objects: " + searchResults.getHits()); + searchResults = client.searchSingleIndexAsync(indexName, Hit.class); + System.out.println("Current objects: " + searchResults.get().getHits()); // Delete By: Remove all objects matching a filter (including geo filters). // https://www.algolia.com/doc/api-reference/api-methods/delete-by/?client=java @@ -101,41 +116,69 @@ public static void run() throws ExecutionException, InterruptedException, IOExce // https://www.algolia.com/doc/api-client/methods/settings/?client=java IndexSettings settings = new IndexSettings(); settings.setAttributesForFaceting(Arrays.asList("name")); - index.setSettings(settings).waitTask(); + + UpdatedAtResponse response = client.setSettings( + indexName, + settings, + true + ); + + client.waitForTask(indexName, response.getTaskID()); // Now delete the records matching "name=NewBar" - index.deleteBy(new Query("").setFacetFilters(Arrays.asList(Arrays.asList("name:NewBar")))); + response = client.deleteBy(indexName, new DeleteByParams().setFilters("name:NewBar")); + + client.waitForTask(indexName, response.getTaskID()); - searchResults = index.search(new Query("")); - System.out.println("Current objects: " + searchResults.getHits()); + searchResults = client.searchSingleIndexAsync(indexName, Hit.class); + System.out.println("Current objects: " + searchResults.get().getHits()); // Get Objects: Get one or more objects using their objectIDs. // https://www.algolia.com/doc/api-reference/api-methods/get-objects/?client=java String objectIDToRetrieve = newContacts.get(0).getObjectID(); System.out.println("Get Objects - Getting object with objectID: " + objectIDToRetrieve); - Contact contact = index.getObject(objectIDToRetrieve); - System.out.println("Result: " + contact); + Object getObjResp = client.getObject(indexName, objectIDToRetrieve); + System.out.println("Result: " + getObjResp); // Custom Batch: Perform several indexing operations in one API call. // https://www.algolia.com/doc/api-reference/api-methods/batch/?client=java - List> operations = Arrays.asList( - new BatchOperation<>(dotenv.get("ALGOLIA_INDEX_NAME"), ActionEnum.ADD_OBJECT, new Contact("3", "BatchedBar", Optional.empty())), - new BatchOperation<>(dotenv.get("ALGOLIA_INDEX_NAME"), ActionEnum.UPDATE_OBJECT, new Contact("4", "BatchedFoo", Optional.empty())) + BatchWriteParams operations = new BatchWriteParams().setRequests( + Arrays.asList( + new BatchRequest() + .setAction(Action.ADD_OBJECT) + .setBody( + new Contact("3", "BatchedBar", Optional.empty()) + ), + new BatchRequest() + .setAction(Action.ADD_OBJECT) + .setBody( + new Contact("4", "BatchedFoo", Optional.empty()) + ) + ) + ); + + BatchResponse batchResp = client.batch( + indexName, + operations ); + System.out.println("Custom Batch"); - searchClient.multipleBatch(operations).waitTask(); + client.waitForTask(indexName, batchResp.getTaskID()); - searchResults = index.search(new Query("")); - System.out.println("Current objects: " + searchResults.getHits()); + searchResults = client.searchSingleIndexAsync(indexName, Hit.class); + System.out.println("Current objects: " + searchResults.get().getHits()); // Clear Objects: Clear the records of an index without affecting its settings. // https://www.algolia.com/doc/api-reference/api-methods/clear-objects/?client=java System.out.println("Clear objects"); - index.clearObjects().waitTask(); + response = client.clearObjects(indexName); + + client.waitForTask(indexName, response.getTaskID()); - searchResults = index.search(new Query("")); - System.out.println("Current objects: " + searchResults.getHits()); + searchResults = client.searchSingleIndexAsync(indexName, Hit.class); + System.out.println("Current objects: " + searchResults.get().getHits()); + } } } \ No newline at end of file diff --git a/java/src/main/java/RestApiReturnTopHits.java b/java/src/main/java/RestApiReturnTopHits.java new file mode 100644 index 0000000..135e66f --- /dev/null +++ b/java/src/main/java/RestApiReturnTopHits.java @@ -0,0 +1,60 @@ +import java.io.File; +import java.io.IOException; +import java.util.concurrent.ExecutionException; + +import com.algolia.api.AnalyticsClient; +import com.algolia.config.*; +import com.algolia.model.analytics.GetTopSearchesResponse; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +import io.github.cdimascio.dotenv.Dotenv; + +public class RestApiReturnTopHits { + + public static void main(String[] args) throws ExecutionException, InterruptedException, IOException { + RestApiReturnTopHits.run(); + } + + public static void run() throws ExecutionException, InterruptedException, IOException { + + Dotenv dotenv = Dotenv.configure().load(); + + // Pick a region for your analytics + // us for the United States or de for Europe + + String appID = dotenv.get("ALGOLIA_APP_ID"); + String apiKey = dotenv.get("ALGOLIA_API_KEY"); + String indexName = dotenv.get("ALGOLIA_INDEX_NAME"); + String analyticsRegion = "us"; + + // Start the API client + // https://www.algolia.com/doc/libraries/sdk/methods/analytics + // Initialize the client with your application region, eg. analytics.ALGOLIA_APPLICATION_REGION + try (AnalyticsClient client = new AnalyticsClient(appID, apiKey, analyticsRegion)) { + // Initialize ObjectMapper + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.enable(SerializationFeature.INDENT_OUTPUT); + + RequestOptions options = new RequestOptions(); + options.addExtraQueryParameters("limit",1000); + GetTopSearchesResponse topSearchResp = client.getTopSearches( + indexName, + null, // clickAnalytics + null, // revenueAnalytics + null, // startDate + null, // endDate + null, // orderBy + null, // direction + 1000, + null, + null // tags + ); + + System.out.println(topSearchResp); + + File recordsFile = new File(indexName + "__top_1000_searches.json"); + objectMapper.writeValue(recordsFile, topSearchResp); + } + } +} \ No newline at end of file diff --git a/java/src/main/java/Restore.java b/java/src/main/java/Restore.java new file mode 100644 index 0000000..801c6ab --- /dev/null +++ b/java/src/main/java/Restore.java @@ -0,0 +1,95 @@ +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.ExecutionException; + +import com.algolia.api.SearchClient; +import com.algolia.model.search.*; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; + +import io.github.cdimascio.dotenv.Dotenv; + +public class Restore { + + public static void main(String[] args) throws ExecutionException, InterruptedException, IOException { + Restore.run(); + } + + public static void run() throws ExecutionException, InterruptedException, IOException { + + Dotenv dotenv = Dotenv.configure().load(); + + String appID = dotenv.get("ALGOLIA_APP_ID"); + String apiKey = dotenv.get("ALGOLIA_API_KEY"); + String indexName = dotenv.get("ALGOLIA_INDEX_NAME"); + + // Start the API client + // https://www.algolia.com/doc/libraries/sdk/methods/search#java + try (SearchClient client = new SearchClient(appID, apiKey)) { + + ObjectMapper objectMapper = new ObjectMapper(); + + // Restoring all records with replace all objects method + // https://www.algolia.com/doc/api-reference/api-methods/replace-all-objects/ + + // Read json file + Iterable recordsList = objectMapper.readValue(new FileInputStream(indexName + "_records.json"), new TypeReference>() {}); + + // Restore Records + client.replaceAllObjects( + indexName, + recordsList, + 77, + Arrays.asList(ScopeType.SETTINGS, ScopeType.SYNONYMS) + ); + + // Restoring settings with set settings method + // https://www.algolia.com/doc/api-reference/api-methods/set-settings/ + + // Read json file + IndexSettings settings = objectMapper.readValue(new File(indexName + "_settings.json"), IndexSettings.class); + + // Restore settings + client.setSettings( + indexName, + settings, + true + ); + + // Restoring Rules with replace all rules method + // https://www.algolia.com/doc/api-reference/api-methods/replace-all-rules/ + + // Read json file + List rulesList = objectMapper.readValue(new FileInputStream(indexName + "_rules.json"), new TypeReference>() {}); + + // Restore Rules + UpdatedAtResponse rulesResp = client.saveRules( + indexName, + rulesList, + true, + false + ); + + client.waitForTask(indexName, rulesResp.getTaskID()); + + // Restoring Synonyms with replace all synonyms method + // https://www.algolia.com/doc/api-reference/api-methods/replace-all-synonyms/?client=php + + // Read json file + List synonymsList = objectMapper.readValue(new FileInputStream(indexName + "_synonyms.json"), new TypeReference>() {}); + + // Restore Synonyms + UpdatedAtResponse synonymsResp = client.saveSynonyms( + indexName, + synonymsList, + true, + true + ); + + client.waitForTask(indexName, synonymsResp.getTaskID()); + } + } +} \ No newline at end of file diff --git a/java/src/main/java/Rules.java b/java/src/main/java/Rules.java new file mode 100644 index 0000000..c7c8f96 --- /dev/null +++ b/java/src/main/java/Rules.java @@ -0,0 +1,65 @@ +import java.io.IOException; +import java.util.Arrays; +import java.util.concurrent.ExecutionException; + +import com.algolia.api.SearchClient; +import com.algolia.model.search.*; + +import io.github.cdimascio.dotenv.Dotenv; + +public class Rules { + + public static void main(String[] args) throws ExecutionException, InterruptedException, IOException { + Rules.run(); + } + + public static void run() throws ExecutionException, InterruptedException, IOException { + + Dotenv dotenv = Dotenv.configure().load(); + + String appID = dotenv.get("ALGOLIA_APP_ID"); + String apiKey = dotenv.get("ALGOLIA_API_KEY"); + String indexName = dotenv.get("ALGOLIA_INDEX_NAME"); + + // Start the API client + // https://www.algolia.com/doc/libraries/sdk/methods/search#java + try (SearchClient client = new SearchClient(appID, apiKey)) { + // Exporting the rules + // https://www.algolia.com/doc/api-reference/api-methods/export-rules/#examples + System.out.println("Original rules:\n"); + Iterable response = client.browseRules(indexName, new SearchRulesParams()); + + for (Rule rule : response) { + System.out.println("- Rule: " + rule.getObjectID()); + } + + String ruleID = "a-rule-id"; + + Rule newRule = new Rule() + .setObjectID(ruleID) + .setConditions(Arrays.asList(new Condition().setPattern("flower").setAnchoring(Anchoring.CONTAINS))) + .setConsequence(new Consequence().setPromote(Arrays.asList(new PromoteObjectID().setObjectID("439957720").setPosition(0)))); + + // Adding a new rule + // https://www.algolia.com/doc/api-reference/api-methods/save-rule/#save-a-rule + UpdatedAtResponse saveRuleResp = client.saveRule( + indexName, + ruleID, + newRule + ); + + client.waitForTask(indexName, saveRuleResp.getTaskID()); + + // Exporting the modified rules + // https://www.algolia.com/doc/api-reference/api-methods/export-rules/#examples + System.out.println("Updated rules:\n"); + response = client.browseRules(indexName, new SearchRulesParams()); + + for (Rule rule : response) { + System.out.println("- Rule: " + rule.getObjectID()); + } + + client.close(); + } + } +} diff --git a/java/src/main/java/Settings.java b/java/src/main/java/Settings.java new file mode 100644 index 0000000..66dc0ca --- /dev/null +++ b/java/src/main/java/Settings.java @@ -0,0 +1,48 @@ +import java.io.IOException; +import java.util.Arrays; +import java.util.concurrent.ExecutionException; + +import com.algolia.api.SearchClient; +import com.algolia.model.search.*; + +import io.github.cdimascio.dotenv.Dotenv; + +public class Settings { + + public static void main(String[] args) throws ExecutionException, InterruptedException, IOException { + Settings.run(); + } + + public static void run() throws ExecutionException, InterruptedException, IOException { + + Dotenv dotenv = Dotenv.configure().load(); + + String appID = dotenv.get("ALGOLIA_APP_ID"); + String apiKey = dotenv.get("ALGOLIA_API_KEY"); + String indexName = dotenv.get("ALGOLIA_INDEX_NAME"); + + // Start the API client + // https://www.algolia.com/doc/libraries/sdk/methods/search#java + try (SearchClient client = new SearchClient(appID, apiKey)) { + // Set index settings + // https://www.algolia.com/doc/api-reference/api-methods/set-settings/ + IndexSettings settings = new IndexSettings(); + settings.setSearchableAttributes(Arrays.asList("actors","genre")).setCustomRanking(Arrays.asList("desc(rating)")); + + UpdatedAtResponse response = client.setSettings( + indexName, + settings, + true + ); + + client.waitForTask(indexName, response.getTaskID()); + + // Printing settings + // https://www.algolia.com/doc/api-reference/api-methods/get-settings/ + SettingsResponse settingsResp = client.getSettings(indexName, 2); + + // print the response + System.out.println(settingsResp); + } + } +} diff --git a/java/src/main/java/Simple.java b/java/src/main/java/Simple.java index e0dc159..609eef7 100644 --- a/java/src/main/java/Simple.java +++ b/java/src/main/java/Simple.java @@ -1,8 +1,7 @@ -import com.algolia.search.*; -import com.algolia.search.models.indexing.BatchIndexingResponse; -import com.algolia.search.models.indexing.Query; -import com.algolia.search.models.indexing.SearchResult; +import com.algolia.api.SearchClient; +import com.algolia.model.search.*; import java.io.IOException; +import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import io.github.cdimascio.dotenv.Dotenv; @@ -17,30 +16,32 @@ public static void run() throws ExecutionException, InterruptedException, IOExce Dotenv dotenv = Dotenv.configure().load(); + String appID = dotenv.get("ALGOLIA_APP_ID"); + String apiKey = dotenv.get("ALGOLIA_API_KEY"); + String indexName = dotenv.get("ALGOLIA_INDEX_NAME"); + // Start the API client // https://www.algolia.com/doc/api-client/getting-started/instantiate-client-index/ - try (SearchClient searchClient = - DefaultSearchClient.create(dotenv.get("ALGOLIA_APP_ID"), dotenv.get("ALGOLIA_API_KEY"))) { + try (SearchClient client = new SearchClient(appID, apiKey)) { - // Create an index (or connect to it, if an index with the name `ALGOLIA_INDEX_NAME` already exists) - // https://www.algolia.com/doc/api-client/getting-started/instantiate-client-index/#initialize-an-index - SearchIndex index = searchClient.initIndex(dotenv.get("ALGOLIA_INDEX_NAME"), Contact.class); - // Add new objects to the index // https://www.algolia.com/doc/api-reference/api-methods/add-objects/ - Contact contact = new Contact("1", "Foo", null); - CompletableFuture indexingFuture = index.saveObjectAsync(contact, true); + Contact contact = new Contact("1", "Foo", Optional.empty()); + + SaveObjectResponse saveResp = client.saveObject( + indexName, + contact + ); // Wait for the indexing task to complete // https://www.algolia.com/doc/api-reference/api-methods/wait-task/ - indexingFuture.get(); + client.waitForTask(indexName, saveResp.getTaskID()); // Search the index for "Fo" // https://www.algolia.com/doc/api-reference/api-methods/search/ - CompletableFuture> searchAlgoliaFuture = - index.searchAsync(new Query("Foo")); + CompletableFuture> respSearch = client.searchSingleIndexAsync(indexName, Hit.class); - System.out.println("Search results:" + searchAlgoliaFuture.get().getHits()); + System.out.println("Search results:" + respSearch.get().getHits()); } } } \ No newline at end of file From e1441f61939aa5a7e6037b4e1a4e06c35a572477 Mon Sep 17 00:00:00 2001 From: Lindsay Burton Date: Fri, 23 Jan 2026 13:58:35 -0800 Subject: [PATCH 2/4] Updating the name of the Analytics quickstart file --- .../java/{RestApiReturnTopHits.java => ReturnTopHits.java} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename java/src/main/java/{RestApiReturnTopHits.java => ReturnTopHits.java} (96%) diff --git a/java/src/main/java/RestApiReturnTopHits.java b/java/src/main/java/ReturnTopHits.java similarity index 96% rename from java/src/main/java/RestApiReturnTopHits.java rename to java/src/main/java/ReturnTopHits.java index 135e66f..d7fa435 100644 --- a/java/src/main/java/RestApiReturnTopHits.java +++ b/java/src/main/java/ReturnTopHits.java @@ -10,10 +10,10 @@ import io.github.cdimascio.dotenv.Dotenv; -public class RestApiReturnTopHits { +public class ReturnTopHits { public static void main(String[] args) throws ExecutionException, InterruptedException, IOException { - RestApiReturnTopHits.run(); + ReturnTopHits.run(); } public static void run() throws ExecutionException, InterruptedException, IOException { From 25debfc0b70f54f5f22c26cfa076bccdc9638650 Mon Sep 17 00:00:00 2001 From: Lindsay Burton Date: Fri, 23 Jan 2026 14:00:01 -0800 Subject: [PATCH 3/4] Updating README file with updated file name for Analytics quickstarts file --- java/README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/java/README.md b/java/README.md index 3ff3d40..5f17634 100644 --- a/java/README.md +++ b/java/README.md @@ -31,11 +31,11 @@ Once setup, you can run each of the script in this folder using your favorite Ja | File | Description | | ---------------------------- | -------------------------------------------- | -| [Simple.java](./src/main/java/Simple.java) | Index a single object and run a search query | -| [Indexing.java](./src/main/java/Indexing.java) | Showcase of the main indexing methods | -| [Settings.java](./src/main/java/Settings.java) | Change index settings | -| [Rules.java](./src/main/java/Rules.java) | Export rules and add a new rule to an index | -| [Backup.java](./src/main/java/Backup.java) | Backup an index | -| [Restore.java](./src/main/java/Restore.java) | Restore an index | -| [RestApiReturnTopHits.java](./src/main/java/RestApiReturnTopHits.java) | Get top 1000 searches with Analytics API Client | -| [GenerateKey.java](./src/main/java/GenerateKey.java) | Generate API key | +| [Simple.java](./src/main/java/Simple.java) | Index a single object and run a search query | +| [Indexing.java](./src/main/java/Indexing.java) | Showcase of the main indexing methods | +| [Settings.java](./src/main/java/Settings.java) | Change index settings | +| [Rules.java](./src/main/java/Rules.java) | Export rules and add a new rule to an index | +| [Backup.java](./src/main/java/Backup.java) | Backup an index | +| [Restore.java](./src/main/java/Restore.java) | Restore an index | +| [ReturnTopHits.java](./src/main/java/ReturnTopHits.java) | Get top 1000 searches with Analytics API Client | +| [GenerateKey.java](./src/main/java/GenerateKey.java) | Generate API key | From 797e5e0f23e2b5237d44f20bb31d169d7327365c Mon Sep 17 00:00:00 2001 From: Lindsay Burton Date: Fri, 23 Jan 2026 14:02:59 -0800 Subject: [PATCH 4/4] Removing JSON files created while testing --- java/relevancy-1__top_1000_searches.json | 7 --- java/relevancy-1_records.json | 9 ---- java/relevancy-1_rules.json | 25 ---------- java/relevancy-1_settings.json | 62 ------------------------ java/relevancy-1_synonyms.json | 28 ----------- 5 files changed, 131 deletions(-) delete mode 100644 java/relevancy-1__top_1000_searches.json delete mode 100644 java/relevancy-1_records.json delete mode 100644 java/relevancy-1_rules.json delete mode 100644 java/relevancy-1_settings.json delete mode 100644 java/relevancy-1_synonyms.json diff --git a/java/relevancy-1__top_1000_searches.json b/java/relevancy-1__top_1000_searches.json deleted file mode 100644 index 07cfd81..0000000 --- a/java/relevancy-1__top_1000_searches.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "searches" : [ { - "search" : "", - "count" : 7, - "nbHits" : 1 - } ] -} \ No newline at end of file diff --git a/java/relevancy-1_records.json b/java/relevancy-1_records.json deleted file mode 100644 index 5961cc0..0000000 --- a/java/relevancy-1_records.json +++ /dev/null @@ -1,9 +0,0 @@ -[ { - "objectID" : "1", - "_highlightResult" : null, - "_snippetResult" : null, - "_rankingInfo" : null, - "_distinctSeqID" : null, - "name" : "Foo", - "email" : "" -} ] \ No newline at end of file diff --git a/java/relevancy-1_rules.json b/java/relevancy-1_rules.json deleted file mode 100644 index ed4ce25..0000000 --- a/java/relevancy-1_rules.json +++ /dev/null @@ -1,25 +0,0 @@ -[ { - "objectID" : "a-rule-id", - "conditions" : [ { - "pattern" : "flower", - "anchoring" : "contains", - "alternatives" : null, - "context" : null, - "filters" : null - } ], - "consequence" : { - "params" : null, - "promote" : [ { - "objectID" : "439957720", - "position" : 0 - } ], - "filterPromotes" : null, - "hide" : null, - "userData" : null - }, - "description" : null, - "enabled" : null, - "validity" : null, - "tags" : null, - "scope" : null -} ] \ No newline at end of file diff --git a/java/relevancy-1_settings.json b/java/relevancy-1_settings.json deleted file mode 100644 index 7e12d16..0000000 --- a/java/relevancy-1_settings.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "attributesForFaceting" : [ "name" ], - "replicas" : null, - "paginationLimitedTo" : 1000, - "unretrievableAttributes" : null, - "disableTypoToleranceOnWords" : null, - "attributesToTransliterate" : null, - "camelCaseAttributes" : null, - "decompoundedAttributes" : null, - "indexLanguages" : null, - "disablePrefixOnAttributes" : null, - "allowCompressionOfIntegerArray" : null, - "numericAttributesForFiltering" : null, - "separatorsToIndex" : "", - "searchableAttributes" : [ "actors", "genre" ], - "userData" : null, - "customNormalization" : null, - "attributeForDistinct" : null, - "maxFacetHits" : null, - "keepDiacriticsOnCharacters" : null, - "customRanking" : [ "desc(rating)" ], - "attributesToRetrieve" : null, - "ranking" : [ "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom" ], - "relevancyStrictness" : null, - "attributesToHighlight" : null, - "attributesToSnippet" : null, - "highlightPreTag" : "", - "highlightPostTag" : "", - "snippetEllipsisText" : null, - "restrictHighlightAndSnippetArrays" : null, - "hitsPerPage" : 20, - "minWordSizefor1Typo" : 5, - "minWordSizefor2Typos" : 8, - "typoTolerance" : "true", - "allowTyposOnNumericTokens" : null, - "disableTypoToleranceOnAttributes" : null, - "ignorePlurals" : false, - "removeStopWords" : false, - "queryLanguages" : null, - "decompoundQuery" : null, - "enableRules" : null, - "enablePersonalization" : null, - "queryType" : "prefixLast", - "removeWordsIfNoResults" : "none", - "mode" : null, - "semanticSearch" : null, - "advancedSyntax" : null, - "optionalWords" : null, - "disableExactOnAttributes" : null, - "exactOnSingleWordQuery" : "attribute", - "alternativesAsExact" : [ "ignorePlurals", "singleWordSynonym" ], - "advancedSyntaxFeatures" : null, - "distinct" : false, - "replaceSynonymsInHighlight" : null, - "minProximity" : null, - "responseFields" : null, - "maxValuesPerFacet" : 100, - "sortFacetValuesBy" : null, - "attributeCriteriaComputedByMinProximity" : null, - "renderingContent" : null, - "enableReRanking" : null -} \ No newline at end of file diff --git a/java/relevancy-1_synonyms.json b/java/relevancy-1_synonyms.json deleted file mode 100644 index b35efbf..0000000 --- a/java/relevancy-1_synonyms.json +++ /dev/null @@ -1,28 +0,0 @@ -[ { - "objectID" : "syn-1764984393671-13", - "type" : "synonym", - "synonyms" : [ "sequel", "2" ], - "input" : null, - "word" : null, - "corrections" : null, - "placeholder" : null, - "replacements" : null -}, { - "objectID" : "_settings_syn_2", - "type" : "synonym", - "synonyms" : [ "sequel", "2" ], - "input" : null, - "word" : null, - "corrections" : null, - "placeholder" : null, - "replacements" : null -}, { - "objectID" : "_settings_syn_1", - "type" : "synonym", - "synonyms" : [ "sequel", "2" ], - "input" : null, - "word" : null, - "corrections" : null, - "placeholder" : null, - "replacements" : null -} ] \ No newline at end of file