Return-Path: Delivered-To: apmail-jakarta-lucene-user-archive@apache.org Received: (qmail 40069 invoked from network); 29 Oct 2002 15:51:52 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 29 Oct 2002 15:51:52 -0000 Received: (qmail 1973 invoked by uid 97); 29 Oct 2002 15:52:36 -0000 Delivered-To: qmlist-jakarta-archive-lucene-user@jakarta.apache.org Received: (qmail 1895 invoked by uid 97); 29 Oct 2002 15:52:34 -0000 Mailing-List: contact lucene-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Lucene Users List" Reply-To: "Lucene Users List" Delivered-To: mailing list lucene-user@jakarta.apache.org Received: (qmail 1873 invoked by uid 98); 29 Oct 2002 15:52:34 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Errors-To: Date: Tue, 29 Oct 2002 07:51:32 -0800 Subject: Re: Date Search Problem Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v546) From: Peter Carlson To: "Lucene Users List" Content-Transfer-Encoding: 7bit In-Reply-To: <200210291047.24653.dkendig@gcmd.nasa.gov> Message-Id: <4B852CE3-EB56-11D6-BC4D-003065AB94BC@bookandhammer.com> X-Mailer: Apple Mail (2.546) X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N If you are going to use the DateFilter method, you should use the DateField.dateToString to format your dates when they get added to your document. --Peter On Tuesday, October 29, 2002, at 07:47 AM, David Kendig wrote: > 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. > > > 1968-01-01 > 1997-12-31 > > > 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 > > 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 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: > > For additional commands, e-mail: > > > -- To unsubscribe, e-mail: For additional commands, e-mail: