You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Saurabh Sharma <sa...@gmail.com> on 2020/01/13 07:18:58 UTC

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

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

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

Posted by Saurabh Sharma <sa...@gmail.com>.
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 <er...@gmail.com>
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 <sa...@gmail.com>
> 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
>
>

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

Posted by Erick Erickson <er...@gmail.com>.
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 <sa...@gmail.com> 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