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.

        <Temporal_Coverage>
           <Start_Date>1968-01-01</Start_Date>
           <Stop_Date>1997-12-31</Stop_Date>
        </Temporal_Coverage>

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     = self.searcher.search(lucQuery, 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:
        DateFilter.After().start=0ciqv3fk0
But in DateFilter.bits() it is comparing against this:
        Enum(0)=Term<Start_Date:1000-01-01>

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.  

Thanks,

Dave Kendig






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

Reply via email to