Reputation: 4861
I'm using the Javascript API Client and would like to have facets return on my index. I believe faceting is turned on for the index because 1. I toggled the switch in the UI 2. I can use faceting in the dashboard for my index. I set up my index with the following params:
var params = {
tagFilters: 'query',
aroundLatLngViaIP: true,
getRankingInfo: 1,
facets: "*"
};
However, this returns an empty facets object. How can I receive a facet object with all possible faceting options?
Upvotes: 3
Views: 450
Reputation: 12032
You have no result for this query, hence the lack of facet.
You can maybe see it more easily on this updated JSFiddle:
index.search(params).then(function(resp) {
count.innerText = resp.hits.length + ' results';
facets.innerText = JSON.stringify(resp.facets, null, 2);
response.innerText = JSON.stringify(resp, null, 2);
});
Upvotes: 4