lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Carlson <carl...@bookandhammer.com>
Subject Re: DateFilter failing unit test, need some suggestions
Date Wed, 08 May 2002 18:27:36 GMT
Hi,

I am currently tracking down an NullPointerException, in the TestAfter unit
test.

It is basically the same test as the testBefore, but have an issue with
setting the DateFilter. (see stack trace below)

The TestWildcard test is also failing and I haven't looked at it yet.


I would like to have all the unit test working before we release RC5 since
this will hopefully be the final release.

--Peter

-------------STACK TRACE------------------------
Testsuite: org.apache.lucene.search.TestDateFilter
Tests run: 2, Failures: 0, Errors: 1, Time elapsed: 0.316 sec

Testcase: testBefore took 0.298 sec
Testcase: testAfter took 0.012 sec
    Caused an ERROR
null
java.lang.NullPointerException
    at org.apache.lucene.search.DateFilter.bits(Unknown Source)
    at org.apache.lucene.search.IndexSearcher.search(Unknown Source)
    at org.apache.lucene.search.Hits.getMoreDocs(Unknown Source)
    at org.apache.lucene.search.Hits.<init>(Unknown Source)
    at org.apache.lucene.search.Searcher.search(Unknown Source)
    at org.apache.lucene.search.TestDateFilter.testAfter(Unknown Source)
    at java.lang.reflect.Method.invoke(Native Method)
    at junit.framework.TestCase.runTest(TestCase.java:166)
    at junit.framework.TestCase.runBare(TestCase.java:140)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:131)
    at junit.framework.TestSuite.runTest(TestSuite.java:173)
    at junit.framework.TestSuite.run(TestSuite.java:168)
    at 
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRu
nner.java:231)
    at 
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestR
unner.java:409)
On 5/8/02 10:35 AM, "Doug Cutting" <DCutting@Grandcentral.com> wrote:

> 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>
> 
> 


--
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