itemsapi / itemsjs

Extremely fast faceted search engine in JavaScript - lightweight, flexible, and simple to use
Apache License 2.0
346 stars 41 forks source link

Feature calculate facet_stats on numeric aggregation key values. #98

Closed Ruitjes closed 2 years ago

Ruitjes commented 2 years ago

Hi @cigolpl ,

For our project we need the facet statistics of the numeric fields e.g. price, this concerns the min, max, avg, and sum values.

With the allFilteredItems field, we could have made the calculation ourselves. But by implementing this feature into itemjs everyone can use it, and it is also cleaner for us to get the right data directly from Itemsjs.

I hope you like this functionality. You can use facet_stats optionally, this value is set to false by default.

Let me now what you think about it. :)

cigolpl commented 2 years ago

@Ruitjes, for me it looks as a very useful feature. Could you also add it to docs ? Then I'll merge and bump new version into npmjs

Ruitjes commented 2 years ago

@cigolpl Thanks! Added show_facet_stats to the configuration docs.

cigolpl commented 2 years ago

Great! Version 2.1.13 is ready to use.