Displaying sample text from the Lucene Search Results

ぐ巨炮叔叔 提交于 2019-12-02 04:23:33

I believe what you are looking for is a Highlighter.

One possibility is to use the lucene.search.highlight package, specifically the Highlighter.

Another option is to use the lucene.search.vectorhighlight package, specifically the FastVectorHighlighter.

Both classes search a text document, choose relevant snippets and display them with the matching terms highlighted. I have only used the first one, which worked fine for my use-case. If you can pre-divide the book into shorter parts, it would make highlighting faster.

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