Is there any Lucene highlighter that does not require the original text - but rather can work on term positions etc

我只是一个虾纸丫 提交于 2019-12-04 13:39:16

Both the standard highlighter and FastVectorHighlighter can use the index if you store the terms. (FVH can only use the index, in fact). You can see an example of this on page 274 of Lucene in Action. The relevant code line is:

TokenStream stream = TokenSources.getAnyTokenStream(searcher.getIndexReader(), sd.doc, "title", doc, analyzer);

That will get the token stream from the index.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!