meilisearch / meilisearch-vue

https://www.meilisearch.com/
MIT License
154 stars 13 forks source link

Refine by specific attribute values #124

Closed karlomikus closed 1 year ago

karlomikus commented 1 year ago

I have the following resource ids available as an array that I want to use as a refinement:

I'm currently using toggle-refinement component in the following way:

// Toggle favorites
<ais-toggle-refinement attribute="id" :on="[1, 2, 3, 4]"></ais-toggle-refinement>
// Toggle create
<ais-toggle-refinement attribute="id" :on="[3, 4, 5, 6, 7]"></ais-toggle-refinement>

This solution kinda works, but the issue is:

Is there a better way to implement multiple refinements by the same attribute with a known list of values?

karlomikus commented 1 year ago

This seems to be a little too complicated so I went with a different route. Now I have buttons that toggle filters property on <ais-configure> component, like this:

<ais-configure filters="id IN [1, 2, 3, 4, 5]" />

You can also see this related discussion here: https://github.com/algolia/instantsearch/discussions/5416