Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Lucene: Java-User

how use ranges for numeric values?

 

 

Lucene java-user RSS feed   Index | Next | Previous | View Threaded


anti_spam71 at yahoo

Sep 19, 2008, 2:51 AM

Post #1 of 4 (1619 views)
Permalink
how use ranges for numeric values?

Hi,
I need to specify in my query ranges with product price. I wonder if
the only solution is padding values with zeros. For example, if I'm
looking for price between 3$ and 10$ I must write the query in this
manner: price:[00003.00 TO 00010.00]?
Thanks.
G

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
For additional commands, e-mail: java-user-help [at] lucene


ian.lea at gmail

Sep 19, 2008, 3:56 AM

Post #2 of 4 (1582 views)
Permalink
Re: how use ranges for numeric values? [In reply to]

Hi


The comparison is on strings, so, yes, you do have to pad your values.


--
Ian.


On Fri, Sep 19, 2008 at 10:51 AM, Giannandrea Castaldi
<anti_spam71 [at] yahoo> wrote:
> Hi,
> I need to specify in my query ranges with product price. I wonder if
> the only solution is padding values with zeros. For example, if I'm
> looking for price between 3$ and 10$ I must write the query in this
> manner: price:[00003.00 TO 00010.00]?
> Thanks.
> G

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
For additional commands, e-mail: java-user-help [at] lucene


umesh.iitk at gmail

Sep 19, 2008, 6:00 AM

Post #3 of 4 (1583 views)
Permalink
Re: how use ranges for numeric values? [In reply to]

Hi,
NumberTools provides method longToString(long l) which pads the values.
It can be indexed and range search like normal queries.

Slight issue is when you search view the index in Luke because the numbers
are hexadecimal notation and so not easily understandable. Hence you may
want to store the original prices also in the index. Handy for debugging.

Similarly in search time, use longToString to get hexadecimal coded values
for prices and make a range query encoded values.

--
Thanks
Umesh




On Fri, Sep 19, 2008 at 4:26 PM, Ian Lea <ian.lea [at] gmail> wrote:

> Hi
>
>
> The comparison is on strings, so, yes, you do have to pad your values.
>
>
> --
> Ian.
>
>
> On Fri, Sep 19, 2008 at 10:51 AM, Giannandrea Castaldi
> <anti_spam71 [at] yahoo> wrote:
> > Hi,
> > I need to specify in my query ranges with product price. I wonder if
> > the only solution is padding values with zeros. For example, if I'm
> > looking for price between 3$ and 10$ I must write the query in this
> > manner: price:[00003.00 TO 00010.00]?
> > Thanks.
> > G
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
> For additional commands, e-mail: java-user-help [at] lucene
>
>


--
Thanking you

Regards
Umesh Prasad


umesh.iitk at gmail

Sep 19, 2008, 11:24 PM

Post #4 of 4 (1560 views)
Permalink
Re: how use ranges for numeric values? [In reply to]

On Fri, Sep 19, 2008 at 6:30 PM, Umesh Prasad <umesh.iitk [at] gmail> wrote:

>
> Hi,
> NumberTools provides method longToString(long l) which pads the values.
> It can be indexed and range search like normal queries.
>
> Slight issue is when you search view the index in Luke because the numbers
> are hexadecimal notation and so not easily understandable. Hence you may
> want to store the original prices also in the index. Handy for debugging.
>

SORRY , The encoding is BASE 36. I missed it out earlier.


>
> Similarly in search time, use longToString to get hexadecimal coded values
> for prices and make a range query encoded values.
>
> --
> Thanks
> Umesh
>
>
>
>
>
> On Fri, Sep 19, 2008 at 4:26 PM, Ian Lea <ian.lea [at] gmail> wrote:
>
>> Hi
>>
>>
>> The comparison is on strings, so, yes, you do have to pad your values.
>>
>>
>> --
>> Ian.
>>
>>
>> On Fri, Sep 19, 2008 at 10:51 AM, Giannandrea Castaldi
>> <anti_spam71 [at] yahoo> wrote:
>> > Hi,
>> > I need to specify in my query ranges with product price. I wonder if
>> > the only solution is padding values with zeros. For example, if I'm
>> > looking for price between 3$ and 10$ I must write the query in this
>> > manner: price:[00003.00 TO 00010.00]?
>> > Thanks.
>> > G
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
>> For additional commands, e-mail: java-user-help [at] lucene
>>
>>
>
>
> --
> Thanking you
>
> Regards
> Umesh Prasad
>



--
Thanking you

Regards
Umesh Prasad

Lucene java-user RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.