Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes related to the next Meilisearch release (v0.28.0) #403

Merged
merged 81 commits into from
Jan 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
008e299
Update README.md
meili-bot Jun 9, 2022
185af3d
Update .code-samples.meilisearch.yaml
meili-bot Jul 4, 2022
a8e723b
Merge branch 'main' into bump-meilisearch-v0.28.0
alallema Dec 8, 2022
f1b7ec3
Merge branch 'main' into bump-meilisearch-v0.28.0
alallema Dec 13, 2022
49a2190
Apply search changes
alallema Dec 19, 2022
f5a11a6
Change HTTP methods
alallema Dec 19, 2022
a713a6e
Merge pull request #506 from meilisearch/http-methods
alallema Dec 20, 2022
40842d8
Merge pull request #505 from meilisearch/search-changes
alallema Dec 20, 2022
560ebd8
Rename Result class to Results
alallema Dec 20, 2022
c5035ae
Add URLBuilder for query parameters
alallema Dec 20, 2022
235276c
Apply tasks changes
alallema Dec 21, 2022
b35d69d
Add test for URLBuilder class
alallema Dec 27, 2022
f670ae7
Pass methods in private and remove tests
alallema Dec 27, 2022
592fc42
Modify method with accessors chain
alallema Dec 27, 2022
67556ac
Add TaskInfo in return for index handler
alallema Dec 27, 2022
a941488
Update src/main/java/com/meilisearch/sdk/http/URLBuilder.java
alallema Dec 27, 2022
0136243
Merge pull request #509 from meilisearch/add-url_builder
alallema Dec 27, 2022
9abd107
Merge pull request #510 from meilisearch/tasks_changes
alallema Dec 27, 2022
866e88d
Merge pull request #508 from meilisearch/result-rename
alallema Dec 27, 2022
b43a1cb
Merge branch 'main' into bump-meilisearch-v0.28.0
alallema Dec 27, 2022
4387671
Linter fix
alallema Dec 27, 2022
1f85c5c
Merge branch 'main' into bump-meilisearch-v0.28.0
alallema Dec 27, 2022
3a62d1a
Apply dumps changes
alallema Dec 27, 2022
714d228
Merge pull request #515 from meilisearch/dump_changes
alallema Dec 28, 2022
856af66
Fix tests for CI
alallema Dec 28, 2022
784e044
Apply indexes changes
alallema Dec 27, 2022
588a95c
Apply keys changes
alallema Dec 28, 2022
a79f2be
Apply documents changes
alallema Dec 28, 2022
911c155
Add tests for getRawDocuments
alallema Dec 28, 2022
e572ed1
Add toQuery method to IndexesQuery
alallema Jan 3, 2023
a4f18a9
Add toQuery method to KeysQuery
alallema Jan 3, 2023
6340a55
Improve method description
alallema Jan 4, 2023
4b56d07
Update src/main/java/com/meilisearch/sdk/model/IndexesQuery.java
alallema Jan 4, 2023
1372db7
Improve method definition
alallema Jan 4, 2023
9b43cc7
Update src/main/java/com/meilisearch/sdk/IndexesHandler.java
alallema Jan 4, 2023
c9295b1
Update src/main/java/com/meilisearch/sdk/IndexesHandler.java
alallema Jan 4, 2023
72fe913
Update src/main/java/com/meilisearch/sdk/IndexesHandler.java
alallema Jan 4, 2023
17d0b2f
Update src/main/java/com/meilisearch/sdk/Client.java
alallema Jan 4, 2023
8560a7b
Changes du to review
alallema Jan 4, 2023
2910675
Update src/main/java/com/meilisearch/sdk/Client.java
alallema Jan 4, 2023
5c5ce8d
Update src/main/java/com/meilisearch/sdk/Client.java
alallema Jan 4, 2023
1c7b8cf
Improve Key's method description
alallema Jan 4, 2023
541cb0b
Fix due to review and linter
alallema Jan 4, 2023
0d7dbe2
Update src/main/java/com/meilisearch/sdk/Client.java
alallema Jan 5, 2023
ce1cdb7
Update src/main/java/com/meilisearch/sdk/IndexesHandler.java
alallema Jan 5, 2023
317790f
Update src/main/java/com/meilisearch/sdk/IndexesHandler.java
alallema Jan 5, 2023
c121bd7
Update src/main/java/com/meilisearch/sdk/model/KeysQuery.java
alallema Jan 5, 2023
fc137ae
Update src/test/java/com/meilisearch/integration/KeysTest.java
alallema Jan 5, 2023
67cd327
Add toQuery method to simplify code
alallema Dec 29, 2022
c95847c
Modify KeyUpdate class definition
alallema Jan 5, 2023
4a6c382
Changes du to review and linter
alallema Jan 5, 2023
bf2a436
Update src/main/java/com/meilisearch/sdk/Documents.java
alallema Jan 5, 2023
deb81a0
Update src/main/java/com/meilisearch/sdk/Index.java
alallema Jan 5, 2023
274efe2
Update src/main/java/com/meilisearch/sdk/model/DocumentsQuery.java
alallema Jan 5, 2023
6c413de
Update src/main/java/com/meilisearch/sdk/Documents.java
alallema Jan 5, 2023
1002a9a
Update src/main/java/com/meilisearch/sdk/Index.java
alallema Jan 5, 2023
941ab88
Update src/main/java/com/meilisearch/sdk/Documents.java
alallema Jan 5, 2023
73f9d0d
Update src/main/java/com/meilisearch/sdk/Documents.java
alallema Jan 5, 2023
75aa692
Update src/main/java/com/meilisearch/sdk/Documents.java
alallema Jan 5, 2023
389ebc0
Improve description of documents's method
alallema Jan 5, 2023
40e9e4b
Remove result before return
alallema Jan 5, 2023
4a0fec6
Merge pull request #516 from meilisearch/indexes_changes
alallema Jan 5, 2023
041fdfa
Merge pull request #517 from meilisearch/keys_changes
alallema Jan 5, 2023
c9708ef
Update src/main/java/com/meilisearch/sdk/Documents.java
alallema Jan 5, 2023
1a8704d
Merge pull request #518 from meilisearch/documents_changes
alallema Jan 5, 2023
b0fa324
Update Tenant Token API for Meilisearch v.28
alallema Jan 5, 2023
8bd08cc
Fix tasks test if no tasks are return
alallema Jan 5, 2023
de090a3
Merge pull request #522 from meilisearch/generate_token
alallema Jan 5, 2023
f3f657d
Update Readme following the update for v0.28
alallema Jan 5, 2023
3370cea
Switch to v0.28.1 to fix the test
alallema Jan 5, 2023
5a44091
Merge branch 'bump-meilisearch-v0.28.0' into meili-bot/code-samples-v…
alallema Jan 5, 2023
a53ebb0
Refactor handlers for the usage of URLBuilder
alallema Jan 10, 2023
8b1619b
Update code-sample for v0.28
alallema Jan 10, 2023
38d5494
Improve addQuery to return a URLBuilder
alallema Jan 10, 2023
ec11162
Merge pull request #524 from meilisearch/refactor_url-builder
alallema Jan 10, 2023
15e608a
Merge branch 'main' into bump-meilisearch-v0.28.0
alallema Jan 16, 2023
275bad6
Merge branch 'main' into bump-meilisearch-v0.28.0
alallema Jan 16, 2023
6714dd5
Update .code-samples.meilisearch.yaml
alallema Jan 16, 2023
c7d5c24
Update .code-samples.meilisearch.yaml
alallema Jan 16, 2023
b8341df
Modification due to review
alallema Jan 16, 2023
787a974
Merge pull request #409 from meilisearch/meili-bot/code-samples-v0-28
alallema Jan 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 85 additions & 35 deletions .code-samples.meilisearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,23 @@
# the documentation on build
# You can read more on https://github.com/meilisearch/documentation/tree/master/.vuepress/code-samples
---
getting_started_typo_tolerance: |-

get_one_index_1: |-
client.getIndex("movies");
list_all_indexes_1: |-
client.getIndexes();
IndexesQuery query = new IndexesQuery().setLimit(3);
client.getIndexes(query);
create_an_index_1: |-
client.createIndex("movies", "id");
update_an_index_1: |-
client.updateIndex("movies", "id");
delete_an_index_1: |-
client.deleteIndex("movies");
get_one_document_1: |-
client.index("movies").getDocument("25684");
DocumentQuery query = new DocumentQuery().setFields(new String[] {"id", "title", "poster", "release_date"});
client.index("movies").getDocument("25684", query);
get_documents_1: |-
client.index("movies").getDocuments();
DocumentsQuery query = new DocumentsQuery().setLimit(2);
client.index("movies").getDocuments(query);
add_or_replace_documents_1: |-
client.index("movies").addDocuments("[{"
+ "\"id\": 287947,"
Expand Down Expand Up @@ -49,18 +50,35 @@ delete_documents_1: |-
}));
search_post_1: |-
client.index("movies").search("American ninja");
get_task_by_index_1: |-
client.index("movies").getTask(1);
get_all_tasks_1: |-
client.getTasks();
get_task_1: |-
client.getTask(1);
get_all_tasks_by_index_1: |-
get_all_tasks_filtering_1: |-
client.index("movies").getTasks();
get_all_tasks_filtering_2: |-
TasksQuery query = new TasksQuery()
.setStatus(new String[] {"succeeded", "failed"})
.setType(new String[] {documentAdditionOrUpdate});

client.index("movies").getTasks(query);
get_all_tasks_paginating_1: |-
TasksQuery query = new TasksQuery()
.setLimit(2)
.setFrom(10);

client.index("movies").getTasks(query);
get_all_tasks_paginating_2: |-
TasksQuery query = new TasksQuery()
.setLimit(2)
.setFrom(8);

client.index("movies").getTasks(query);
get_one_key_1: |-
client.getKey("d0552b41536279a0ad88bd595327b96f01176a60c2243e906c52ac02375f9bc4");
client.getKey("6062abda-a5aa-4414-ac91-ecd7944c0f8d");
get_all_keys_1: |-
client.getKeys();
KeysQuery query = new KeysQuery().setLimit(3);
client.getKeys(query);
create_a_key_1: |-
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
Date dateParsed = format.parse("2042-04-02T00:42:42Z");
Expand All @@ -74,20 +92,24 @@ create_a_key_1: |-

client.createKey(keyInfo);
update_a_key_1: |-
//Not yet implemented
KeyUpdate keyChanges = new KeyUpdate();
keyChanges.setName("Products/Reviews API key");
keyChanges.setDescription("Manage documents: Products/Reviews API key");

client.updateKey("6062abda-a5aa-4414-ac91-ecd7944c0f8d", keyChanges);
delete_a_key_1: |-
client.deleteKey("d0552b41536279a0ad88bd595327b96f01176a60c2243e906c52ac02375f9bc4")
client.deleteKey("6062abda-a5aa-4414-ac91-ecd7944c0f8d")
get_settings_1: |-
client.index("movies").getSettings();
update_settings_1: |-
Settings settings = new Settings();
settings.setRankingRules(
new String[] {
"typo",
"words",
"sort",
"typo",
"proximity",
"attribute",
"sort",
"exactness",
"release_date:desc",
"rank:desc"
Expand Down Expand Up @@ -117,15 +139,28 @@ update_settings_1: |-
"title",
"release_date"
});

HashMap<String, String[]> synonyms = new HashMap<String, String[]>();
synonyms.put("wolverine", new String[] {"xmen", "logan"});
synonyms.put("logan", new String[] {"wolverine"});
settings.setSynonyms(synonyms);

HashMap<String, Integer> minWordSizeTypos =
new HashMap<String, Integer>() {
{
put("oneTypo", 8);
put("twoTypos", 10);
}
};
TypoTolerance typoTolerance = new TypoTolerance();
typoTolerance.setMinWordSizeForTypos(minWordSizeTypos);
settings.setTypoTolerance(typoTolerance);

client.index("movies").updateSettings(settings);
reset_settings_1: |-
client.index("movies").resetSettings();
get_synonyms_1: |-
client.index("movies").getSynonyms();
client.index("movies").getSynonymsSettings();
update_synonyms_1: |-
HashMap<String, String[]> synonyms = new HashMap<String, String[]>();
synonyms.put("wolverine", new String[] {"xmen", "logan"});
Expand All @@ -134,13 +169,13 @@ update_synonyms_1: |-
reset_synonyms_1: |-
client.index("movies").resetSynonymsSettings();
get_stop_words_1: |-
client.index("movies").getStopWords();
client.index("movies").getStopWordsSettings();
update_stop_words_1: |-
client.index("movies").updateStopWordsSettings(new String[] {"of", "the", "to"});
reset_stop_words_1: |-
client.index("movies").resetStopWordsSettings();
get_ranking_rules_1: |-
client.index("movies").getRankingRules();
client.index("movies").getRankingRuleSettings();
update_ranking_rules_1: |-
Settings settings = new Settings();
settings.setRankingRules(new String[]
Expand All @@ -158,13 +193,13 @@ update_ranking_rules_1: |-
reset_ranking_rules_1: |-
client.index("movies").resetRankingRuleSettings();
get_distinct_attribute_1: |-
client.index("shoes").getDistinctAttribute();
client.index("shoes").getDistinctAttributeSettings();
update_distinct_attribute_1: |-
client.index("shoes").updateDistinctAttributeSettings("skuid");
reset_distinct_attribute_1: |-
client.index("shoes").resetDistinctAttributeSettings();
get_searchable_attributes_1: |-
client.index("movies").getSearchableAttributes();
client.index("movies").getSearchableAttributesSettings();
update_searchable_attributes_1: |-
client.index("movies").updateSearchableAttributesSettings(new String[]
{
Expand All @@ -175,15 +210,15 @@ update_searchable_attributes_1: |-
reset_searchable_attributes_1: |-
client.index("movies").resetSearchableAttributesSettings();
get_filterable_attributes_1: |-
client.index("movies").getFilterableAttributes();
client.index("movies").getFilterableAttributesSettings();
update_filterable_attributes_1: |-
Settings settings = new Settings();
settings.setFilterableAttributes(new String[] {"genres", "director"});
client.index("movies").updateSettings(settings);
reset_filterable_attributes_1: |-
//Not yet implemented
client.index("movies").resetFilterableAttributesSettings();
get_displayed_attributes_1: |-
client.index("movies").getDisplayedAttributes();
client.index("movies").getDisplayedAttributesSettings();
update_displayed_attributes_1: |-
client.index("movies").updateDisplayedAttributesSettings(new String[]
{
Expand All @@ -194,6 +229,18 @@ update_displayed_attributes_1: |-
});
reset_displayed_attributes_1: |-
client.index("movies").resetDisplayedAttributesSettings();
getting_started_typo_tolerance: |-
HashMap<String, Integer> minWordSizeTypos =
new HashMap<String, Integer>() {
{
put("oneTypo", 4);
}
};

TypoTolerance typoTolerance = new TypoTolerance();
typoTolerance.setMinWordSizeForTypos(minWordSizeTypos);

client.index("movies").updateTypoToleranceSettings(typoTolerance);
get_typo_tolerance_1:
client.index("books").getTypoToleranceSettings();
update_typo_tolerance_1: |-
Expand All @@ -212,6 +259,12 @@ update_typo_tolerance_1: |-
client.index("books").updateTypoToleranceSettings(typoTolerance);
reset_typo_tolerance_1: |-
client.index("books").resetTypoToleranceSettings();
get_pagination_settings_1:
update_pagination_settings_1: |-
reset_pagination_settings_1: |-
get_faceting_settings_1: |-
update_faceting_settings_1: |-
reset_faceting_settings_1: |-
get_index_stats_1: |-
client.index("movies").getStats();
get_indexes_stats_1: |-
Expand Down Expand Up @@ -290,9 +343,6 @@ search_parameter_guide_highlight_tag_1: |-
.setHighlightPreTag("<span class=\"highlight\">")
.setHighlightPostTag("</span>");
client.index("movies").search(searchRequest);
search_parameter_guide_matches_1: |-
SearchRequest searchRequest = new SearchRequest("winter feast").setMatches(true);
SearchResult searchResult = index.search(searchRequest);
settings_guide_synonyms_1: |-
Settings settings = new Settings();
HashMap<String, String[]> synonyms = new HashMap<String, String[]>();
Expand Down Expand Up @@ -354,6 +404,8 @@ settings_guide_sortable_1: |-
"author",
});
client.index("books").updateSettings(settings);
settings_guide_faceting_1: |-
settings_guide_pagination_1: |-
settings_guide_typo_tolerance_1: |-
TypoTolerance typoTolerance = new TypoTolerance();
HashMap<String, Integer> minWordSizeTypos =
Expand Down Expand Up @@ -428,7 +480,7 @@ getting_started_add_documents_md: |-

[About this SDK](https://github.com/meilisearch/meilisearch-java)
getting_started_check_task_status: |-
client.index("movies").getTask(0);
client.getTask(0);
getting_started_search_md: |-
```java
client.index("movies").search("botman");
Expand Down Expand Up @@ -527,9 +579,9 @@ faceted_search_filter_1: |-
new String[] {"genres = Horror", "genres = Mystery"},
new String[] {"director = \"Jordan Peele\""}});
client.index("movies").search(searchRequest);
faceted_search_facets_distribution_1: |-
faceted_search_facets_1: |-
SearchRequest searchRequest =
new SearchRequest("Batman").setFacetsDistribution(new String[] {"genres"});
new SearchRequest("Batman").setFacets(new String[] {"genres"});
client.index("movies").search(searchRequest);
faceted_search_walkthrough_filter_1: |-
SearchRequest searchRequest =
Expand Down Expand Up @@ -562,8 +614,6 @@ landing_getting_started_1: |-
);
post_dump_1: |-
client.createDump();
get_dump_status_1: |-
client.getDumpStatus("20201101-110357260");
phrase_search_1: |-
client.index("movies").search("\"african american\" horror");
sorting_guide_update_sortable_attributes_1: |-
Expand All @@ -589,13 +639,12 @@ sorting_guide_sort_parameter_2: |-
SearchRequest searchRequest = new SearchRequest("butler").setSort(new String[] {"author:desc"});
client.index("books").search(searchRequest);
get_sortable_attributes_1: |-
client.index("books").getSortableAttributes();
client.index("books").getSettings().getSortableAttributes();
update_sortable_attributes_1: |-
Settings settings = new Settings();
settings.setSortableAttributes(new String[] {"price", "author"});
client.index("books").updateSettings(settings);
reset_sortable_attributes_1: |-
//Not yet implemented
search_parameter_guide_sort_1: |-
SearchRequest searchRequest = new SearchRequest("science fiction").setSort(new String[] {"price:asc"});
client.index("search_parameter_guide_sort_1").search(searchRequest);
Expand Down Expand Up @@ -643,7 +692,8 @@ security_guide_search_key_1: |-
Client client = new Client(new Config("http://localhost:7700", "apiKey"));
client.index("patient_medical_records").search();
security_guide_update_key_1: |-
//Not yet implemented
Client client = new Client(new Config("http://localhost:7700", "masterKey"));
client.updateKey("74c9c733-3368-4738-bbe5-1d18a5fecb37", new KeyUpdate().setDescription("Default Search API Key"));
security_guide_create_key_1: |-
Client client = new Client(new Config("http://localhost:7700", "masterKey"));

Expand All @@ -663,7 +713,7 @@ security_guide_list_keys_1: |-
client.getKeys();
security_guide_delete_key_1: |-
Client client = new Client(new Config("http://localhost:7700", "masterKey"));
client.deleteKey("d0552b41536279a0ad88bd595327b96f01176a60c2243e906c52ac02375f9bc4");
client.deleteKey("c5cd97d-5a4b-4226-a868-2d0eb6d197ab");
authorization_header_1: |-
Client client = new Client(new Config("http://localhost:7700", "masterKey"));
client.getKeys();
Expand All @@ -679,7 +729,7 @@ tenant_token_guide_generate_sdk_1: |-
options.setApiKey("B5KdX2MY2jV6EXfUs6scSfmC...");
options.setExpiresAt(expiresAt);

String token = client.generateTenantToken(searchRules, options);
String token = client.generateTenantToken("85c3c2f9-bdd6-41f1-abd8-11fcf80e0f76", searchRules, options);
tenant_token_guide_search_sdk_1: |-
Client frontEndClient = new Client(new Config("http://localhost:7700", token));
frontEndClient.index("patient_medical_records").search("blood test");
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ jobs:
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Meilisearch (v0.27.2 version) setup with Docker
run: docker run -d -p 7700:7700 getmeili/meilisearch:v0.27.2 meilisearch --no-analytics --master-key='masterKey'
- name: Meilisearch (v0.28.1 version) setup with Docker
run: docker run -d -p 7700:7700 getmeili/meilisearch:v0.28.1 meilisearch --no-analytics --master-key='masterKey'
- name: Build and run unit and integration tests
run: ./gradlew build integrationTest
- name: Archive test report
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class TestMeilisearch {
Index index = client.index("movies");

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

```
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)
SearchResult(hits=[{id=1.0, title=Carol, genres:[Romance, Drama]}], offset=0, limit=20, estimatedTotalHits=1, facetDistribution=null, processingTimeMs=3, query=carlo)
```

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

SearchResult results = index.search(
new SearchRequest("of")
.setMatches(true)
.setShowMatchesPosition(true)
.setAttributesToHighlight(new String[]{"title"})
);
System.out.println(results.getHits());
Expand All @@ -173,10 +173,10 @@ System.out.println(results.getHits());
"title":"Life <em>of</em> Pi",
"genres":["Adventure","Drama"]
},
"_matchesInfo":{
"_matchesPosition":{
"title":[{
"start":5,
"length":2
"start":5.0,
"length":2.0
}]
}
}]
Expand Down Expand Up @@ -217,7 +217,7 @@ index.search(
],
"offset": 0,
"limit": 20,
"nbHits": 1,
"estimatedTotalHits": 1,
"processingTimeMs": 0,
"query": "wonder"
}
Expand Down Expand Up @@ -265,7 +265,7 @@ Client client = new Client(config);

## 🤖 Compatibility with Meilisearch

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

## 💡 Learn more

Expand Down
Loading