仅返回匹配的多值字段

dot*_*hen 4 solr

假设有一个多值、存储和索引的字段,名称为 name comment。执行搜索时,我只想返回comment包含匹配项的值 。例如:

当搜索“黄金”而不是得到这个结果时:

<doc>
    <arr name="comment">
        <str>Theres a lady whos sure</str>
        <str>all that glitters is gold</str>
        <str>and shes buying a stairway to heaven</str>
    </arr>
</doc>
Run Code Online (Sandbox Code Playgroud)

我更愿意得到这个结果:

<doc>
    <arr name="comment">
        <str>all that glitters is gold</str>
    </arr>
</doc>
Run Code Online (Sandbox Code Playgroud)

(记忆中的伪 XML,可能不准确,但说明了这一点)

谢谢。

dot*_*hen 5

考虑到与其他 Solr 用户的对话让我相信这是一个有用的功能,我提交了一个功能请求:

Solr:仅返回匹配的多值字段