lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Ekholm <>
Subject Date ranges?
Date Wed, 19 Dec 2001 07:14:17 GMT

Hi all,

I'm very new to Lucene, but have used it quite successfully for indexing
text in a few different languages. Now we want to add some extra
meta-information about the documents, and let the clients search that
information, such as a few dates. 

I can store the date info easily using the DateField helper methods, but
finding seems to be a little weird, especially using ranges. I've yet to
find any docs about the ranges, so I've basically just done a few tests
with them. I do have a few questions however that I'd hope to get some
clarification on.

1. does the order of the terms in a range query matter? I can create a
query like this:


and get it to match a few docs. If I reverse the dates and get this:


I get the exact same answer. Which is weird.

2. do date ranges work at all? If I search for documents that are created
max one day age I get, say, 10 hits (range has null upper limit). If I
search for docs that are created max 2 days ago I get, say 30 hits (range
has null upper limit). So if I search for docs that are max 2 days old,
but at least 1 day old I should get around 20 (both limits sets). Right?
Instead I always get the 30. Seems like the range query ignores my upper

3. Is there some nice way of setting numerical values so that I can search
them using ranges? We already store an id for each document as a Keyword,
and it is used to retrieve some extra info about a document. If I try to
do a range query on the document id:s, like this:


I get a lot of documents that have id:s well over 1000, or something
that's totally outside to given range. Is there any nice way of doing

As a whole I'm mighty impressed with the quality of Lucene, and especially
the speed. It's made my life a lot easier. I'd appreciate all hints and
pointers to RTFM entries (if available).

                 "Students?" barked the Archchancellor.
    "Yes, Master. You know? They're the thinner ones with the pale faces?
  Because we're a university? They come with the whole thing, like rats --"
                                         -- Terry Pratchett, Moving Pictures

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message