lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Lea <ian....@gmail.com>
Subject Re: highlighter by using term offsets
Date Wed, 23 Nov 2011 09:45:54 GMT
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_ahmed@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-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message