Skip to content

Commit e59607e

Browse files
authored
Merge pull request #403 from meilisearch/bump-meilisearch-v0.28.0
Changes related to the next Meilisearch release (v0.28.0)
2 parents d534b59 + 787a974 commit e59607e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1853
-922
lines changed

.code-samples.meilisearch.yaml

Lines changed: 85 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,23 @@
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-
86
get_one_index_1: |-
97
client.getIndex("movies");
108
list_all_indexes_1: |-
11-
client.getIndexes();
9+
IndexesQuery query = new IndexesQuery().setLimit(3);
10+
client.getIndexes(query);
1211
create_an_index_1: |-
1312
client.createIndex("movies", "id");
1413
update_an_index_1: |-
1514
client.updateIndex("movies", "id");
1615
delete_an_index_1: |-
1716
client.deleteIndex("movies");
1817
get_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);
2020
get_documents_1: |-
21-
client.index("movies").getDocuments();
21+
DocumentsQuery query = new DocumentsQuery().setLimit(2);
22+
client.index("movies").getDocuments(query);
2223
add_or_replace_documents_1: |-
2324
client.index("movies").addDocuments("[{"
2425
+ "\"id\": 287947,"
@@ -49,18 +50,35 @@ delete_documents_1: |-
4950
}));
5051
search_post_1: |-
5152
client.index("movies").search("American ninja");
52-
get_task_by_index_1: |-
53-
client.index("movies").getTask(1);
5453
get_all_tasks_1: |-
5554
client.getTasks();
5655
get_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);
6077
get_one_key_1: |-
61-
client.getKey("d0552b41536279a0ad88bd595327b96f01176a60c2243e906c52ac02375f9bc4");
78+
client.getKey("6062abda-a5aa-4414-ac91-ecd7944c0f8d");
6279
get_all_keys_1: |-
63-
client.getKeys();
80+
KeysQuery query = new KeysQuery().setLimit(3);
81+
client.getKeys(query);
6482
create_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);
7694
update_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);
78100
delete_a_key_1: |-
79-
client.deleteKey("d0552b41536279a0ad88bd595327b96f01176a60c2243e906c52ac02375f9bc4")
101+
client.deleteKey("6062abda-a5aa-4414-ac91-ecd7944c0f8d")
80102
get_settings_1: |-
81103
client.index("movies").getSettings();
82104
update_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);
125160
reset_settings_1: |-
126161
client.index("movies").resetSettings();
127162
get_synonyms_1: |-
128-
client.index("movies").getSynonyms();
163+
client.index("movies").getSynonymsSettings();
129164
update_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: |-
134169
reset_synonyms_1: |-
135170
client.index("movies").resetSynonymsSettings();
136171
get_stop_words_1: |-
137-
client.index("movies").getStopWords();
172+
client.index("movies").getStopWordsSettings();
138173
update_stop_words_1: |-
139174
client.index("movies").updateStopWordsSettings(new String[] {"of", "the", "to"});
140175
reset_stop_words_1: |-
141176
client.index("movies").resetStopWordsSettings();
142177
get_ranking_rules_1: |-
143-
client.index("movies").getRankingRules();
178+
client.index("movies").getRankingRuleSettings();
144179
update_ranking_rules_1: |-
145180
Settings settings = new Settings();
146181
settings.setRankingRules(new String[]
@@ -158,13 +193,13 @@ update_ranking_rules_1: |-
158193
reset_ranking_rules_1: |-
159194
client.index("movies").resetRankingRuleSettings();
160195
get_distinct_attribute_1: |-
161-
client.index("shoes").getDistinctAttribute();
196+
client.index("shoes").getDistinctAttributeSettings();
162197
update_distinct_attribute_1: |-
163198
client.index("shoes").updateDistinctAttributeSettings("skuid");
164199
reset_distinct_attribute_1: |-
165200
client.index("shoes").resetDistinctAttributeSettings();
166201
get_searchable_attributes_1: |-
167-
client.index("movies").getSearchableAttributes();
202+
client.index("movies").getSearchableAttributesSettings();
168203
update_searchable_attributes_1: |-
169204
client.index("movies").updateSearchableAttributesSettings(new String[]
170205
{
@@ -175,15 +210,15 @@ update_searchable_attributes_1: |-
175210
reset_searchable_attributes_1: |-
176211
client.index("movies").resetSearchableAttributesSettings();
177212
get_filterable_attributes_1: |-
178-
client.index("movies").getFilterableAttributes();
213+
client.index("movies").getFilterableAttributesSettings();
179214
update_filterable_attributes_1: |-
180215
Settings settings = new Settings();
181216
settings.setFilterableAttributes(new String[] {"genres", "director"});
182217
client.index("movies").updateSettings(settings);
183218
reset_filterable_attributes_1: |-
184-
//Not yet implemented
219+
client.index("movies").resetFilterableAttributesSettings();
185220
get_displayed_attributes_1: |-
186-
client.index("movies").getDisplayedAttributes();
221+
client.index("movies").getDisplayedAttributesSettings();
187222
update_displayed_attributes_1: |-
188223
client.index("movies").updateDisplayedAttributesSettings(new String[]
189224
{
@@ -194,6 +229,18 @@ update_displayed_attributes_1: |-
194229
});
195230
reset_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);
197244
get_typo_tolerance_1:
198245
client.index("books").getTypoToleranceSettings();
199246
update_typo_tolerance_1: |-
@@ -212,6 +259,12 @@ update_typo_tolerance_1: |-
212259
client.index("books").updateTypoToleranceSettings(typoTolerance);
213260
reset_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: |-
215268
get_index_stats_1: |-
216269
client.index("movies").getStats();
217270
get_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);
296346
settings_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: |-
357409
settings_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)
430482
getting_started_check_task_status: |-
431-
client.index("movies").getTask(0);
483+
client.getTask(0);
432484
getting_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);
534586
faceted_search_walkthrough_filter_1: |-
535587
SearchRequest searchRequest =
@@ -562,8 +614,6 @@ landing_getting_started_1: |-
562614
);
563615
post_dump_1: |-
564616
client.createDump();
565-
get_dump_status_1: |-
566-
client.getDumpStatus("20201101-110357260");
567617
phrase_search_1: |-
568618
client.index("movies").search("\"african american\" horror");
569619
sorting_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);
591641
get_sortable_attributes_1: |-
592-
client.index("books").getSortableAttributes();
642+
client.index("books").getSettings().getSortableAttributes();
593643
update_sortable_attributes_1: |-
594644
Settings settings = new Settings();
595645
settings.setSortableAttributes(new String[] {"price", "author"});
596646
client.index("books").updateSettings(settings);
597647
reset_sortable_attributes_1: |-
598-
//Not yet implemented
599648
search_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();
645694
security_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"));
647697
security_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();
664714
security_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");
667717
authorization_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);
683733
tenant_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");

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ jobs:
2626
cache: gradle
2727
- name: Grant execute permission for gradlew
2828
run: chmod +x gradlew
29-
- name: Meilisearch (v0.27.2 version) setup with Docker
30-
run: docker run -d -p 7700:7700 getmeili/meilisearch:v0.27.2 meilisearch --no-analytics --master-key='masterKey'
29+
- name: Meilisearch (v0.28.1 version) setup with Docker
30+
run: docker run -d -p 7700:7700 getmeili/meilisearch:v0.28.1 meilisearch --no-analytics --master-key='masterKey'
3131
- name: Build and run unit and integration tests
3232
run: ./gradlew build integrationTest
3333
- name: Archive test report

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class TestMeilisearch {
118118
Index index = client.index("movies");
119119

120120
// If the index 'movies' does not exist, Meilisearch creates it when you first add the documents.
121-
index.addDocuments(documents); // => { "uid": 0 }
121+
index.addDocuments(documents); // => { "taskUid": 0 }
122122
}
123123
}
124124
```
@@ -140,7 +140,7 @@ System.out.println(results);
140140
- Output:
141141

142142
```
143-
SearchResult(hits=[{id=1.0, title=Carol, genres:[Romance, Drama]}], offset=0, limit=20, nbHits=1, exhaustiveNbHits=false, facetsDistribution=null, exhaustiveFacetsCount=false, processingTimeMs=3, query=carlo)
143+
SearchResult(hits=[{id=1.0, title=Carol, genres:[Romance, Drama]}], offset=0, limit=20, estimatedTotalHits=1, facetDistribution=null, processingTimeMs=3, query=carlo)
144144
```
145145

146146
#### Custom Search <!-- omit in toc -->
@@ -155,7 +155,7 @@ import com.meilisearch.sdk.SearchRequest;
155155

156156
SearchResult results = index.search(
157157
new SearchRequest("of")
158-
.setMatches(true)
158+
.setShowMatchesPosition(true)
159159
.setAttributesToHighlight(new String[]{"title"})
160160
);
161161
System.out.println(results.getHits());
@@ -173,10 +173,10 @@ System.out.println(results.getHits());
173173
"title":"Life <em>of</em> Pi",
174174
"genres":["Adventure","Drama"]
175175
},
176-
"_matchesInfo":{
176+
"_matchesPosition":{
177177
"title":[{
178-
"start":5,
179-
"length":2
178+
"start":5.0,
179+
"length":2.0
180180
}]
181181
}
182182
}]
@@ -217,7 +217,7 @@ index.search(
217217
],
218218
"offset": 0,
219219
"limit": 20,
220-
"nbHits": 1,
220+
"estimatedTotalHits": 1,
221221
"processingTimeMs": 0,
222222
"query": "wonder"
223223
}
@@ -265,7 +265,7 @@ Client client = new Client(config);
265265

266266
## 🤖 Compatibility with Meilisearch
267267

268-
This package only guarantees compatibility with the [version v0.27.0 of Meilisearch](https://github.com/meilisearch/meilisearch/releases/tag/v0.27.0).
268+
This package only guarantees compatibility with the [version v0.28.0 of Meilisearch](https://github.com/meilisearch/meilisearch/releases/tag/v0.28.0).
269269

270270
## 💡 Learn more
271271

0 commit comments

Comments
 (0)