FAQ
Hello
consider a query like this

patientResult:[8 TO 9]

this returns correct documents but

patientResult:[8 TO 10]

return nothing. and also this range [0.1 TO 10] returns results like 11,
10.8, 10.9 etc.

is there any tricky way or workaround to obtain correct results? I know
lucene compares them as string but how to resolve the problem

thank you very much in advance


--
Regards,
Mohammad
--------------------------
see my blog: http://brainable.blogspot.com/
another in Persian: http://fekre-motefavet.blogspot.com/

Search Discussions

  • Daniel Noll at Jun 12, 2007 at 7:01 am

    On Tuesday 12 June 2007 16:44:25 Mohammad Norouzi wrote:
    Hello
    consider a query like this

    patientResult:[8 TO 9]

    this returns correct documents but

    patientResult:[8 TO 10]

    return nothing. and also this range [0.1 TO 10] returns results like 11,
    10.8, 10.9 etc.

    is there any tricky way or workaround to obtain correct results? I know
    lucene compares them as string but how to resolve the problem
    Use NumberTools to convert your number into a string which will sort as
    expected. As your field seems to be a metadata-like field, this will
    probably work well.

    (It gets harder if you want to do it inside ordinary text content as well.)

    Daniel

    --
    Daniel Noll
    Nuix Pty Ltd
    Suite 79, 89 Jones St, Ultimo NSW 2007, Australia Ph: +61 2 9280 0699
    Web: http://nuix.com/ Fax: +61 2 9212 6902

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Narednra Singh Panwar at Jun 12, 2007 at 7:35 am
    Use NumberTools.longToString() while storing it in to lucene index and use
    (double)NumberTools.stringToLong() while reading it from Lucene index.
    Hope this will solve your problem.

    Thanks
    Narendra
    On 6/12/07, Mohammad Norouzi wrote:

    Hello
    consider a query like this

    patientResult:[8 TO 9]

    this returns correct documents but

    patientResult:[8 TO 10]

    return nothing. and also this range [0.1 TO 10] returns results like 11,
    10.8, 10.9 etc.

    is there any tricky way or workaround to obtain correct results? I know
    lucene compares them as string but how to resolve the problem

    thank you very much in advance


    --
    Regards,
    Mohammad
    --------------------------
    see my blog: http://brainable.blogspot.com/
    another in Persian: http://fekre-motefavet.blogspot.com/
  • Mohammad Norouzi at Jun 12, 2007 at 7:50 am
    Thanks Narednra and Daniel
    but it accepts only long, I found LUCENE-530 to support double and float
    etc.
    Have you seen it?
    https://issues.apache.org/jira/browse/LUCENE-530

    another question is Do I have to use it while indexing? how about the index
    already created?



    --
    Regards,
    Mohammad
    --------------------------
    see my blog: http://brainable.blogspot.com/
    another in Persian: http://fekre-motefavet.blogspot.com/

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupjava-user @
categorieslucene
postedJun 12, '07 at 6:45a
activeJun 12, '07 at 7:50a
posts4
users3
websitelucene.apache.org

People

Translate

site design / logo © 2022 Grokbase