Skip to content

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

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

Merged
merged 81 commits into from
Jan 17, 2023
Merged
Show file tree
Hide file tree
Changes from 24 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
2 changes: 0 additions & 2 deletions .code-samples.meilisearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -562,8 +562,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 Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
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
66 changes: 35 additions & 31 deletions src/main/java/com/meilisearch/sdk/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@
import com.meilisearch.sdk.exceptions.MeilisearchException;
import com.meilisearch.sdk.json.JsonHandler;
import com.meilisearch.sdk.model.Key;
import com.meilisearch.sdk.model.Result;
import com.meilisearch.sdk.model.Results;
import com.meilisearch.sdk.model.Stats;
import com.meilisearch.sdk.model.Task;
import com.meilisearch.sdk.model.TaskInfo;
import com.meilisearch.sdk.model.TasksQuery;
import com.meilisearch.sdk.model.TasksResults;
import java.util.Date;
import java.util.Map;
import java.util.TimeZone;
Expand Down Expand Up @@ -43,10 +46,10 @@ public Client(Config config) {
* https://docs.meilisearch.com/reference/api/indexes.html#create-an-index
*
* @param uid Unique identifier for the index to create
* @return Meilisearch API response as Task
* @return Meilisearch API response as TaskInfo
* @throws MeilisearchException if an error occurs
*/
public Task createIndex(String uid) throws MeilisearchException {
public TaskInfo createIndex(String uid) throws MeilisearchException {
return this.createIndex(uid, null);
}

Expand All @@ -56,10 +59,10 @@ public Task createIndex(String uid) throws MeilisearchException {
*
* @param uid Unique identifier for the index to create
* @param primaryKey The primary key of the documents in that index
* @return Meilisearch API response as Task
* @return Meilisearch API response as TaskInfo
* @throws MeilisearchException if an error occurs
*/
public Task createIndex(String uid, String primaryKey) throws MeilisearchException {
public TaskInfo createIndex(String uid, String primaryKey) throws MeilisearchException {
return this.indexesHandler.create(uid, primaryKey);
}

Expand Down Expand Up @@ -137,10 +140,10 @@ public String getRawIndex(String uid) throws MeilisearchException {
*
* @param uid Unique identifier of the index to update
* @param primaryKey Primary key of the documents in the index
* @return Meilisearch API response as Task
* @return Meilisearch API response as TaskInfo
* @throws MeilisearchException if an error occurs
*/
public Task updateIndex(String uid, String primaryKey) throws MeilisearchException {
public TaskInfo updateIndex(String uid, String primaryKey) throws MeilisearchException {
return this.indexesHandler.updatePrimaryKey(uid, primaryKey);
}

Expand All @@ -149,33 +152,23 @@ public Task updateIndex(String uid, String primaryKey) throws MeilisearchExcepti
* https://docs.meilisearch.com/reference/api/indexes.html#delete-one-index
*
* @param uid Unique identifier of the index to delete
* @return Meilisearch API response as Task
* @return Meilisearch API response as TaskInfo
* @throws MeilisearchException if an error occurs
*/
public Task deleteIndex(String uid) throws MeilisearchException {
public TaskInfo deleteIndex(String uid) throws MeilisearchException {
return this.indexesHandler.delete(uid);
}

// TODO createDump will return a Task in v0.28
// /**
// * Triggers the creation of a Meilisearch dump.
// * https://docs.meilisearch.com/reference/api/dump.html#create-a-dump
// *
// * @return Dump instance
// * @throws MeilisearchException if an error occurs
// */
// public Dump createDump() throws MeilisearchException {
// return this.dumpHandler.createDump();
// }
// /**
// * Creates a dump https://docs.meilisearch.com/reference/api/dump.html#create-a-dump
// *
// * @return Dump object with Meilisearch API response
// * @throws MeilisearchException if an error occurs
// */
// public Dump createDump() throws MeilisearchException {
// return this.meiliSearchHttpRequest.post("/dumps", "", Dump.class);
// }
/**
* Triggers the creation of a Meilisearch dump.
* https://docs.meilisearch.com/reference/api/dump.html#create-a-dump
*
* @return Meilisearch API response as TaskInfo
* @throws MeilisearchException if an error occurs
*/
public TaskInfo createDump() throws MeilisearchException {
return config.httpClient.post("/dumps", "", TaskInfo.class);
}

/**
* Gets the status and availability of a Meilisearch instance
Expand Down Expand Up @@ -240,10 +233,21 @@ public Task getTask(int uid) throws MeilisearchException {
* @return List of tasks in the Meilisearch client
* @throws MeilisearchException if an error occurs
*/
public Result<Task> getTasks() throws MeilisearchException {
public TasksResults getTasks() throws MeilisearchException {
return this.tasksHandler.getTasks();
}

/**
* Retrieves list of tasks https://docs.meilisearch.com/reference/api/tasks.html#get-tasks
*
* @param param accept by the tasks route
* @return List of tasks in the Meilisearch client
* @throws MeilisearchException if an error occurs
*/
public TasksResults getTasks(TasksQuery param) throws MeilisearchException {
return this.tasksHandler.getTasks(param);
}

/**
* Waits for a task to be processed
*
Expand Down Expand Up @@ -272,7 +276,7 @@ public Key getKey(String uid) throws MeilisearchException {
* @return List of keys in the Meilisearch client
* @throws MeilisearchException if an error occurs
*/
public Result<Key> getKeys() throws MeilisearchException {
public Results<Key> getKeys() throws MeilisearchException {
return this.keysHandler.getKeys();
}

Expand Down
33 changes: 17 additions & 16 deletions src/main/java/com/meilisearch/sdk/Documents.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import static java.util.Collections.singletonList;

import com.meilisearch.sdk.exceptions.MeilisearchException;
import com.meilisearch.sdk.model.Task;
import com.meilisearch.sdk.model.TaskInfo;
import java.util.List;

/**
Expand Down Expand Up @@ -106,15 +106,16 @@ String getDocuments(String uid, int limit, int offset, List<String> attributesTo
* @param uid Partial index identifier for the document
* @param document String containing the document to add
* @param primaryKey PrimaryKey of the document
* @return Meilisearch's Task API response
* @return Meilisearch's TaskInfo API response
* @throws MeilisearchException if the client request causes an error
*/
Task addDocuments(String uid, String document, String primaryKey) throws MeilisearchException {
TaskInfo addDocuments(String uid, String document, String primaryKey)
throws MeilisearchException {
String urlQuery = "/indexes/" + uid + "/documents";
if (primaryKey != null) {
urlQuery += "?primaryKey=" + primaryKey;
}
return httpClient.post(urlQuery, document, Task.class);
return httpClient.post(urlQuery, document, TaskInfo.class);
}

/**
Expand All @@ -123,53 +124,53 @@ Task addDocuments(String uid, String document, String primaryKey) throws Meilise
* @param uid Partial index identifier for the document
* @param document String containing the document to replace the existing document
* @param primaryKey PrimaryKey of the document
* @return Meilisearch's Task API response
* @return Meilisearch's TaskInfo API response
* @throws MeilisearchException if the client request causes an error
*/
Task updateDocuments(String uid, String document, String primaryKey)
TaskInfo updateDocuments(String uid, String document, String primaryKey)
throws MeilisearchException {
String urlPath = "/indexes/" + uid + "/documents";
if (primaryKey != null) {
urlPath += "?primaryKey=" + primaryKey;
}
return httpClient.put(urlPath, document, Task.class);
return httpClient.put(urlPath, document, TaskInfo.class);
}

/**
* Deletes the document at the specified index uid with the specified identifier
*
* @param uid Partial index identifier for the requested document
* @param identifier ID of the document
* @return Meilisearch's Task API response
* @return Meilisearch's TaskInfo API response
* @throws MeilisearchException if the client request causes an error
*/
Task deleteDocument(String uid, String identifier) throws MeilisearchException {
TaskInfo deleteDocument(String uid, String identifier) throws MeilisearchException {
String urlPath = "/indexes/" + uid + "/documents/" + identifier;
return httpClient.delete(urlPath, Task.class);
return httpClient.delete(urlPath, TaskInfo.class);
}

/**
* Deletes the documents at the specified index uid with the specified identifiers
*
* @param uid Partial index identifier for the requested documents
* @param identifiers ID of documents to delete
* @return Meilisearch's Task API response
* @return Meilisearch's TaskInfo API response
* @throws MeilisearchException if the client request causes an error
*/
Task deleteDocuments(String uid, List<String> identifiers) throws MeilisearchException {
TaskInfo deleteDocuments(String uid, List<String> identifiers) throws MeilisearchException {
String urlPath = "/indexes/" + uid + "/documents/" + "delete-batch";
return httpClient.post(urlPath, identifiers, Task.class);
return httpClient.post(urlPath, identifiers, TaskInfo.class);
}

/**
* Deletes all documents at the specified index uid
*
* @param uid Partial index identifier for the requested documents
* @return Meilisearch's Task API response
* @return Meilisearch's TaskInfo API response
* @throws MeilisearchException if the client request causes an error
*/
Task deleteAllDocuments(String uid) throws MeilisearchException {
TaskInfo deleteAllDocuments(String uid) throws MeilisearchException {
String urlPath = "/indexes/" + uid + "/documents";
return httpClient.delete(urlPath, Task.class);
return httpClient.delete(urlPath, TaskInfo.class);
}
}
Loading