Gravatar for slangevin@coveo.com

Question by Simon, May 16, 2017 1:35 PM

Most efficient way to return range between the Min and Max values of a fields

What would be the best way to retrieve the range between the Max and Min values of a specific field in the index?

The only thing that comes to my mind is to send to GroupByRequest with two opposite sort, then add my own logic to calculate the range.

Any way to make this more efficient?

1 Reply
Gravatar for olamothe@coveo.com

Answer by olamothe, May 16, 2017 1:50 PM

A group by request on the field, with :

generateAutomaticRange = true

maximumNumberOfValues = 1

queryOverride = "@uri"

Should do the trick.

Gravatar for ssartell@rightpoint.com

Comment by ssartell, May 16, 2017 3:03 PM

Thanks @olamothe! This is exactly what I was looking for. Could you provide any insight into the logic Coveo uses to auto generate ranges? The documentation is a little vague on what it actually does.

Ask a question