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 Krishnendra Nandi <kr...@hewitt.com> on 2006/07/25 12:38:51 UTC
Grouping over multiple fields
Hi All,
Can anybody help me out on this ..?
I have to search for a particular value over multiple fields and need to
know if grouping is allowed over multiple fields
eg.
<some query> AND ( AUTHOR_NAME:krish OR EMPLOYEE_NAME:krish )
Introducing paranthesis "(" is giving me lexical error
Thanks and Regards
Krishnendra Nandi
The information contained in this e-mail and any accompanying documents
may contain information that is confidential or otherwise protected
from disclosure. If you are not the intended recipient of this message,
or if this message has been addressed to you in error, please
immediately alert the sender by reply e-mail and then delete this message,
including any attachments. Any dissemination, distribution or other use of
the contents of this message by anyone other than the intended recipient
is strictly prohibited.
Re: Grouping over multiple fields
Posted by Miles Barr <mi...@magpie.net>.
Krishnendra Nandi wrote:
>Can anybody help me out on this ..?
>
>I have to search for a particular value over multiple fields and need to
>know if grouping is allowed over multiple fields
>
>eg.
>
><some query> AND ( AUTHOR_NAME:krish OR EMPLOYEE_NAME:krish )
>
>Introducing paranthesis "(" is giving me lexical error
>
>
I don't see anything wrong with this, but maybe the query parser doesn't
like it. You could construct it programatically:
1. Use the QueryParser on <some query>
2. Create TermQuerys for AUTHOR_NAME and EMPLOYEE_NAME
3. Construct the necessary BooleanQuery
If it is the query parser and you need free text queries take a look at
the JavaCC source and find the bit that handles nested queries and see
why it doesn't like your field restrictions.
Miles
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Grouping over multiple fields
Posted by Doron Cohen <DO...@il.ibm.com>.
Just realized that the <some text> part should also be grouped, so checked
that this variation also works:
qtxt = "some text AND ( AUTHOR_NAME:krish OR EMPLOYEE_NAME:krish )";
---> field:some +field:text +(AUTHOR_NAME:krish EMPLOYEE_NAME:krish)
qtxt = "(some text) AND ( AUTHOR_NAME:krish OR EMPLOYEE_NAME:krish )";
---> +(field:some field:text) +(AUTHOR_NAME:krish EMPLOYEE_NAME:krish)
qtxt = "<some text> AND ( AUTHOR_NAME:krish OR EMPLOYEE_NAME:krish )";
---> field:<some +field:text> +(AUTHOR_NAME:krish EMPLOYEE_NAME:krish)
Last case just demonstrates that '<' is not part of Lucene's query syntax
(http://lucene.apache.org/java/docs/queryparsersyntax.html).
- Doron
> I think the problem might be in the <some query> part.
> At least with Lucene 2.0, parsing result is as expected -
> String qtxt = "some text AND ( AUTHOR_NAME:krish OR
EMPLOYEE_NAME:krish
> )";
> Query q = new QueryParser("field",new
WhitespaceAnalyzer()).parse(qtxt);
> System.out.println(q);
> --> field:some +field:text +(AUTHOR_NAME:krish EMPLOYEE_NAME:krish)
>
> - Doron
>
> "Krishnendra Nandi" <kr...@hewitt.com> wrote on 25/07/2006
> 03:38:51:
>
> > Hi All,
> >
> > Can anybody help me out on this ..?
> >
> > I have to search for a particular value over multiple fields and need
to
> > know if grouping is allowed over multiple fields
> >
> > eg.
> >
> > <some query> AND ( AUTHOR_NAME:krish OR EMPLOYEE_NAME:krish )
> >
> > Introducing paranthesis "(" is giving me lexical error
> >
> > Thanks and Regards
> > Krishnendra Nandi
> >
> > The information contained in this e-mail and any accompanying documents
> > may contain information that is confidential or otherwise protected
> > from disclosure. If you are not the intended recipient of this message,
> > or if this message has been addressed to you in error, please
> > immediately alert the sender by reply e-mail and then delete this
> message,
> > including any attachments. Any dissemination, distribution or other use
> of
> > the contents of this message by anyone other than the intended
recipient
> > is strictly prohibited.
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Grouping over multiple fields
Posted by Doron Cohen <DO...@il.ibm.com>.
I think the problem might be in the <some query> part.
At least with Lucene 2.0, parsing result is as expected -
String qtxt = "some text AND ( AUTHOR_NAME:krish OR EMPLOYEE_NAME:krish
)";
Query q = new QueryParser("field",new WhitespaceAnalyzer()).parse(qtxt);
System.out.println(q);
--> field:some +field:text +(AUTHOR_NAME:krish EMPLOYEE_NAME:krish)
- Doron
"Krishnendra Nandi" <kr...@hewitt.com> wrote on 25/07/2006
03:38:51:
> Hi All,
>
> Can anybody help me out on this ..?
>
> I have to search for a particular value over multiple fields and need to
> know if grouping is allowed over multiple fields
>
> eg.
>
> <some query> AND ( AUTHOR_NAME:krish OR EMPLOYEE_NAME:krish )
>
> Introducing paranthesis "(" is giving me lexical error
>
> Thanks and Regards
> Krishnendra Nandi
>
> The information contained in this e-mail and any accompanying documents
> may contain information that is confidential or otherwise protected
> from disclosure. If you are not the intended recipient of this message,
> or if this message has been addressed to you in error, please
> immediately alert the sender by reply e-mail and then delete this
message,
> including any attachments. Any dissemination, distribution or other use
of
> the contents of this message by anyone other than the intended recipient
> is strictly prohibited.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org