FAQ
Hi,

We recently encountered a strange behavior in
lucene v1.4.3 QueryParser: we call

QueryParser.parse("-1", "myidfield", new StandardAnalyzer());

and get retured query as:

-myidfield:1 // apparently we want "myidfield:-1"

Currently we can use TermQuery to avoid QueryParser
to bypass this problem, but still we would like to know
if this is a known problem or already fixed in later version?

Thanks very much for helps, Lisheng

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

Search Discussions

  • Erik Hatcher at Oct 8, 2005 at 10:17 am

    On Oct 7, 2005, at 8:14 PM, Zhang, Lisheng wrote:
    We recently encountered a strange behavior in
    lucene v1.4.3 QueryParser: we call

    QueryParser.parse("-1", "myidfield", new StandardAnalyzer());

    and get retured query as:

    -myidfield:1 // apparently we want "myidfield:-1"

    Currently we can use TermQuery to avoid QueryParser
    to bypass this problem, but still we would like to know
    if this is a known problem or already fixed in later version?
    This behavior is entirely by design. The - and + operators are for
    prohibiting and requiring clauses, as an integral part of the query
    expression language. The - can be escaped as in "\-1", though maybe
    QueryParser is not appropriate for your situation.

    Erik


    ---------------------------------------------------------------------
    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
postedOct 8, '05 at 12:14a
activeOct 8, '05 at 10:17a
posts2
users2
websitelucene.apache.org

2 users in discussion

Erik Hatcher: 1 post Zhang, Lisheng: 1 post

People

Translate

site design / logo © 2022 Grokbase