How to find all tags in an index? Then get count of each tags?
Hello,
I have around 1000 tags (or more) in my index.
1 / I would like to display all theses tags.
2 / And once I have all these tags, I would like to show a count with the number of items with this tags.
3 / Order by DESC the tags by the most used tags
Is there a way to that please?
Hey @Steffi3rd, this is not going to be possible, there's a limit on how many tags you can show, as well as the number of hits in a regular result. You can read more about that here:
- https://www.algolia.com/doc/api-reference/api-parameters/maxValuesPerFacet/
If you choose to go for hits instead of facets, you can take a look at:
- https://www.algolia.com/doc/api-reference/api-parameters/paginationLimitedTo
- combined with: https://www.algolia.com/doc/api-reference/api-parameters/hitsPerPage/
Hope that helps you!
@Haroenv Hello ! okay, thanks for your solutions.
So what can I do if I want to find the 10 most used tags?
What do you mean with "most used"? If you mean "with the most results", then that's the default behaviour, but you can also see sortFacetValuesBy: count
I mean something like this :
I have an index named "Items" like in Algolia.
item 1 { tags: ["X", "Y"] }
item 2 { tags: ["Y"] }
item 3 { tags: ["Y"] }
item 4 { tags: ["Y"] }
item 5 { tags: [] }
item 6 { tags: ["X"] }
item 7 { tags: ["Y", "X"] }
item 8 { tags: ["Z", "Y"] }
Then I would like to find which tags is the most used.
In this example, we see that "Y" is the most used tag, then it's "X", and finally "Z"
So the results I would like to have is :
- "Y" (6)
- "X" (3)
- "Z" (1)
like this? https://www.algolia.com/doc/api-reference/widgets/refinement-list/react/
When using multiple refinement lists (for example with country and city facets), the items returned by the country change to a single country if a city is selected. Is it possible to have a refinementList always display all items regardless of the current filters?
Only what can be filtered further is displayed, to avoid people seeing zero results often @everdrone
Only what can be filtered further is displayed, to avoid people seeing zero results often @everdrone
This means that from the country <select> menu, all other countries are going to disappear if a city is selected, making it harder for the user to switch. Since the user needs to first deselect the city, then pick a new country and then filter by city again.
Isn't there a way to get around this? @Haroenv
I can't think of an easy way for this. If you only allow a single refinement per level, you can use HierarchicalMenu @everdrone
@everdrone Does @Haroenv's suggestion work for you?
Yes, eventually I went for the single refinement as suggested