-
Notifications
You must be signed in to change notification settings - Fork 122
Update Index API for Meilisearch v.28 #516
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
Conversation
dcbac9a
to
dd2e34b
Compare
dd2e34b
to
a536d17
Compare
a536d17
to
784e044
Compare
@@ -105,7 +105,8 @@ public static void deleteAllIndexes() { | |||
Client ms = new Client(new Config(getMeilisearchHost(), "masterKey")); | |||
Results<Index> indexes = ms.getIndexes(); | |||
for (Index index : indexes.getResults()) { | |||
ms.deleteIndex(index.getUid()); | |||
TaskInfo task = ms.deleteIndex(index.getUid()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice change! 👯
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see the updateIndex
method.
Can you also change the name of the PR with more context? For example
Update Index API for Meilisearch v.28
It's on line 151 on |
Co-authored-by: cvermand <[email protected]>
Co-authored-by: cvermand <[email protected]>
Co-authored-by: cvermand <[email protected]>
Co-authored-by: cvermand <[email protected]>
314caf9
to
541cb0b
Compare
* @throws MeilisearchException if an error occurs | ||
*/ | ||
String getAll() throws MeilisearchException { | ||
Results<Index> getIndexes() throws MeilisearchException { | ||
return httpClient.get("/indexes", Results.class, Index.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be nice to use IndexesQuery
everywhere so that we only hardcode /indexes
in toQuery
. Nonetheless, maybe it is worth creating an issue for that change to avoid making this PR more complex
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can indeed do this but it means creating a new function that will require resources and complicate the general call such as:
return httpClient.get("/indexes", Results.class, Index.class);
will became:
return httpClient.get(new IndexesQuery().toQuery(), Results.class, Index.class);
Not sure it worth it but we can also just create a variable in the IndexesHandler
class:
String indexesPath = "/indexes";
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer the second option for consistency, but you are maybe right. You can ignore this for the moment but I would like the opinion of @brunoocasali on that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Me too !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My initial conception around IndexesQuery
, KeysQuery
, and so on, where to handle query parameters. If we are very strict, we can say that the /indexes
path is related to the URL, not the query parameters, so it shouldn't be inside.
In any case, I don't think /indexes
should be treated as handled inside of IndexesQuery
, but if we use a private constant
inside of IndexesHandler
is enough.
If the path change in the future, we will have two places to change the tests, IndexesQuery
and IndexesHandler
.
Co-authored-by: cvermand <[email protected]>
Co-authored-by: cvermand <[email protected]>
Co-authored-by: cvermand <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🔥🔥🔥🔥🔥
Nice work ✨✨✨✨
Pull Request
Related to: meilisearch/meilisearch#2373
What does this PR do?
Changes
client.getIndexes()
accept pagination metadata, added limit (default: 20), offset (default: 0), totalResults
objectclient.getRawIndex()
methodclient.getRawIndexes()
method return aString
IndexesQuery
classreturns for example
returns for example