Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Facets and filters behavior #152

Closed
4 tasks
curquiza opened this issue Apr 8, 2021 · 1 comment · Fixed by #204
Closed
4 tasks

Facets and filters behavior #152

curquiza opened this issue Apr 8, 2021 · 1 comment · Fixed by #204

Comments

@curquiza
Copy link
Member

curquiza commented Apr 8, 2021

Implement behavior in this spec: https://github.com/meilisearch/specifications/blob/main/text/0027-filter-and-facet-behavior.md

  • The facetFilters parameter during the search is removed. Only filter can be used.
  • The users need to set the attributes to attributesForFaceting to use the filters during the search via the filter parameter. But they don't have to specify the type. Milli must accept only attributesForFaceting in an array like this:
{
  "attributesForFaceting": ["author", "price"]
}

=> this is the current MeiliSearch v0.20.0 behavior: https://docs.meilisearch.com/reference/api/attributes_for_faceting.html#attributes-for-faceting
=> this means milli has to create two data structures: one for the strings and one for the numbers. No conversions are done in the user documents: "price": "12" is not considered as a numeric field and should be in the string data structure.

  • when applying filter with a numeric operator, milli should search into the number data structure only. Otherwise in both data structures. More detail in the spec.
  • The filter parameter can accept both syntaxes: string (with OR/AND/NOT) and array. An element of an array syntax can accept the string syntax. The first depth of the array syntax is combined with ANDs, the second depth is combined with ORs.

Feel free to complete my issue @Kerollmops with all the technical parts we need to implement these and if some parts need to be implemented on the transplant side 🙂

@curquiza curquiza changed the title Facet behavior Facets and filters behavior Apr 8, 2021
@curquiza
Copy link
Member Author

⚠️ I updated the issue, the parameter filters is now filter.

bors bot added a commit that referenced this issue May 31, 2021
184: Transfer numbers and strings facets into the appropriate facet databases r=Kerollmops a=Kerollmops

This pull request is related to #152 and changes the layout of the facets values, numbers and strings are now in dedicated databases and the user no more needs to define the type of the fields. No more conversion between the two types is done, numbers (floats and integers converted to f64) go to the facet float database and strings go to the strings facet database.

There is one related issue that I found regarding CSVs, the values in a CSV are always considered to be strings, [meilisearch/specifications#28](https://github.com/meilisearch/specifications/blob/d916b57d748628c3b45500e9dfa46b50dfa2ad3f/text/0028-indexing-csv.md) fixes this issue by allowing the user to define the fields types using `:` in the "CSV Formatting Rules" section.

All previous tests on facets have been modified to pass again and I have also done hand-driven tests with the 115m songs dataset. Everything seems to be good!

Fixes #192.

Co-authored-by: Clément Renault <clement@meilisearch.com>
Co-authored-by: Kerollmops <clement@meilisearch.com>
@bors bors bot closed this as completed in 834504a Jun 2, 2021
@bors bors bot closed this as completed in #204 Jun 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant