Skip to content

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

Merged
merged 5 commits into from
Jul 7, 2022

Conversation

alallema
Copy link
Contributor

@alallema alallema commented Jul 5, 2022

Pull Request

What does this PR do?

Add pagination parameters to the get_document() method
Fix if parameters is a list in get_document() and get_tasks()

@alallema alallema requested a review from bidoubiwa July 5, 2022 13:18
@alallema alallema changed the title Add pagination parameters to get_document Add pagination parameters to the get_document() method Jul 5, 2022
@@ -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]:
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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

@alallema alallema requested a review from bidoubiwa July 6, 2022 12:41
@alallema alallema requested a review from bidoubiwa July 7, 2022 07:56
Copy link
Contributor

@bidoubiwa bidoubiwa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🔥

@alallema alallema merged commit e677b44 into bump-meilisearch-v0.28.0 Jul 7, 2022
@alallema alallema deleted the documents_changes branch July 7, 2022 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants