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 dizh <di...@neusoft.com> on 2012/12/10 07:12:55 UTC

Group by on multi fields

Hi All:
I want to ask how to do "Group by on multi fields ".
The Lucene JavaDOC only gives a demo about how to group by a single-field.

Would anybody give me a hint?
---------------------------------------------------------------------------------------------------
Confidentiality Notice: The information contained in this e-mail and any accompanying attachment(s) 
is intended only for the use of the intended recipient and may be confidential and/or privileged of 
Neusoft Corporation, its subsidiaries and/or its affiliates. If any reader of this communication is 
not the intended recipient, unauthorized use, forwarding, printing,  storing, disclosure or copying 
is strictly prohibited, and may be unlawful.If you have received this communication in error,please 
immediately notify the sender by return e-mail, and delete the original message and all copies from 
your system. Thank you. 
---------------------------------------------------------------------------------------------------

Re: Re: Group by on multi fields

Posted by Martijn v Groningen <ma...@gmail.com>.
Not that I know of. The easiest way to functionally group across
multiple fields is to concatenate multiple field values into
a special group field. This isn't a flexible solution, but it doesn't
require modifying the Lucene code.

The other solution you can try is to group by ValueSource (is like a
function) instead by field. At the moment there isn't a concatenate
field values function implementation, but you can easily create that
yourself. This solution would be flexible (you can change the fields
you want to group by during runtime), but the grouping itself will be
more expensive (execution wise).

I hope this gives you some pointers to start with.

Martijn

On 11 December 2012 02:55, dizh <di...@neusoft.com> wrote:
> Thanks to Martijn v Groningen.
>
> but , Is there anyone who has implemented this feature? just like SQL : select a1,a2,sum(a3) group by a1,a2;
>
> BTW: show me how to do is well too, Thank you。
> ---------------------------------------------------------------------------------------------------
> Confidentiality Notice: The information contained in this e-mail and any accompanying attachment(s)
> is intended only for the use of the intended recipient and may be confidential and/or privileged of
> Neusoft Corporation, its subsidiaries and/or its affiliates. If any reader of this communication is
> not the intended recipient, unauthorized use, forwarding, printing,  storing, disclosure or copying
> is strictly prohibited, and may be unlawful.If you have received this communication in error,please
> immediately notify the sender by return e-mail, and delete the original message and all copies from
> your system. Thank you.
> ---------------------------------------------------------------------------------------------------



-- 
Met vriendelijke groet,

Martijn van Groningen

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


Re: Re: Group by on multi fields

Posted by dizh <di...@neusoft.com>.
Thanks to Martijn v Groningen.

but , Is there anyone who has implemented this feature? just like SQL : select a1,a2,sum(a3) group by a1,a2;

BTW: show me how to do is well too, Thank you。
---------------------------------------------------------------------------------------------------
Confidentiality Notice: The information contained in this e-mail and any accompanying attachment(s) 
is intended only for the use of the intended recipient and may be confidential and/or privileged of 
Neusoft Corporation, its subsidiaries and/or its affiliates. If any reader of this communication is 
not the intended recipient, unauthorized use, forwarding, printing,  storing, disclosure or copying 
is strictly prohibited, and may be unlawful.If you have received this communication in error,please 
immediately notify the sender by return e-mail, and delete the original message and all copies from 
your system. Thank you. 
---------------------------------------------------------------------------------------------------

Re: Re: Group by on multi fields

Posted by dizh <di...@neusoft.com>.
Thanks to Martijn v Groningen.

but , Is there anyone who has implemented this feature? just like SQL : select a1,a2,sum(a3) group by a1,a2;
---------------------------------------------------------------------------------------------------
Confidentiality Notice: The information contained in this e-mail and any accompanying attachment(s) 
is intended only for the use of the intended recipient and may be confidential and/or privileged of 
Neusoft Corporation, its subsidiaries and/or its affiliates. If any reader of this communication is 
not the intended recipient, unauthorized use, forwarding, printing,  storing, disclosure or copying 
is strictly prohibited, and may be unlawful.If you have received this communication in error,please 
immediately notify the sender by return e-mail, and delete the original message and all copies from 
your system. Thank you. 
---------------------------------------------------------------------------------------------------

Re: Group by on multi fields

Posted by Martijn v Groningen <ma...@gmail.com>.
Hi Dish,

Grouping on multiple fields or a field that has multiple tokens (or
values) per document hasn't been implemented yet.

Martijn

On 10 December 2012 07:12, dizh <di...@neusoft.com> wrote:
> Hi All:
> I want to ask how to do "Group by on multi fields ".
> The Lucene JavaDOC only gives a demo about how to group by a single-field.
>
> Would anybody give me a hint?
> ---------------------------------------------------------------------------------------------------
> Confidentiality Notice: The information contained in this e-mail and any accompanying attachment(s)
> is intended only for the use of the intended recipient and may be confidential and/or privileged of
> Neusoft Corporation, its subsidiaries and/or its affiliates. If any reader of this communication is
> not the intended recipient, unauthorized use, forwarding, printing,  storing, disclosure or copying
> is strictly prohibited, and may be unlawful.If you have received this communication in error,please
> immediately notify the sender by return e-mail, and delete the original message and all copies from
> your system. Thank you.
> ---------------------------------------------------------------------------------------------------



-- 
Met vriendelijke groet,

Martijn van Groningen

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