简体   繁体   中英

Algolia instantsearch.js: how to get all facets

I'm using instantsearch.js v4 and I'm trying to get a list of all facets configured in a index. (the ones defined in the Algolia dashboard)

There's a way to do that?

I'm not trying to get

 - Color:
   - green
   - red
   - ...

But what i'd like to get is:

 - Color
 - Size
 - (all the other facets)

You can retrieve a list of all facets and record counts by passing the API a wildcard:

index.search('', {
  facets: ['*']
});

The list of facets and record counts will be in facet_stats

Docs: https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#retrieving-facets

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM