-
Notifications
You must be signed in to change notification settings - Fork 115
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
Update documents API for Meilisearch v.28 #518
Conversation
53d7e55
to
a79f2be
Compare
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 left a comment, but it applies to every occurrence of the queries :)
I really think it will improve the complexity of the code :)
* @return Object containing the requested document | ||
* @throws MeilisearchException if the client request causes an error | ||
*/ | ||
<T> T getDocument(String uid, String identifier, Class<T> targetClass) |
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.
You have to also add support to fields
, which allows the user to reduce the payload meilisearch will return like we have here: https://github.com/meilisearch/meilisearch-python/blob/a6dc0631103a495d109ff6b69e288193d1b22b73/tests/index/test_index_document_meilisearch.py#L71-L78.
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.
This can be used in the getDocuments
, getDocument
, getRawDocuments
, and getRawDocument
a7b8357
to
67cd327
Compare
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.
Could you go over the different method documentations to update
- The explanations
- The
@param param
- The return statement
I started suggesting on a lot of them
URLBuilder urlb = new URLBuilder(); | ||
urlb.addSubroute("indexes").addSubroute(uid).addSubroute("documents"); | ||
if (primaryKey != null) { | ||
urlPath += "?primaryKey=" + primaryKey; | ||
urlb.addParameter("primaryKey", primaryKey); | ||
} | ||
String urlPath = urlb.getURL(); |
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.
can you use toQuery here?
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.
There already is an overload of toQuery
with 2 String
as parameters:
public String toQuery(String uid, String identifier)
So I can create a new one but with another name like toQueryWithPrimaryKey
...
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 think it would be:
public String toQuery(String uid, String identifier, String primaryKey) {
Which I don't think exists yet in the toQuery
But yes, it becomes to specific... so you are right. Until we find something more generic your solution is maybe better.
@brunoocasali what do you think?
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 think it would be:
public String toQuery(String uid, String identifier, String primaryKey) {
It could but we don't use identifier
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.
@brunoocasali what do you think?
Same
Co-authored-by: cvermand <[email protected]>
Co-authored-by: cvermand <[email protected]>
Co-authored-by: cvermand <[email protected]>
Co-authored-by: cvermand <[email protected]>
Co-authored-by: cvermand <[email protected]>
Co-authored-by: cvermand <[email protected]>
Co-authored-by: cvermand <[email protected]>
Co-authored-by: cvermand <[email protected]>
Co-authored-by: cvermand <[email protected]>
Pull Request
Related to: meilisearch/integration-guides#205
What does this PR do?
Breaking because enforces the users to use Meilisearch v0.28.0
GET /documents/:uid
,GET /documents
Add the possibility to reduce the body payload by using a query parameter calledfields
(previously calledattributesToRetrieve
), check the issue and the spec for the entire behavior.Results
GET /documents
:<T> Results<T> getDocuments(Class<T> targetClass) throws MeilisearchException
-> return anObject
String getRawDocuments()
-> return aString
GET /documents/:uid
:<T> Results<T> getDocument(String identifier, Class<T> targetClass) throws MeilisearchException
-> return anObject
String getRawDocument(String identifier)
-> return aString
getRawDocument
getRawDocuments