33# the documentation on build
44# You can read more on https://github.com/meilisearch/documentation/tree/master/.vuepress/code-samples
55---
6- getting_started_typo_tolerance : |-
7-
86get_one_index_1 : |-
97 client.getIndex("movies");
108list_all_indexes_1 : |-
11- client.getIndexes();
9+ IndexesQuery query = new IndexesQuery().setLimit(3);
10+ client.getIndexes(query);
1211create_an_index_1 : |-
1312 client.createIndex("movies", "id");
1413update_an_index_1 : |-
1514 client.updateIndex("movies", "id");
1615delete_an_index_1 : |-
1716 client.deleteIndex("movies");
1817get_one_document_1 : |-
19- client.index("movies").getDocument("25684");
18+ DocumentQuery query = new DocumentQuery().setFields(new String[] {"id", "title", "poster", "release_date"});
19+ client.index("movies").getDocument("25684", query);
2020get_documents_1 : |-
21- client.index("movies").getDocuments();
21+ DocumentsQuery query = new DocumentsQuery().setLimit(2);
22+ client.index("movies").getDocuments(query);
2223add_or_replace_documents_1 : |-
2324 client.index("movies").addDocuments("[{"
2425 + "\"id\": 287947,"
@@ -49,18 +50,35 @@ delete_documents_1: |-
4950 }));
5051search_post_1 : |-
5152 client.index("movies").search("American ninja");
52- get_task_by_index_1 : |-
53- client.index("movies").getTask(1);
5453get_all_tasks_1 : |-
5554 client.getTasks();
5655get_task_1 : |-
5756 client.getTask(1);
58- get_all_tasks_by_index_1 : |-
57+ get_all_tasks_filtering_1 : |-
5958 client.index("movies").getTasks();
59+ get_all_tasks_filtering_2 : |-
60+ TasksQuery query = new TasksQuery()
61+ .setStatus(new String[] {"succeeded", "failed"})
62+ .setType(new String[] {documentAdditionOrUpdate});
63+
64+ client.index("movies").getTasks(query);
65+ get_all_tasks_paginating_1 : |-
66+ TasksQuery query = new TasksQuery()
67+ .setLimit(2)
68+ .setFrom(10);
69+
70+ client.index("movies").getTasks(query);
71+ get_all_tasks_paginating_2 : |-
72+ TasksQuery query = new TasksQuery()
73+ .setLimit(2)
74+ .setFrom(8);
75+
76+ client.index("movies").getTasks(query);
6077get_one_key_1 : |-
61- client.getKey("d0552b41536279a0ad88bd595327b96f01176a60c2243e906c52ac02375f9bc4 ");
78+ client.getKey("6062abda-a5aa-4414-ac91-ecd7944c0f8d ");
6279get_all_keys_1 : |-
63- client.getKeys();
80+ KeysQuery query = new KeysQuery().setLimit(3);
81+ client.getKeys(query);
6482create_a_key_1 : |-
6583 SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
6684 Date dateParsed = format.parse("2042-04-02T00:42:42Z");
@@ -74,20 +92,24 @@ create_a_key_1: |-
7492
7593 client.createKey(keyInfo);
7694update_a_key_1 : |-
77- //Not yet implemented
95+ KeyUpdate keyChanges = new KeyUpdate();
96+ keyChanges.setName("Products/Reviews API key");
97+ keyChanges.setDescription("Manage documents: Products/Reviews API key");
98+
99+ client.updateKey("6062abda-a5aa-4414-ac91-ecd7944c0f8d", keyChanges);
78100delete_a_key_1 : |-
79- client.deleteKey("d0552b41536279a0ad88bd595327b96f01176a60c2243e906c52ac02375f9bc4 ")
101+ client.deleteKey("6062abda-a5aa-4414-ac91-ecd7944c0f8d ")
80102get_settings_1 : |-
81103 client.index("movies").getSettings();
82104update_settings_1 : |-
83105 Settings settings = new Settings();
84106 settings.setRankingRules(
85107 new String[] {
86- "typo",
87108 "words",
88- "sort ",
109+ "typo ",
89110 "proximity",
90111 "attribute",
112+ "sort",
91113 "exactness",
92114 "release_date:desc",
93115 "rank:desc"
@@ -117,15 +139,28 @@ update_settings_1: |-
117139 "title",
118140 "release_date"
119141 });
142+
120143 HashMap<String, String[]> synonyms = new HashMap<String, String[]>();
121144 synonyms.put("wolverine", new String[] {"xmen", "logan"});
122145 synonyms.put("logan", new String[] {"wolverine"});
123146 settings.setSynonyms(synonyms);
147+
148+ HashMap<String, Integer> minWordSizeTypos =
149+ new HashMap<String, Integer>() {
150+ {
151+ put("oneTypo", 8);
152+ put("twoTypos", 10);
153+ }
154+ };
155+ TypoTolerance typoTolerance = new TypoTolerance();
156+ typoTolerance.setMinWordSizeForTypos(minWordSizeTypos);
157+ settings.setTypoTolerance(typoTolerance);
158+
124159 client.index("movies").updateSettings(settings);
125160reset_settings_1 : |-
126161 client.index("movies").resetSettings();
127162get_synonyms_1 : |-
128- client.index("movies").getSynonyms ();
163+ client.index("movies").getSynonymsSettings ();
129164update_synonyms_1 : |-
130165 HashMap<String, String[]> synonyms = new HashMap<String, String[]>();
131166 synonyms.put("wolverine", new String[] {"xmen", "logan"});
@@ -134,13 +169,13 @@ update_synonyms_1: |-
134169reset_synonyms_1 : |-
135170 client.index("movies").resetSynonymsSettings();
136171get_stop_words_1 : |-
137- client.index("movies").getStopWords ();
172+ client.index("movies").getStopWordsSettings ();
138173update_stop_words_1 : |-
139174 client.index("movies").updateStopWordsSettings(new String[] {"of", "the", "to"});
140175reset_stop_words_1 : |-
141176 client.index("movies").resetStopWordsSettings();
142177get_ranking_rules_1 : |-
143- client.index("movies").getRankingRules ();
178+ client.index("movies").getRankingRuleSettings ();
144179update_ranking_rules_1 : |-
145180 Settings settings = new Settings();
146181 settings.setRankingRules(new String[]
@@ -158,13 +193,13 @@ update_ranking_rules_1: |-
158193reset_ranking_rules_1 : |-
159194 client.index("movies").resetRankingRuleSettings();
160195get_distinct_attribute_1 : |-
161- client.index("shoes").getDistinctAttribute ();
196+ client.index("shoes").getDistinctAttributeSettings ();
162197update_distinct_attribute_1 : |-
163198 client.index("shoes").updateDistinctAttributeSettings("skuid");
164199reset_distinct_attribute_1 : |-
165200 client.index("shoes").resetDistinctAttributeSettings();
166201get_searchable_attributes_1 : |-
167- client.index("movies").getSearchableAttributes ();
202+ client.index("movies").getSearchableAttributesSettings ();
168203update_searchable_attributes_1 : |-
169204 client.index("movies").updateSearchableAttributesSettings(new String[]
170205 {
@@ -175,15 +210,15 @@ update_searchable_attributes_1: |-
175210reset_searchable_attributes_1 : |-
176211 client.index("movies").resetSearchableAttributesSettings();
177212get_filterable_attributes_1 : |-
178- client.index("movies").getFilterableAttributes ();
213+ client.index("movies").getFilterableAttributesSettings ();
179214update_filterable_attributes_1 : |-
180215 Settings settings = new Settings();
181216 settings.setFilterableAttributes(new String[] {"genres", "director"});
182217 client.index("movies").updateSettings(settings);
183218reset_filterable_attributes_1 : |-
184- //Not yet implemented
219+ client.index("movies").resetFilterableAttributesSettings();
185220get_displayed_attributes_1 : |-
186- client.index("movies").getDisplayedAttributes ();
221+ client.index("movies").getDisplayedAttributesSettings ();
187222update_displayed_attributes_1 : |-
188223 client.index("movies").updateDisplayedAttributesSettings(new String[]
189224 {
@@ -194,6 +229,18 @@ update_displayed_attributes_1: |-
194229 });
195230reset_displayed_attributes_1 : |-
196231 client.index("movies").resetDisplayedAttributesSettings();
232+ getting_started_typo_tolerance : |-
233+ HashMap<String, Integer> minWordSizeTypos =
234+ new HashMap<String, Integer>() {
235+ {
236+ put("oneTypo", 4);
237+ }
238+ };
239+
240+ TypoTolerance typoTolerance = new TypoTolerance();
241+ typoTolerance.setMinWordSizeForTypos(minWordSizeTypos);
242+
243+ client.index("movies").updateTypoToleranceSettings(typoTolerance);
197244get_typo_tolerance_1 :
198245 client.index("books").getTypoToleranceSettings();
199246update_typo_tolerance_1 : |-
@@ -212,6 +259,12 @@ update_typo_tolerance_1: |-
212259 client.index("books").updateTypoToleranceSettings(typoTolerance);
213260reset_typo_tolerance_1 : |-
214261 client.index("books").resetTypoToleranceSettings();
262+ get_pagination_settings_1 :
263+ update_pagination_settings_1 : |-
264+ reset_pagination_settings_1 : |-
265+ get_faceting_settings_1 : |-
266+ update_faceting_settings_1 : |-
267+ reset_faceting_settings_1 : |-
215268get_index_stats_1 : |-
216269 client.index("movies").getStats();
217270get_indexes_stats_1 : |-
@@ -290,9 +343,6 @@ search_parameter_guide_highlight_tag_1: |-
290343 .setHighlightPreTag("<span class=\"highlight\">")
291344 .setHighlightPostTag("</span>");
292345 client.index("movies").search(searchRequest);
293- search_parameter_guide_matches_1 : |-
294- SearchRequest searchRequest = new SearchRequest("winter feast").setMatches(true);
295- SearchResult searchResult = index.search(searchRequest);
296346settings_guide_synonyms_1 : |-
297347 Settings settings = new Settings();
298348 HashMap<String, String[]> synonyms = new HashMap<String, String[]>();
@@ -354,6 +404,8 @@ settings_guide_sortable_1: |-
354404 "author",
355405 });
356406 client.index("books").updateSettings(settings);
407+ settings_guide_faceting_1 : |-
408+ settings_guide_pagination_1 : |-
357409settings_guide_typo_tolerance_1 : |-
358410 TypoTolerance typoTolerance = new TypoTolerance();
359411 HashMap<String, Integer> minWordSizeTypos =
@@ -428,7 +480,7 @@ getting_started_add_documents_md: |-
428480
429481 [About this SDK](https://github.com/meilisearch/meilisearch-java)
430482getting_started_check_task_status : |-
431- client.index("movies"). getTask(0);
483+ client.getTask(0);
432484getting_started_search_md : |-
433485 ```java
434486 client.index("movies").search("botman");
@@ -527,9 +579,9 @@ faceted_search_filter_1: |-
527579 new String[] {"genres = Horror", "genres = Mystery"},
528580 new String[] {"director = \"Jordan Peele\""}});
529581 client.index("movies").search(searchRequest);
530- faceted_search_facets_distribution_1 : |-
582+ faceted_search_facets_1 : |-
531583 SearchRequest searchRequest =
532- new SearchRequest("Batman").setFacetsDistribution (new String[] {"genres"});
584+ new SearchRequest("Batman").setFacets (new String[] {"genres"});
533585 client.index("movies").search(searchRequest);
534586faceted_search_walkthrough_filter_1 : |-
535587 SearchRequest searchRequest =
@@ -562,8 +614,6 @@ landing_getting_started_1: |-
562614 );
563615post_dump_1 : |-
564616 client.createDump();
565- get_dump_status_1 : |-
566- client.getDumpStatus("20201101-110357260");
567617phrase_search_1 : |-
568618 client.index("movies").search("\"african american\" horror");
569619sorting_guide_update_sortable_attributes_1 : |-
@@ -589,13 +639,12 @@ sorting_guide_sort_parameter_2: |-
589639 SearchRequest searchRequest = new SearchRequest("butler").setSort(new String[] {"author:desc"});
590640 client.index("books").search(searchRequest);
591641get_sortable_attributes_1 : |-
592- client.index("books").getSortableAttributes();
642+ client.index("books").getSettings(). getSortableAttributes();
593643update_sortable_attributes_1 : |-
594644 Settings settings = new Settings();
595645 settings.setSortableAttributes(new String[] {"price", "author"});
596646 client.index("books").updateSettings(settings);
597647reset_sortable_attributes_1 : |-
598- //Not yet implemented
599648search_parameter_guide_sort_1 : |-
600649 SearchRequest searchRequest = new SearchRequest("science fiction").setSort(new String[] {"price:asc"});
601650 client.index("search_parameter_guide_sort_1").search(searchRequest);
@@ -643,7 +692,8 @@ security_guide_search_key_1: |-
643692 Client client = new Client(new Config("http://localhost:7700", "apiKey"));
644693 client.index("patient_medical_records").search();
645694security_guide_update_key_1 : |-
646- //Not yet implemented
695+ Client client = new Client(new Config("http://localhost:7700", "masterKey"));
696+ client.updateKey("74c9c733-3368-4738-bbe5-1d18a5fecb37", new KeyUpdate().setDescription("Default Search API Key"));
647697security_guide_create_key_1 : |-
648698 Client client = new Client(new Config("http://localhost:7700", "masterKey"));
649699
@@ -663,7 +713,7 @@ security_guide_list_keys_1: |-
663713 client.getKeys();
664714security_guide_delete_key_1 : |-
665715 Client client = new Client(new Config("http://localhost:7700", "masterKey"));
666- client.deleteKey("d0552b41536279a0ad88bd595327b96f01176a60c2243e906c52ac02375f9bc4 ");
716+ client.deleteKey("c5cd97d-5a4b-4226-a868-2d0eb6d197ab ");
667717authorization_header_1 : |-
668718 Client client = new Client(new Config("http://localhost:7700", "masterKey"));
669719 client.getKeys();
@@ -679,7 +729,7 @@ tenant_token_guide_generate_sdk_1: |-
679729 options.setApiKey("B5KdX2MY2jV6EXfUs6scSfmC...");
680730 options.setExpiresAt(expiresAt);
681731
682- String token = client.generateTenantToken(searchRules, options);
732+ String token = client.generateTenantToken("85c3c2f9-bdd6-41f1-abd8-11fcf80e0f76", searchRules, options);
683733tenant_token_guide_search_sdk_1 : |-
684734 Client frontEndClient = new Client(new Config("http://localhost:7700", token));
685735 frontEndClient.index("patient_medical_records").search("blood test");
0 commit comments