FAQ
Hello



I am new to Lucene and facing a problem while performing searches. I am
using lucene 2.2.0.

My application indexes documents on "keyword" field which contains integer
values. If the value is negative the query does not return correct results.



Following is my lucene query:



(keyword: \-1)



I also tried:

(keyword: "-1")





But none of them returns correct results. It seems that Lucene ignores '-'.
My purpose is to search documents with index value "-1".



Any ideas??



Thanks

Search Discussions

  • AHMET ARSLAN at Sep 10, 2009 at 12:32 pm

    I am new to Lucene and facing a problem while performing
    searches. I am using lucene 2.2.0.

    My application indexes documents on "keyword" field which
    contains integer values.
    Which analyzer/tokenizer are you using on that field? I am assuming it is a tokenized field.
    If the value is negative the query does not return
    correct results.
    Is it returning 1's as well as -1's?

    - is a special character so you have to escape it when querying.
    So keyword:\-1 is correct. But the problem is StandardTokenizer tokenizes
    -1 to 1. If you use it all -1's and 1's are threated same. Use whitespaceanalyzer instead.

    Hope this helps.





    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Anshum at Sep 10, 2009 at 1:19 pm
    Hi Vibhuti,
    Not in sync with your query, but I'd advice you to graduate you to a rather
    recent lucene release. Something like 2.4.1 or atleast a 2.3.1 [Considering
    its already time for 2.9].

    --
    Anshum Gupta
    Naukri Labs!
    http://ai-cafe.blogspot.com

    The facts expressed here belong to everybody, the opinions to me. The
    distinction is yours to draw............

    On Thu, Sep 10, 2009 at 4:17 PM, vibhuti wrote:

    Hello



    I am new to Lucene and facing a problem while performing searches. I am
    using lucene 2.2.0.

    My application indexes documents on "keyword" field which contains integer
    values. If the value is negative the query does not return correct results.



    Following is my lucene query:



    (keyword: \-1)



    I also tried:

    (keyword: "-1")





    But none of them returns correct results. It seems that Lucene ignores '-'.
    My purpose is to search documents with index value "-1".



    Any ideas??



    Thanks
  • Erick Erickson at Sep 10, 2009 at 2:38 pm
    Also, get a copy of Luke and examine your index, that'll tell you what
    isactually
    in there *and* it will let you see how queries parse under
    various analyzers.....

    Best
    Erick
    On Thu, Sep 10, 2009 at 6:47 AM, vibhuti wrote:

    Hello



    I am new to Lucene and facing a problem while performing searches. I am
    using lucene 2.2.0.

    My application indexes documents on "keyword" field which contains integer
    values. If the value is negative the query does not return correct results.



    Following is my lucene query:



    (keyword: \-1)



    I also tried:

    (keyword: "-1")





    But none of them returns correct results. It seems that Lucene ignores '-'.
    My purpose is to search documents with index value "-1".



    Any ideas??



    Thanks

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupjava-user @
categorieslucene
postedSep 10, '09 at 10:54a
activeSep 10, '09 at 2:38p
posts4
users4
websitelucene.apache.org

People

Translate

site design / logo © 2022 Grokbase