开发者

how to use Lucene highlighter with phraseQuery?

开发者 https://www.devze.com 2023-02-16 00:44 出处:网络
How to use Lucene\'s Hi开发者_C百科ghlighter with phraseQuery ? I did a google search, and I am getting confused with spanScorer, QueryScorer, and few things like that..

How to use Lucene's Hi开发者_C百科ghlighter with phraseQuery ?

I did a google search, and I am getting confused with spanScorer, QueryScorer, and few things like that..

The Lucene version I am using is 3.0.3

My requirements are

- Doing a multi field query

- Doing a wildcard search

- Doing a phrase query

All the above needs to be highlighted.

How do I achieve this ?


So I found the answer to my own question... After a LOT of hair pulling and google searching, I found this :

http://www.gossamer-threads.com/lists/lucene/java-...g=highlight%20wildcard;#116172

Specifically setting up the QueryScorer with this :

qs.setExpandMultiTermQuery(true);

did the job of highlighting wildcard searches.

As for the multi field stuff, I did ask it to highlight looping through my array of fields. So that was ugly, but works.

Phrase query words with QueryScorer easily.

0

精彩评论

暂无评论...
验证码 换一张
取 消