Warm tip: This article is reproduced from serverfault.com, please click

其他-Solr查询与空白

(其他 - solr query with white space)

发布于 2011-04-26 12:19:13

我搜索一个单词,并按以下方式获得结果:

<lst name="itemtype">
<int name="Internal">108</int>
<int name="Users">73</int>
<int name="Factory">18</int>
<int name="Supply Chain Intermediaries">6</int>
<int name="Company">1</int>
<int name="Monitor/Auditor firm">0</int>
</lst>

然后我写了这样的条件fq=itemtype:Factory我得到结果。但是我没有得到的结果fq=itemtype:Supply Chain Intermediaries
我认为问题在于条件(供应链中介)中的空格。我也尝试了urlencode(用替换空格%20)。但这没用。你们能帮我解决这个问题吗?

更新:

对于单个值,它可以正常工作。我建立这样的查询:

http:localhost:8080/solr/select/?q=adidas&version=2.2&indent=on&facet=on&start=0&rows=20&fq={!raw f=itemtype}Supply Chain Intermediaries

但是我需要写多个值。原来的查询与出原料如下:

http://localhost/solr/select/?q=adidas&version=2.2&indent=on&facet=on&start=0&rows=20&fq=(itemtype:Company itemtype:Supply Chain Intermediaries)

你们能帮我解决这个问题吗?

Questioner
Brahmaji Rao
Viewed
0
5,942 2012-12-28 00:50:46

如何分析你的itemtype字段?

如果它是string类型,则使用:

fq=itemtype:"Supply Chain Intermediaries"

否则,你也可以尝试:

fq=itemtype:(Supply Chain Intermediaries)

假设OR是配置中的默认运算符,并且text是默认搜索字段,则查询将转换为:

fq=itemtype:Supply OR text:(Chain Intermediaries)

将针对默认搜索字段搜索“链”和“中介”。