Solr highlighting

扶醉桌前 提交于 2019-12-22 10:57:55

问题


I saw this post here, he explains well howto show a highlighted result, but for me this is not going to work...

I am getting the lst with highlighting and all, but the text in that is very less compared to the original response without highlighting...

How do I merge highlighting content with original result set in php ?


回答1:


Try hl.fragsize to increase the size of the highlighted snippet returned by Solr.




回答2:


I would recommend to use a non-default highlighter to get much better results. Search in you solrconfig.xml for your RequestHandler:

<requestHandler name="/select" class="solr.SearchHandler">

and add the following:

<str name="hl.usePhraseHighlighter">false</str>
<str name="hl.useFastVectorHighlighter">true</str>
<str name="hl.boundaryScanner">breakIterator</str>

Now goto the Highlighter section

<searchComponent class="solr.HighlightComponent" name="highlight">

and search for this line:

<boundaryScanner name="default" default="false" class="solr.highlight.SimpleBoundaryScanner">

Make sure you set it to "default=false". Afterwards configure the BoundaryScanner defined above as default:

<boundaryScanner name="breakIterator" default="true" class="solr.highlight.BreakIteratorBoundaryScanner">

For this scanner change the type to "SENTENCE":

<str name="hl.bs.type">SENTENCE</str>

And set your language and country setting.

This change gave me a lot better hightlighting results!

Awww - almost forgot to mention the changes in schema.xml. Get the fiel you want to highlight and add following options:

termVectors="true" termPositions="true" termOffsets="true"


来源:https://stackoverflow.com/questions/5152900/solr-highlighting

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