lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: Size Search
Date Tue, 07 Dec 2004 07:32:36 GMT
On Dec 6, 2004, at 10:41 PM, Natarajan.T wrote:
> Thanks for your response.....
>
> I have indexed like Field.Text("size",docSize)

Field.Text runs the text through the analyzer, which may or may not 
strip numbers.  In this case, you probably want to use Field.Keyword 
instead.  Be sure, like the wiki link I sent below says, that you zero 
pad docSize so that all docSize values have the same string length, 
right justified, padded with leading zeroes.

You'll then be able to do range queries like size:[005 TO 020].  
Handling the conversion so QueryParser automatically pads so a user can 
type size:[5 TO 20] is a different story, and requires subclassing 
QueryParser and overriding getRangeQuery to do the padding internally.

	Erik



>
> -----Original Message-----
> From: Erik Hatcher [mailto:erik@ehatchersolutions.com]
> Sent: Monday, December 06, 2004 6:48 PM
> To: Lucene Users List
> Subject: Re: Size Search
>
>
> On Dec 6, 2004, at 8:08 AM, Natarajan.T wrote:
>> I have indexed File sizes....(like 2,4, 5,10,20,etc...)
>
> How did you index them?
>
>> I want search results only the size range between 5 - 20.
>>
>> How can I handle this???
>
> See here:
>
> 	http://wiki.apache.org/jakarta-lucene/SearchNumericalFields
>
> Erik
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org


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


Mime
View raw message