Repository navigation
Update documents API for Meilisearch v.28 - #518
Conversation
53d7e55 to
a79f2be
Compare
brunoocasali
left a comment
There was a problem hiding this comment.
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.
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.
This can be used in the getDocuments, getDocument, getRawDocuments, and getRawDocument
a7b8357 to
67cd327
Compare
bidoubiwa
left a comment
There was a problem hiding this comment.
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.
can you use toQuery here?
There was a problem hiding this comment.
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.
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.
I think it would be:
public String toQuery(String uid, String identifier, String primaryKey) {
It could but we don't use identifier
Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com>
Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com>
Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com>
Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com>
Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com>
Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com>
Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com>
Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com>
Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com>
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 /documentsAdd 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.ResultsGET /documents:<T> Results<T> getDocuments(Class<T> targetClass) throws MeilisearchException-> return anObjectString getRawDocuments()-> return aStringGET /documents/:uid:<T> Results<T> getDocument(String identifier, Class<T> targetClass) throws MeilisearchException-> return anObjectString getRawDocument(String identifier)-> return aStringgetRawDocumentgetRawDocuments