Skip to content
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

Get documents by filter #385

Open
2 tasks
brunoocasali opened this issue Jun 5, 2023 · 0 comments
Open
2 tasks

Get documents by filter #385

brunoocasali opened this issue Jun 5, 2023 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@brunoocasali
Copy link
Member

⚠️ This issue is generated, it means the examples and the namings do not necessarily correspond to the language of this repository.
Also, if you are a maintainer, feel free to add any clarification and instruction about this issue.

Sorry if this is already partially/completely implemented, feel free to let me know about the state of this issue in the repo.

Related to meilisearch/integration-guides#261


This issue is divided in two sections, first you need to make the implementation, second you must update the code-samples (no one likes a outdated docs, right?).

New implementation

Related to:

Gives the user the possibility to use a filter expression to retrieve documents, like in search.

Implement in the getDocuments method an internal conditional allowing the user to query the documents with the same method but using a new filter method.

When the user calls the get documents method with a filter argument, request POST /indexes/{index_uid}/documents/fetch using a JSON body containing an int offset, int limit, String[] fields and now String filter or String[] filter.
⚠️ If the method invocation does not contain a filter it should still call the previous implementation.

Code samples:

Inside of this file: .code-samples.meilisearch.yml:

  1. Replace this key: get_documents_1: content to use the filter genres=action, keep the index name and the limit just add the filter.
    Use this as a reference if the previous description was not helpful::
get_documents_1: |- 
  GET 'http://localhost:7700/indexes/movies/documents?limit=2&filter=genres=action
  mind the filter in the query param (use the POST route in the integrations)
  1. Create a new entry with this key get_documents_post_1: containing a call to the getDocuments method
    using the new behavior from the index movies using the filter param with this string "genres = action OR genres = adventure".

Use this as a reference if the previous description was not helpful:

get_documents_post_1: |-
  POST http://localhost:7700/indexes/books/documents/fetch
  with data: { 
    "filter": "(rating > 3 AND (genres = Adventure OR genres = Fiction)) AND language = English",
    "fields": ["title", "genres", "rating", "language"],
    "limit": 3
  }

Todo:

  • Implement the getDocuments new behavior keeping the old behavior when possible.
  • Update the code-samples according to this issue.
@brunoocasali brunoocasali added good first issue Good for newcomers enhancement New feature or request labels Jun 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant