You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Uroš Jurglič <ju...@parsek.net> on 2001/12/17 17:42:24 UTC

DateFilter and NullPointerException

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.

Re: DateFilter and NullPointerException

Posted by Otis Gospodnetic <ot...@yahoo.com>.
Hm, do you know which line in DateFilter.java this NPE comes from?
Could you try compiling Lucene with the -g switch so that we can see
the line numbers in the exception stack trace?

If you want you can also submit a bug report at
http://nagoya.apache.org/bugzilla/

Thanks,
Otis

--- Uro�_Jurgli� <ju...@parsek.net> wrote:
> 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.
> 


__________________________________________________
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>