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
509: Changes related to the next MeiliSearch release (v0.22.0) r=bidoubiwa a=meili-bot
This PR gathers the changes related to the next MeiliSearch release (v0.22.0) so that this package is ready when the official release is out.
⚠️ This PR should NOT be merged until:
- the next release of MeiliSearch (v0.22.0) is out.
- the [`meilisearch-js`](https://github.com/meilisearch/meilisearch-js) dependency has been released to be compatible with MeiliSearch v0.22.0.
Once the release is out, the `meilisearch-js` version in this package should be upgraded and committed to this branch.
_This PR is auto-generated for the [pre-release week](https://github.com/meilisearch/integration-guides/blob/master/guides/pre-release-week.md) purpose._
Co-authored-by: meili-bot <[email protected]>
Co-authored-by: cvermand <[email protected]>
Co-authored-by: Charlotte Vermandel <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+103-6Lines changed: 103 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -178,7 +178,7 @@ This package only guarantees the compatibility with the [version v4 of InstantSe
178
178
179
179
**Supported MeiliSearch versions**:
180
180
181
-
This package only guarantees the compatibility with the [version v0.21.0 of MeiliSearch](https://github.com/meilisearch/MeiliSearch/releases/tag/v0.21.0).
181
+
This package only guarantees the compatibility with the [version v0.22.0 of MeiliSearch](https://github.com/meilisearch/MeiliSearch/releases/tag/v0.22.0).
182
182
183
183
**Node / NPM versions**:
184
184
@@ -189,6 +189,47 @@ This package only guarantees the compatibility with the [version v0.21.0 of Meil
189
189
190
190
List of all the components that are available in [instantSearch](https://github.com/algolia/instantsearch.js) and their compatibilty with [MeiliSearch](https://github.com/meilisearch/meilisearch/).
@@ -521,7 +562,7 @@ Min and max of attributes are not returned from MeiliSearch and thus **must be s
521
562
522
563
If the attribute is not in the [`filterableAttributes`](https://docs.meilisearch.com/reference/features/filtering_and_faceted_search.html#configuring-filters) setting list, filtering on this attribute is not possible.
523
564
524
-
Example:
565
+
Example:
525
566
Given the attribute `id` that has not been added in `filterableAttributes`:
526
567
527
568
```js
@@ -738,15 +779,71 @@ The queryRuleContext widget lets you apply ruleContexts based on filters to trig
738
779
739
780
No compatibility because MeiliSearch does not support Rules.
740
781
741
-
### ❌ SortBy
782
+
### ✅ SortBy
742
783
743
784
[Sort by references](https://www.algolia.com/doc/api-reference/widgets/sort-by/js/)
744
785
745
-
The sortBy widget displays a list of indices, allowing a user to change the way hits are sorted (with replica indices). Another common use case is to let the user switch between different indices.
786
+
The `SortBy` widget is used to create multiple sort formulas. Allowing a user to change the way hits are sorted.
746
787
747
-
No compatibility because MeiliSearch does not support hierarchical facets.
788
+
- ✅ container: The CSS Selector or HTMLElement to insert the widget into. _required_
789
+
- ✅ items: The list of different sorting possibilities. _required_
790
+
- ✅ cssClasses: The CSS classes to override.
791
+
- ✅ transformItems: function receiving the items, called before displaying them.
792
+
793
+
The usage of the `SortBy` widget differs from the one found in Algolia's documentation. In instant-meilisearch the following is possible:
794
+
795
+
- Sort using different indexes.
796
+
- Different `sort` rules on the same index.
797
+
798
+
The items list is composed of objects containing every sort possibility you want to provide to your user. Each object must contain two fields:
799
+
-`label`: What is showcased on the user interface ex: `Sort by Ascending Price`
800
+
-`value`: The sort formula.
801
+
802
+
#### Sort formula
803
+
804
+
A sort formula is expressed like this: `index:attribute:order`.
805
+
806
+
`index` is mandatory, and when adding `attribute:order`, they must always be added together.
748
807
749
-
If you'd like to get the "SortBy" feature, please vote for it in the [roadmap]https://roadmap.meilisearch.com/c/32-sort-by?utm_medium=social&utm_source=portal_share).
808
+
When sorting on an attribute, the attribute has to be added to the [`sortableAttributes`](https://docs.meilisearch.com/reference/api/sortable_attributes.html) setting on your index.
809
+
810
+
Example:
811
+
```js
812
+
[
813
+
{ label:'Sort By Price', value:'clothes:price:asc' }
814
+
]
815
+
```
816
+
817
+
In this scenario, in the `clothes` index, we want the price to be sorted in an ascending way. For this formula to be valid, `price` must be added to the `sortableAttributes` settings of the `clothes` index.
818
+
819
+
#### Relevancy
820
+
821
+
The impact sorting has on the returned hits is determined by the [`ranking-rules`](https://docs.meilisearch.com/learn/core_concepts/relevancy.html#ranking-rules) ordered list of each index. The `sort` ranking-rule position in the list makes sorting documents more or less important than other rules. If you want to change the sort impact on the relevancy, it is possible to change it in the [ranking-rule setting](https://docs.meilisearch.com/learn/core_concepts/relevancy.html#relevancy). For example, to favor exhaustivity over relevancy.
822
+
823
+
See [relevancy guide](https://docs.meilisearch.com/learn/core_concepts/relevancy.html#relevancy).
824
+
825
+
#### Example
826
+
827
+
```js
828
+
instantsearch.widgets.sortBy({
829
+
container:'#sort-by',
830
+
items: [
831
+
{ value:'clothes', label:'Relevant' }, // default index
832
+
{
833
+
value:'clothes:price:asc', // Sort on descending price
834
+
label:'Ascending price using query time sort',
835
+
},
836
+
{
837
+
value:'clothes:price:asc', // Sort on ascending price
838
+
label:'Descending price using query time sort',
839
+
},
840
+
{
841
+
value:'clothes-sorted', // different index with different ranking rules.
0 commit comments