You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Hankyu Kim <gk...@gmail.com> on 2013/01/23 15:30:51 UTC

Highlighting NGram index

I have created a NGram index of a fairly large text corpus and I'd like to
highlight the result.

I read from Lucene in Action that FastVectorHighlighter supports
highlighting ngram tokenized index, but when I try, its getBestFragment
method returned null. At the moment I suspect it is caused by not storing
the term vectors while indexing.

Below is the line of code I used to add the contents of the text files into
the index. It seems TextField can't be used to store the term vectors. What
Field class should I use to store contents of a document if I want
FastVectorHighlighter to work?

doc.add(new TextField("contents", new BufferedReader(new
InputStreamReader(fis, "UTF-8"))));