lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From starz10de <farag_ah...@yahoo.com>
Subject highlighter by using term offsets
Date Tue, 22 Nov 2011 13:35:03 GMT

 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-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message