I’m entirely new to Algolia and currently working with the
ais-refinement-list component in Vue.
I’ve run into a problem with how items are counted after a
transformItems method has been applied.
What I’m tryin to achieve
To have a number of refinement lists based on different branches from a hierarchical taxonomy, with
The taxonomy is generated by Wordpress.
My current method
The only way to achieve this, as far as I can tell, is to set the entire level from the hierarchy as the
<ais-refinement-list :attribute="'taxonomies_hierarchical.brand.lvl1'" :transformItems="items => filterItems(items, path)" :limit="10" />
This of course requires me to filter out a lot of items for each refinement list.
filterItems method takes all of the items from the level and a
The method compares the
item.label with the
path, if the beginning of the label matches the path, the item is pushed to the array that is returned from the filter method.
The problem / My theory
Let’s say I start out with 40 items. After
transformItems has done its thing I end up with 15 items. My
limit is set to 10 items, but what I’m seeing in the end might only be 3 items.
I’m guessing this is because
limit is compared to the length of the original array of items and not the array returned from
1. RefinementList better hierarchy support
I would much prefer no to have to do the filtering at all, but it doesn’t seem possible to point to a specific branch/node in the hierarchy. Is this correct, or am i missing something?
2. transformItems / limit — Fix or workaround
I haven’t been able to get these two to play well together, even though I’ve tried various things.
Any help would be appreciated.