itemsapi / itemsjs

Extremely fast faceted search engine in JavaScript - lightweight, flexible, and simple to use

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Question] How can I get the elements of an aggregation into a list?

Kugeleis opened this issue · comments

Say my aggregation price contains 10, 20, 30, 80. How can I get this into a list for further use like so
var myPrices = [10,20,30,80] ?

I can patially answer my own question. This method (vue) works:

    valueList(agg) {
      var l = []
      this.searchResult.data.aggregations[agg].buckets.forEach(element => {
        
        l.push(Number(element.key));
        l.sort(function(a, b){return a - b});
      });
      console.log(agg,' list is ', l);
      return l
    }

A side effect is that itemsjs must be directed to calculate the aggregation of this facette and it will be displayed. Is there a way to prevent display e.g. have a silent aggegation calculated by itemsjs?