Mailing List Archive

Date ranges?
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:

created:[0cvbxmfnu-0cvai6kzu]

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

created:[0cvai6kzu-0cvbxmfnu]

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

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:

id:[100-200]

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


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: <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>
Re: Date ranges? [ In reply to ]
On Wed, 19 Dec 2001, Jan Ekholm wrote:

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

I also don't find anything by doing a search like the below to find all
documents that have been added before this present time:

created:[null-0cvc0va2h]

Always returns 0 documents, even though that should give *all* docs. We've
been running 1.2-rc2, should we upgrade to 1.2?

--
- "Remember -- that which does not kill us can only make us stronger."
- "And that which does kill us leaves us dead!"
-- Terry Pratchett, Carpe Jugulum


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