FAQ
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.

Search Discussions

  • Miles Barr at Jul 25, 2006 at 11:00 am

    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
  • Doron Cohen at Jul 25, 2006 at 6:07 pm
    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" <krishnendra.nandi@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
  • Doron Cohen at Jul 25, 2006 at 6:36 pm
    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" <krishnendra.nandi@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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupjava-user @
categorieslucene
postedJul 25, '06 at 10:48a
activeJul 25, '06 at 6:36p
posts4
users3
websitelucene.apache.org

People

Translate

site design / logo © 2022 Grokbase