I know nothing about highlighting or TermPositionVector, but first step on debugging NPEs on complex lines of code should be to break it down and find out exactly what is causing the exception.
Is reader null? hits? Some other problem? -- Ian. On Tue, Nov 22, 2011 at 1:35 PM, starz10de <farag_ah...@yahoo.com> wrote: > > I'm writing a highlighter by using term offsets as follows: > > > IndexReader reader = IndexReader.open( indexPath ); > TermPositionVector tpv = (TermPositionVector)reader.getTermFreqVector( > hits[i].doc,"contents"); > > When I run the searcher, I face this error in > > TermPositionVector tpv = > (TermPositionVector)reader.getTermFreqVector(hits[i].doc,"contents"); > > Exception in thread "main" java.lang.NullPointerException > at servlet.SearchFiles.doPagingSearch(SearchFiles.java:274) > at servlet.SearchFiles.SearchFiles(SearchFiles.java:159) > at servlet.test.main(test.java:20) > > in the index , I stored the "contents" field as follows: > > doc.add( new Field( "contents", TextFilesContent, Field.Store.YES, > Field.Index.ANALYZED,Field.TermVector.WITH_OFFSETS ) ); > > > any hints? > > Thanks --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org