限制/过滤Solr中的多值字段 [英] Limiting / Filtering multivalue fields in Solr

查看:268
本文介绍了限制/过滤Solr中的多值字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法来限制或过滤Solr中多值字段的返回文本?鉴于Solr中的以下文档结构:

  ... 
< doc>
< str name =title>范例< / str>
< arr name =foo>
< str> bar1< / str>
< str> bar2< / str>
< str> bar3< / str>
< str> bar4< / str>
< str> bar5< / str>
< str> bar6< / str>
< / arr>
< / doc>
...

我想限制回应只显示1基于Filter Query请求的foo值。例如,查询:

$ p $ select /?q = example& fq = foo:bar2`
code>

我想要一个响应:

  ... 
< doc>
< str name =title>范例< / str>
< arr name =foo>
< str> bar2< / str>
< / arr>
< / doc>
...


解决方案

没有办法过滤响应中返回的多值。

尽管你可以很容易的在客户端做到这一点。


如果您可以使用Facet获取列表,您可以使用 facet.prefix 限制字段foo作为方面返回的值。


Is there a way to limit, or filter, the returned text of a multivalued field in Solr? Given the following document structure in Solr:

...
<doc>
    <str name="title">example</str>
    <arr name="foo">
        <str>bar1</str>
        <str>bar2</str>
        <str>bar3</str>
        <str>bar4</str>
        <str>bar5</str>
        <str>bar6</str>
    </arr>
</doc>
...

I'd like to limit the response to only show 1 of the "foo" values based on a Filter Query request. So for example, the query:

select/?q=example&fq=foo:bar2`

I would want a response of:

...
<doc>
    <str name="title">example</str>
    <arr name="foo">
        <str>bar2</str>
    </arr>
</doc>
...

解决方案

Nope. There is not way to filter the Multivalued Values returned with the response.
You can easily do it at client side though.

If you can use Facet to get the list, you can use facet.prefix to limit the values for the field foo returned as facet.

这篇关于限制/过滤Solr中的多值字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆