I'm having a problem when using Query and DateFilter for a search. If I
create DateFilter with DateFilter.After with current time&date as parameter,
then I get NullPointerException when executing search
(Searcher.search(Query, DateFilter)). Had anyone experienced something like
that? If I set time just a bit in past, it returns empty hits which is how
it should behave all the time.

code snipet:
        // I have java files as documents, consisting of content
(Field.Text()) and modified (Field.Keyword())
        Query q = new WildcardQuery(new Term("content", "packag*"));
        DateFilter df = DateFilter.After("modified",
Calendar.getInstance().getTime());
        Searcher searcher = new IndexSearcher(path);
        Hits hits = searcher.search(q, df);     // line 66

exception:
Exception in thread "main" 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 Search.main(Search.java:66)

Regards,
Uros.

Reply via email to