-
Notifications
You must be signed in to change notification settings - Fork 90
Add pagination parameters to the get_document()
method
#492
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
get_document()
method
meilisearch/index.py
Outdated
@@ -249,7 +249,7 @@ def search(self, query: str, opt_params: Optional[Dict[str, Any]] = None) -> Dic | |||
body=body | |||
) | |||
|
|||
def get_document(self, document_id: str) -> Dict[str, Any]: | |||
def get_document(self, document_id: str, fields: Optional[List[str]] = None) -> Dict[str, Any]: |
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.
Do you prefer adding fields as a parameter of the function or a parameter object like on the other routes in case tomorrow we add new params on get_document
?
ex:
def get_document(self, document_id: str, parameters: Optional[Dict[str, Any]] = None) -> List[Dict[str, Any]]:
With that we can add new parameters for the get_document
route without having to create new function parameters each time.
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 is a very good remark but is it worth making a parameter more complex in the risk that others are added, that may never happen.
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 asked the product team and it is quite likely! I will modify it
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 🔥
Pull Request
What does this PR do?
Add pagination parameters to the
get_document()
methodFix if parameters is a list in
get_document()
andget_tasks()