You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Jack Liu <Ja...@morningstar.com> on 2013/05/07 07:49:14 UTC

[sort order]how to support sort by max(field1),then field2 desc.

As we know, the we can sort by multi-fields, such as field1 , then field2.

But I have another scenario:
We need pick up the max(field1) record first, then sort by field2 for others records.

Anyone can help me?

Thanks in advance.


Thanks
Jack

RE: [sort order]how to support sort by max(field1),then field2 desc.

Posted by Jack Liu <Ja...@morningstar.com>.
Hi, Ian

That sounds a good idea.
Thank you very much for your help. 

Thanks

-----Original Message-----
From: Ian Lea [mailto:ian.lea@gmail.com] 
Sent: 2013年5月7日 19:09
To: java-user@lucene.apache.org
Subject: Re: [sort order]how to support sort by max(field1),then field2 desc.

I think you'll have to run 2 searches with 2 sorts - the first to get
max(field1) and the second sorted by field2.  If you don't want the
max(field1) doc to appear in the second list you'll have to filter it out somehow.


--
Ian.


On Tue, May 7, 2013 at 6:49 AM, Jack Liu <Ja...@morningstar.com> wrote:
> As we know, the we can sort by multi-fields, such as field1 , then field2.
>
> But I have another scenario:
> We need pick up the max(field1) record first, then sort by field2 for others records.
>
> Anyone can help me?
>
> Thanks in advance.
>
>
> Thanks
> Jack

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: [sort order]how to support sort by max(field1),then field2 desc.

Posted by Ian Lea <ia...@gmail.com>.
I think you'll have to run 2 searches with 2 sorts - the first to get
max(field1) and the second sorted by field2.  If you don't want the
max(field1) doc to appear in the second list you'll have to filter it
out somehow.


--
Ian.


On Tue, May 7, 2013 at 6:49 AM, Jack Liu <Ja...@morningstar.com> wrote:
> As we know, the we can sort by multi-fields, such as field1 , then field2.
>
> But I have another scenario:
> We need pick up the max(field1) record first, then sort by field2 for others records.
>
> Anyone can help me?
>
> Thanks in advance.
>
>
> Thanks
> Jack

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org