lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Kendig <>
Subject Date Search Problem
Date Tue, 29 Oct 2002 15:47:24 GMT
I have XML documents that I indexed using Lucene with ISOGEN's XML package. I 
am unable to get the date search working properly. First let me describe how 
I set things up.  The document has these fields.


They are indexed and added to org.apache.lucene.document.Document

	contentDoc.add(new Field("Start_Date", startDate, false, true, false));

I build a query (in a Jython Servlet the imports the lucene packages)

        #if a date range is supplied, use a date filter
        dateFormat = SimpleDateFormat("yyyy-MM-dd");
        dateFilter = DateFilter.After("Start_Date", 
dateFormat.parse("2001-02-03") )
        hits     =, dateFilter)

Now when DateFilter.After() is called above, I print the value of the start 
attribute that is  declared as  a string and this is what I get:
But in DateFilter.bits() it is comparing against this:

So could someone please point me in the right direction?  I must be missing 
something here because it looks like it is comparing 0ciqv3fk0 to 
Term<Start_Date:1000-01-01> and that is obviously wrong.

I scoured the FAQ and mail listings and the information on how to search using 
dateField is minimal.  The API docs help, but it is not clear to me how to 
put the API's together.  Unfortunately, the demo isn't much better at showing 
how to search using arbitrary date formats.  


Dave Kendig

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

View raw message