lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@lucene.com
Subject RE: DateFilter failing unit test, need some suggestions
Date Tue, 07 May 2002 21:54:32 GMT
I found two problems.

First, it seems that Field.Text is used when Field.Keyword should be used to
add the date fields to the document.

Second, in the testAfter code, I think the intent was to index the document
at time 'now + 888888', not 'now - 888888'.

When I make the change below the test succeeds.

Doug

diff -u -w -u -w -r1.2 TestDateFilter.java
--- TestDateFilter.java	19 Apr 2002 20:29:19 -0000	1.2
+++ TestDateFilter.java	7 May 2002 21:52:12 -0000
@@ -97,7 +97,7 @@
 
  	Document doc = new Document();
  	// add time that is in the past
- 	doc.add(Field.Text("datefield", DateField.timeToString(now -
1000)));
+ 	doc.add(Field.Keyword("datefield", DateField.timeToString(now -
1000)));
  	doc.add(Field.Text("body", "Today is a very sunny day in New York
City"));
   	writer.addDocument(doc);
  	writer.optimize();
@@ -155,7 +155,7 @@
 
  	Document doc = new Document();
  	// add time that is in the future
- 	doc.add(Field.Text("datefield", DateField.timeToString(now -
888888)));
+ 	doc.add(Field.Keyword("datefield", DateField.timeToString(now +
888888)));
  	doc.add(Field.Text("body", "Today is a very sunny day in New York
City"));
   	writer.addDocument(doc);
  	writer.optimize();

> -----Original Message-----
> From: Peter Carlson
> [mailto:carlson.at.bookandhammer.com@apache.at.lucene.com]
> Sent: Tuesday, May 07, 2002 11:03 AM
> To: dcutting@grandcentral.com
> Subject: DateFilter failing unit test, need some suggestions
> 
> 
> Hi,
> 
> I am trying to resolve some last minute issue with RC5.
> 
> As pointed out by Brian, the TestDateFilter unit test fails.
> 
> I have looked at the code and I cannot figure out why.
> 
> Has anyone ever worked with DateFilter and got it to work. 
> Can someone send
> me an example I can use for the TestDateFilter.
> 
> Thanks
> 
> --Peter
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: 
> <mailto:lucene-dev-help@jakarta.apache.org>
> 

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


Mime
View raw message