Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
380 views
in Technique[技术] by (71.8m points)

solr query with white space

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>

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?

Update:

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

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

How is your itemtype field analysed?

If it is of type string , then use:

fq=itemtype:"Supply Chain Intermediaries"

Otherwise you can also try:

fq=itemtype:(Supply Chain Intermediaries)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...