lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anders Nielsen" <and...@visator.dk>
Subject Null pointer error when searching with DateFilter
Date Thu, 11 Oct 2001 14:57:29 GMT
Hello all,

I am trying to search using a DateFilter so I get a resultset that lies
between two dates. Without the DateFilter the search works perfectly, but
when I use the DateFilter I get the following error

        java.lang.NullPointerException
        at
org.apache.lucene.index.SegmentTermEnum.clone(SegmentTermEnum.java:91)
        at
org.apache.lucene.index.TermInfosReader.terms(TermInfosReader.java:218)
        at
org.apache.lucene.index.SegmentReader.terms(SegmentReader.java:183)
        at
org.apache.lucene.index.SegmentsTermEnum.<init>(SegmentsReader.java:182)
        at
org.apache.lucene.index.SegmentsReader.terms(SegmentsReader.java:144)
        at org.apache.lucene.search.DateFilter.bits(DateFilter.java:131)
        at
org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:109)
        at org.apache.lucene.search.Hits.getMoreDocs(Hits.java:91)
        at org.apache.lucene.search.Hits.<init>(Hits.java:81)
        at org.apache.lucene.search.Searcher.search(Searcher.java:75)

and I was just wondering if anyone who have have had or overcome similar
problems, could give me the benefit of their experiences?


When I create the Documents in the index I use the following code to create
the date-field

        doc.add(Field.Keyword("timestamp", DateField.dateToString(date)));

where date is an object of type Date,


and the DateFilter is created like this:

        DateFilter dateFilter = DateFilter.After("timestamp",
from.getTime());

where from is an object of type Calendar,


and I make the search by calling search(Query, Filter) on an IndexSearcher
object:

        return _indexSearcher.search(query, searchFilter);

where query is an object of type Query, and searchFilter is of type
DateFilter.



Venlig hilsen

Anders Nielsen
Adm. direktør

_____________

Visator ApS
Kroghsgade 1
2100 Kbh. Ø
Tlf: 35 55 47 02
Mobil: 26 71 36 63
_____________



Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message