You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by "Natarajan.T" <na...@crimsonlogic.co.in> on 2004/12/06 14:08:55 UTC

Size Search

Hi All,

 

I have indexed File sizes....(like 2,4, 5,10,20,etc...)

 

I want search results only the size range between 5 - 20.

 

How can I handle this???

 

 

Natarajan.

 


Re: Size Search

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
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


RE: Size Search

Posted by "Natarajan.T" <na...@crimsonlogic.co.in>.
Thanks for your response.....

I have indexed like Field.Text("size",docSize)

-----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


Re: Size Search

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
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