lucene-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: searching between two fields
Date Tue, 26 Apr 2005 19:07:09 GMT

On Apr 26, 2005, at 2:18 PM, Kipping, Peter wrote:
> Suppose I have a document with two fields, min_temp = 100 and max_temp 
> =
> 200.  If a user inputs a search value of 150 the document should be
> returned.  Is it possible to make this happen with lucene?

Yes.

I do this with my work with years.  The data I index has year strings 
like this: "1837-65" but a search for year:1856 will find this 
document.  I do this by expanding the terms indexed so that the year 
field has a term for each year in the range.  In your case, you could 
index a "temp" field with every unit value between 100 and 200 
inclusively.

I recommend you post to java-user@lucene rather than general@lucene.

	Erik


Mime
View raw message