Re: NullPointerException using IndexReader.termDocs when there are no matches

2012-05-18 Thread Michael McCandless
a next() method. > >> -Original Message- >> From: Michael McCandless [mailto:luc...@mikemccandless.com] >> Sent: Thursday, May 17, 2012 6:20 PM >> To: java-user@lucene.apache.org >> Subject: Re: NullPointerException using IndexReader.termDocs when there >

RE: NullPointerException using IndexReader.termDocs when there are no matches

2012-05-18 Thread Edward W. Rouse
gt; Subject: Re: NullPointerException using IndexReader.termDocs when there > are no matches > > I think you need to pay attention to what td.next() returned; I > suspect in your case it returned false which means you cannot use any > of its APIs (.doc(), .freq(), etc.) after that.

Re: NullPointerException using IndexReader.termDocs when there are no matches

2012-05-17 Thread Michael McCandless
I think you need to pay attention to what td.next() returned; I suspect in your case it returned false which means you cannot use any of its APIs (.doc(), .freq(), etc.) after that. Mike McCandless http://blog.mikemccandless.com On Thu, May 17, 2012 at 5:52 PM, Edward W. Rouse wrote: > Lucene 3

NullPointerException using IndexReader.termDocs when there are no matches

2012-05-17 Thread Edward W. Rouse
Lucene 3.6, java 1.6 I get the following: java.lang.NullPointerException at org.apache.lucene.index.DirectoryReader$MultiTermDocs.doc(DirectoryReader.ja va:1179) when running this code: IndexReader reader = this.getReader(index); int d = -1; TermDocs td = reader.termDocs(this.createIdTerm(id));