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 Steve Fuchs <st...@aps.org> on 2011/01/18 16:03:43 UTC
sorting based on pivot aggregations
Hi
I am using pivots extensively in my search,and they work well for searching and displaying. But I find the need to be able to sort by the sum of a certain pivot, after it is collapsed.
So if my pivot term is:"student_id,test_grade"
I'd want to be able to sort on the number of tests a student has taken. and also get an average. something like:
:sort => sum( student_id,test_grade )/ count( student_id,test_grade )
where the values would be summed and counted over all of the entries where student_id was the same.
It doesn't seem to be working now, but does seem like a feature people would like. Is there any plan to implement it? Or even better a patch that I could apply?
thanks in advance
steve
Re: sorting based on pivot aggregations
Posted by Steve Fuchs <st...@aps.org>.
Hello and Thanks for the reply.
I've been over that page, and it doesn't seem like it helps with the pivoting aspect.
That is if I am sorting via an existing pivot 'sum(student_id,test_grade)' I want my groups of student_id sorted by the sum of test_grade with that student_id.
The data is all there and I can retrieve it, I just need solr to do some sorting magic with it...
thanks in advance again...
On Jan 18, 2011, at 10:42 AM, Ahmet Arslan wrote:
>> So if my pivot term is:"student_id,test_grade"
>> I'd want to be able to sort on the number of tests a
>> student has taken. and also get an average. something like:
>> :sort => sum( student_id,test_grade )/ count(
>> student_id,test_grade )
>>
>> where the values would be summed and counted over all of
>> the entries where student_id was the same.
>>
>> It doesn't seem to be working now, but does seem like a
>> feature people would like. Is there any plan to implement
>> it? Or even better a patch that I could apply?
>
> http://wiki.apache.org/solr/FunctionQuery#Sort_By_Function could help?
>
>
>
>
>
Re: sorting based on pivot aggregations
Posted by Ahmet Arslan <io...@yahoo.com>.
> So if my pivot term is:"student_id,test_grade"
> I'd want to be able to sort on the number of tests a
> student has taken. and also get an average. something like:
> :sort => sum( student_id,test_grade )/ count(
> student_id,test_grade )
>
> where the values would be summed and counted over all of
> the entries where student_id was the same.
>
> It doesn't seem to be working now, but does seem like a
> feature people would like. Is there any plan to implement
> it? Or even better a patch that I could apply?
http://wiki.apache.org/solr/FunctionQuery#Sort_By_Function could help?