Solr: how to highlight the whole search phrase only?

前端 未结 2 1056
清歌不尽
清歌不尽 2021-01-06 22:21

A I need to perform a phrase search. On the search results Im getting the exact phrase matches but looking at the highlighted parts I see that the phrase

相关标签:
2条回答
  • 2021-01-06 22:57

    Looking at the docs I have found an option to join a highlight for elements that are next to each other.

    The option is hl.mergeContiguous

    0 讨论(0)
  • 2021-01-06 23:00

    The parameter that needed to be inserted was hl.q which basically means "I want this phrase to be highlighted" and hl.usePhraseHighlighter=true and hl.useFastVectorHighlighter=true

    So by adding to my original query : &hl.q="Day+1"&hl.usePhraseHighlighter=true&hl.useFastVectorHighlighter=true worked.

    for B) I changed fq = post:"day 1" OR title:"day 1" to fq = post:"day 1". I know that the latter is less from what I need be neverthless is works.

    fastVectorHighliter configuration that was used:

       <field name="post" type="text_general" indexed="true" stored="true" required="true" multiValued="false"  termVectors="true" termPositions="true" termOffsets="true"/>
    
    0 讨论(0)
提交回复
热议问题