lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Armbrust, Daniel C." <Armbrust.Dan...@mayo.edu>
Subject RE: Newbie Questions
Date Mon, 08 Apr 2002 14:07:18 GMT
The way that we have done this (and this isn't necessarily the best way, it
was just the solution we came up with) is that we store all dates and
numbers as strings, but formatted in such a way that when they are
alphabetized, they will be in the right order.

The Lucene Date Filtering mechanism was useless to us, because it doesn't
allow dates before 1970.  

We stored all of our dates as strings in a format of year month day, this
way they sorted in the proper order.
Then you can write your own datefilter, which is basically a cut and paste
from lucenes date filter.

We also had an age field, and to make it sort properly, we had to prefix all
of the ages, like 

003
050
101

This way they sort properly, and you can write an age filter (again a cut
and paste from date filter) that will let you search for ages > 50.

Oh, and to apply more than one filter at a time (the way we did it) you will
need the Chainable Filter class, which I think is now on the contributions
page, but was also in the mailing archives in the last 2 weeks.

Dan


-----Original Message-----
From: Chris Withers [mailto:chrisw@nipltd.com]
Sent: Sunday, April 07, 2002 4:55 AM
To: lucene-user@jakarta.apache.org
Subject: Newbie Questions


Hi there,

I'm new to Lucene and have what will hopefully be a couple of simple
questions.

1. Can I index numbers with Lucene? If so, ints or floats or ?

2. Can I index dates with Lucene?

In either case, is there any way I can sort the results returned by a search
on
these fields?
Also, can I search for only documents which have been indexed with a range
in
one of these fields?

For example: I only want documents where the 'cost' field is between 1000
and
2000 and where the date of manufacture was prior to 13th June 1978.

cheers,

Chris

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

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


Mime
View raw message