带有空格的 solr 查询 [英] solr query with white space

查看:118
本文介绍了带有空格的 solr 查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我搜索一个词,得到的结果如下:

I search for a word and I get the results with facet as follows:

<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 替换空格).但这没有用.各位大侠能帮我解决一下吗?

Then I wrote the condition like fq=itemtype:Factory. I get the results. But I am not getting the results for fq=itemtype:Supply Chain Intermediaries.
I am thinking the problem rests with the spaces in the condition (Supply Chain Intermediaries). I tried with urlencode (to replace spaces with %20) also. But it's of no use. Can you guys please help me to solve this?

对于单个值,它工作正常.我像这样构建查询:

For single value it is working fine. I build the query like this:

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

但我需要写多个值.不带raw的原始Query如下

But i need to write for multiple values. The original Query with out raw is as follows

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

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

Can you guys please help me to solve this.

推荐答案

你的 itemtype 字段是如何分析的?

How is your itemtype field analysed?

如果是 string 类型,则使用:

If it is of type string , then use:

fq=itemtype:"Supply Chain Intermediaries"

否则你也可以试试:

fq=itemtype:(Supply Chain Intermediaries)

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

Assuming OR is the default operator in your config and text is the default search field, your query will get translated to:

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

根据默认搜索字段搜索链和中介.

Chain and Intermediaries are searched against default search field.

这篇关于带有空格的 solr 查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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