lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Lea <ian....@blackwell.co.uk>
Subject Re: PhraseQuery: NullPointerException
Date Fri, 08 Feb 2002 12:08:25 GMT
1.2-rc3 seems to generate NPE if one or more of the words in
the search phrase are not present in the index.
Works as expected, no NPE, with 1.2-rc2.

If change method seek() in org.apache.lucene.index.SegmentTermPositions from

  final void seek(TermInfo ti) throws IOException {
    super.seek(ti);
    proxStream.seek(ti.proxPointer);
  }

to

  final void seek(TermInfo ti) throws IOException {
    super.seek(ti);
    if (ti != null) {
	proxStream.seek(ti.proxPointer);
    }
  }

the NPE goes away.  But I don't know what is going on here so
this may well not be the correct solution.




--
Ian.
ian.lea@blackwell.co.uk


Jonathan Franzone wrote:
> 
> *This message was transferred with a trial version of CommuniGate(tm) Pro*
> 
> I thought I saw a post that delt with this problem previously, but I
> couldn't find it in the archives. If it is a duplicate question I apologize.
> 
> I'm building a PhraseQuery and getting a random NullPointerException. It
> doesn't occur with all phrases, but is consistent with respect to the ones
> it does occur with. For example: "visual basic",  "information systems", and
> "project manager" always succeed.  But other phrases like "general public",
> "proven abilities", and "sql server" always fail. The stack trace is as
> follows:
> 
> caught a class java.lang.NullPointerException with message: null
> java.lang.NullPointerException
>         at org.apache.lucene.index.SegmentTermPositions.seek(Unknown Source)
>         at org.apache.lucene.index.SegmentTermDocs.seek(Unknown Source)
>         at org.apache.lucene.index.SegmentsTermDocs.termDocs(Unknown Source)
>         at org.apache.lucene.index.SegmentsTermDocs.next(Unknown Source)
>         at org.apache.lucene.search.PhrasePositions.next(Unknown Source)
>         at org.apache.lucene.search.PhraseScorer.score(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.Searcher.search(Unknown Source)
>         at
> com.jobwarehouse.lucene.search.JWPassiveResumeSearch.search(JWPassiveResumeS
> earch.java:209)
>         at
> com.jobwarehouse.lucene.search.JWPassiveResumeSearch.main(JWPassiveResumeSea
> rch.java:280)
> 
> Thanks!
> Jonathan Franzone

--
To unsubscribe, e-mail:   <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>


Mime
View raw message