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


--
View this message in context: 
http://lucene.472066.n3.nabble.com/highlighter-by-using-term-offsets-tp3527712p3527712.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to