Solr highlighting every word individually for a phrase query

非 Y 不嫁゛ 提交于 2019-12-12 20:05:24

问题


Say I have a field in Solr which has the value, "The rain in Spain falls mainly in the plain."

And I want a highlighted result for the phrase, "falls mainly".

I pass these parameters to the select...

<lst name="params">
    <str name="hl.fragsize">-1</str>
    <str name="q">"falls mainly"</str>
    <str name="hl.q">"falls mainly"</str>
    <str name="hl.simple.pre">@@pre@@</str>
    <str name="hl.simple.post">@@post@@</str>
    <str name="hl.fl">note</str>
    <str name="hl.maxAnalyzedChars">-1</str>
    <str name="hl">true</str>
    <str name="rows">2147483647</str>
</lst>

And the response comes back with each phrase word individually highlighted...

    <lst name="highlighting">
        <lst name="test">
            <arr name="note">
                <str>
The rain in Spain @@pre@@falls@@post@@ @@pre@@mainly@@post@@ in the plain.
                </str>
            </arr>
        </lst>
    </lst>

What I would have expected was the phrase highlighted...

    <lst name="highlighting">
        <lst name="test">
            <arr name="note">
                <str>
The rain in Spain @@pre@@falls mainly@@post@@ in the plain.
                </str>
            </arr>
        </lst>
    </lst>

I am using Solr version 4.0.

来源:https://stackoverflow.com/questions/16700916/solr-highlighting-every-word-individually-for-a-phrase-query

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