lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: Range Filter again - (time field)
Date Mon, 18 Dec 2006 16:29:02 GMT

Hello Abdul,

The approach with dates and times is to index the full date and time but to
the resolution that you require as opposed to splitting the time and date
into separate fields.

 If you have a requirement to search to millisecond resolution then index
to millisecond resolutiuon using DateTools.Resolution.MILLISECOND. If you
only need your search to be accurate to the day then index using
DateTools.Resolution.DAY. If you need both then either index both and
choose the appropriate one at search time or store to millisecond
resolution and accpet the performance penalty.

Looking at you code it seems that you're just storing the time information
in the index and have lost the date information. This may account for the
range filter not picking up what you would expect as the dates may be
different. This is only a guess though.

Another observation is that you shouldn't have to use the Timestamp class.
If I remember this is an extension to the standard Date class that gives
nanosecond resolution. You should just be able to create the dataString

dataString = DateTools.dateToString(date,

Hope this is of some help

Paul I.

             abdul aleem                                                   
   >                                                  To 
             18/12/2006 16:10                                           cc 
             Please respond to         Range Filter again - (time field)   

Hello All,

Iam pretty sure there has been lots of discussions
and threads on date issues however coudln't nail
down my syntax,  bear with me if this has been asked

I have split my timestamp as Date and Time and
indexing on both

Im getting time as

SimpleDateFormat sdf = new

Date date = sdf.parse(time);

Timestamp timestamp = new Timestamp(date.getTime());

String dateString = DateTools.dateToString(timestamp,

Field timeField = new

For searching ( can search indexed time?? )
RangeFilter df2 = new RangeFilter("time",
DateTools.Resolution.MILLISECOND), true, true);

*time* index has more than 50 documents in start and
end range  but RangeFilter returns only 1 document (if
inclusive only)

is there something wrong with way iam using
RangeFilter ??

I would greatly appreciate if someone could suggest on
the above.

Many thanks,

PS:- Im searching on the exact time that was used to
index in the RangeFilter

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around

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

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

View raw message