You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|**[`proximityPrecision`](#proximity-precision)**| String |`"byWord"`| Precision level when calculating the proximity ranking rule |
168
168
|**[`facetSearch`](#facet-search)**| Boolean |`true`| Enable or disable [facet search](/reference/api/facet_search) functionality |
@@ -684,13 +684,43 @@ You can use the returned `taskUid` to get more details on [the status of the tas
684
684
685
685
## Filterable attributes
686
686
687
-
Attributes in the `filterableAttributes` list can be used as filters or facets.
687
+
Attributes in the `filterableAttributes` list can be used as [filters](/learn/filtering_and_sorting/filter_search_results) or [facets](/learn/filtering_and_sorting/search_with_facet_filters).
688
688
689
689
<Capsuleintent="warning">
690
-
Updating filterable attributes will re-index all documents in the index, which can take some time. We recommend updating your index settings first and then adding documents as this reduces RAM consumption.
690
+
Updating filterable attributes will re-index all documents in the index, which can take some time. To reduce RAM consumption, first update your index settings and then add documents.
691
691
</Capsule>
692
692
693
-
[To learn more about filterable attributes, refer to our dedicated guide.](/learn/filtering_and_sorting/filter_search_results)
693
+
### Filterable attribute object
694
+
695
+
`filterableAttributes` may be an array of either strings filterable attribute objects.
696
+
697
+
Filterable attribute objects must contain the following fields:
|**`attributePatterns`**| Array of strings |`[]`| A list of strings indicating filterable fields |
702
+
|**`features`**| Object |`{"facetSearch": false, "filters": {"equality": true, "comparison": false}`| A list outlining filter types enabled for the specified attributes |
703
+
704
+
#### `attributePatterns`
705
+
706
+
Attribute patterns may begin or end with a * wildcard to match multiple fields: `customer_*`, `attribute*`.
707
+
708
+
#### `features`
709
+
710
+
`features` allows you to decide which filter features are allowed for the specified attributes. It accepts the following fields:
711
+
712
+
-`facetSearch`: Whether facet search should be enabled for the specified attributes. Boolean, defaults to `false`
713
+
-`filter`: A list outlining the filter types for the specified attributes. Must be an object and accepts the following fields:
714
+
-`equality`: Enables `=`, `!=`, `IN`, `EXISTS`, `IS NULL`, `IS EMPTY`, `NOT`, `AND`, and `OR`. Boolean, defaults to `true`
715
+
-`comparison`: Enables `>`, `>=`, `<`, `<=`, `TO`, `EXISTS`, `IS NULL`, `IS EMPTY`, `NOT`, `AND`, and `OR`. Boolean, defaults to `false`
716
+
717
+
Calculating `comparison` filters is a resource-intensive operation. Disabling them may lead to better search and indexing performance. `equality` filters use fewer resources and have limited impact on performance.
718
+
719
+
<Capsuleintent="warning"title="Filterable attributes and reserved attributes">
720
+
Use the simple string syntax to match reserved attributes. Reserved Meilisearch fields are always prefixed with an underscore (`_`), such as `_geo` and `_vector`.
721
+
722
+
If set as a filterable attribute, reserved attributes ignore the `features` field and automatically activate all search features. Reserved fields will not be matched by wildcard `attributePatterns` such as `_*`.
723
+
</Capsule>
694
724
695
725
### Get filterable attributes
696
726
@@ -736,15 +766,28 @@ Update an index's filterable attributes list.
736
766
[<String>, <String>, …]
737
767
```
738
768
739
-
An array of strings containing the attributes that can be used as filters at query time.
769
+
An array of strings containing the attributes that can be used as filters at query time. All filter types are enabled for the specified attributes when using the array of strings format.
740
770
741
-
If an attribute contains an object, you can use dot notation to set one or more of its keys as a value for this setting: `"filterableAttributes": ["release_date.year"]`.
771
+
You may also use an array of objects:
742
772
743
-
<Capsuleintent="warning">
744
-
If the field does not exist, no error will be thrown.
745
-
</Capsule>
773
+
```
774
+
[
775
+
{
776
+
"attributePatterns": [<String>, <String>, …],
777
+
"features": {
778
+
"facetSearch": <Boolean>,
779
+
"filter": {
780
+
"equality": <Boolean>,
781
+
"comparison": <Boolean>
782
+
}
783
+
}
784
+
}
785
+
]
786
+
```
787
+
788
+
If the specified field does not exist, Meilisearch will silently ignore it.
746
789
747
-
[To learn more about filterable attributes, refer to our dedicated guide.](/learn/filtering_and_sorting/filter_search_results)
790
+
If an attribute contains an object, you can use dot notation to set one or more of its keys as a value for this setting: `"filterableAttributes": ["release_date.year"]` or `"attributePatterns": ["release_date.year"]`.
748
791
749
792
#### Example
750
793
@@ -821,7 +864,7 @@ Locale objects must have the following fields:
0 commit comments