|
| 1 | +--- |
| 2 | +"@meilisearch/instant-meilisearch": minor |
| 3 | +--- |
| 4 | + |
| 5 | +- Change the behavior of the `or` operator parameter on the [`RefinmentList`](https://www.algolia.com/doc/api-reference/widgets/refinement-list/js/) widget. |
| 6 | + |
| 7 | +⚠️ This impacts the facet distribution number |
| 8 | + |
| 9 | +## Drawback |
| 10 | + |
| 11 | +Currently, for each `facet value` selected in a different `facet` a separate request is made to Meilisearch. Plus, an additional one containing all the facets filters. It results in tedious search requests and a high bandwidth cost. |
| 12 | +For example, if I select `Adventure` on genres and `Multiplayer` on players, one request is made with both facet filters, one with only `genres=Adventure` and one with only `players=Multiplayer` |
| 13 | + |
| 14 | +In the next release of Meilisearch, a new `multi-search` API route is planned to be released (see [PR](https://github.com/meilisearch/meilisearch/pull/3417)). When it is released, the work-around will be removed and only one HTTP request will be done in all cases! |
| 15 | + |
| 16 | + |
| 17 | +## Explanation |
| 18 | + |
| 19 | +The way the `facetDistribution` is calculated changed. The `facetDistribution` shows the numbers of hits for each facet. For example: |
| 20 | + |
| 21 | +Given the following facet: |
| 22 | + |
| 23 | +``` |
| 24 | +Genres |
| 25 | +- [ ] Adventure 7 |
| 26 | +``` |
| 27 | + |
| 28 | +The `facetDistribution` provides the information that there are `7` hits containing the adventure genre. |
| 29 | + |
| 30 | +For the example, let's take the following facets: |
| 31 | + |
| 32 | +``` |
| 33 | +Genres |
| 34 | +- [ ] Adventure 7 |
| 35 | +- [ ] Action 5 |
| 36 | +- [ ] Science Fiction 5 |
| 37 | +Players |
| 38 | +- [ ] Multiplayer 11 |
| 39 | +- [ ] Single player 7 |
| 40 | +``` |
| 41 | + |
| 42 | +Before, when selecting a facet value in a certain facet, the distribution of that facet was impacted. |
| 43 | + |
| 44 | +``` |
| 45 | +- [x] Adventure 7 |
| 46 | +- [ ] Action 3 // <- number changed from 5 to 3 |
| 47 | +- [ ] Science Fiction 1 // <- number changed from 5 to 1 |
| 48 | +Players |
| 49 | +- [ ] Multiplayer 6 |
| 50 | +- [ ] Single player 3 |
| 51 | +``` |
| 52 | + |
| 53 | +With the new behavior, the distributed number are not changed when facet values are selected inside the same facet because a facet distribution is computed with a dedicated search request. |
| 54 | + |
| 55 | +``` |
| 56 | +Genres |
| 57 | +- [x] Adventure 7 |
| 58 | +- [ ] Action 5 // <- number did not change |
| 59 | +- [ ] Science Fiction 5 // <- number did not change |
| 60 | +Players |
| 61 | +- [ ] Multiplayer 6 |
| 62 | +- [ ] Single player 3 |
| 63 | +``` |
| 64 | + |
| 65 | +``` |
| 66 | +Genres |
| 67 | +- [x] Adventure 7 // changed because of Multiplayer |
| 68 | +- [ ] Action 4 |
| 69 | +- [ ] Science Fiction 3 |
| 70 | +Players |
| 71 | +- [x] Multiplayer 6 |
| 72 | +- [ ] Single player 3 |
| 73 | +``` |
| 74 | + |
| 75 | +This is the conventional way of calculating the facet distribution. Similar to Algolia's behavior. If you prefer the old behavior, please consider opening an issue. |
| 76 | + |
| 77 | +See [complete explanation here](https://github.com/meilisearch/instant-meilisearch/issues/884) |
0 commit comments