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
feat(facets): apply result from facet ordering (#4784)
* feat(facets): apply sort from facetOrdering
* feat(facets): apply result from facet ordering
This adds a new option "facetOrdering" (boolean) to refinementList, menu, hierarchicalMenu which will read facet ordering from the results if available, but fall back to sortBy if no facetOrdering is available.
The option facetOrdering defaults to `true` if no sortBy is given, to make it apply out of the box.
references:
- NLP-110
- [RFC 45](https://github.com/algolia/instantsearch-rfcs/blob/master/accepted/flexible-facet-values.md)
* forward facetOrdering option from widget
* suppress v3 ts errors
* remove option
* test: rename
@@ -79,6 +81,8 @@ export type HierarchicalMenuConnectorParams = {
79
81
/**
80
82
* How to sort refinements. Possible values: `count|isRefined|name:asc|name:desc`.
81
83
* You can also use a sort function that behaves like the standard Javascript [compareFunction](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Syntax).
84
+
*
85
+
* If a facetOrdering is set in the index settings, it is used when sortBy isn't passed
82
86
*/
83
87
sortBy?: SortBy<HierarchicalMenuItem>;
84
88
/**
@@ -174,7 +178,7 @@ const connectHierarchicalMenu: HierarchicalMenuConnector = function connectHiera
@@ -59,6 +61,8 @@ export type MenuConnectorParams = {
59
61
* How to sort refinements. Possible values: `count|isRefined|name:asc|name:desc`.
60
62
*
61
63
* You can also use a sort function that behaves like the standard Javascript [compareFunction](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Syntax).
64
+
*
65
+
* If a facetOrdering is set in the index settings, it is used when sortBy isn't passed
62
66
*/
63
67
sortBy?: SortBy<MenuItem>;
64
68
/**
@@ -147,7 +151,7 @@ const connectMenu: MenuConnector = function connectMenu(
@@ -74,6 +76,10 @@ export type RefinementListConnectorParams = {
74
76
showMoreLimit?: number;
75
77
/**
76
78
* How to sort refinements. Possible values: `count|isRefined|name:asc|name:desc`.
79
+
*
80
+
* You can also use a sort function that behaves like the standard Javascript [compareFunction](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Syntax).
81
+
*
82
+
* If a facetOrdering is set in the index settings, it is used when sortBy isn't passed
77
83
*/
78
84
sortBy?: SortBy<RefinementListItem>;
79
85
/**
@@ -182,7 +188,7 @@ const connectRefinementList: RefinementListConnector = function connectRefinemen
0 commit comments