sorting groups on the basis of average of a field in documents

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

sorting groups on the basis of average of a field in documents

Saurabh Sharma
Hi All,

I have a requirement where I need to sort the group on average of a
particular field.
The motive here is to compute the average of the value of a field across
all documents of the group and then sort the group on the basis of
commuted average.

Is there any approach that can be used to solve this problem?


Thanks
Saurabh Sharma
Reply | Threaded
Open this post in threaded view
|

Re: sorting groups on the basis of average of a field in documents

Erick Erickson
This might help: https://lucene.apache.org/solr/guide/7_4/json-facet-api.html

basically, if you can construct facets that correspond to your groups, you can
do some statistical functions on them.

Best,
Erick

> On Jan 13, 2020, at 2:18 AM, Saurabh Sharma <[hidden email]> wrote:
>
> Hi All,
>
> I have a requirement where I need to sort the group on average of a
> particular field.
> The motive here is to compute the average of the value of a field across
> all documents of the group and then sort the group on the basis of
> commuted average.
>
> Is there any approach that can be used to solve this problem?
>
>
> Thanks
> Saurabh Sharma

Reply | Threaded
Open this post in threaded view
|

Re: sorting groups on the basis of average of a field in documents

Saurabh Sharma
Hi Erick,

I am using json facets and was able to achieve desired result using them. I
was looking for  some possibilities for same in groups.

Doing it using json facets is last option.

Thank
Saurabh Sharma

On Mon, Jan 13, 2020, 7:17 PM Erick Erickson <[hidden email]>
wrote:

> This might help:
> https://lucene.apache.org/solr/guide/7_4/json-facet-api.html
>
> basically, if you can construct facets that correspond to your groups, you
> can
> do some statistical functions on them.
>
> Best,
> Erick
>
> > On Jan 13, 2020, at 2:18 AM, Saurabh Sharma <[hidden email]>
> wrote:
> >
> > Hi All,
> >
> > I have a requirement where I need to sort the group on average of a
> > particular field.
> > The motive here is to compute the average of the value of a field across
> > all documents of the group and then sort the group on the basis of
> > commuted average.
> >
> > Is there any approach that can be used to solve this problem?
> >
> >
> > Thanks
> > Saurabh Sharma
>
>