简体   繁体   English

Solr Facet标签排除不适用于空格

[英]Solr facet tag exclude does not work with space

I am using exclude and tag for faceting. 我正在使用排除和标记进行构面。 Strange this is it works where I don't have space in value. 奇怪的是,在我没有价值的地方,它是可行的。

http://192.168.2.114:8983/solr/customer/select?indent=on&q=*:*&fq=(%7B!tag%3DstateName%7DstateName:%22Gujarat%22)&fq=(%7B!tag%3DstateName%7DstateName:%22AndhraPradesh%22)&facet=true&facet.limit=100&facet.mincount=0&facet.field=%7B!ex%3DstateName%7DcountryName&facet.field=%7B!ex%3DstateName%7DstateName&facet.field=%7B!ex%3DstateName%7Dicity&facet=true - This works http://192.168.2.114:8983/solr/customer/select?indent=on&q=*:*&fq=(%7B!tag%3DstateName%7DstateName:%22Gujarat%22)&fq=(%7B!tag%3DstateName%7DstateName:%22AndhraPradesh%22)&facet=true&facet.limit=100&facet.mincount=0&facet.field=%7B!ex%3DstateName%7DcountryName&facet.field=%7B!ex%3DstateName%7DstateName&facet.field=%7B!ex%3DstateName%7Dicity&facet=true

but

http://192.168.2.114:8983/solr/customer/select?indent=on&q=*:*&fq=(%7B!tag%3DstateName%7DstateName:%22Gujarat%22)&fq=(%7B!tag%3DstateName%7DstateName:%22Andhra Pradesh%22)&facet=true&facet.limit=100&facet.mincount=0&facet.field=%7B!ex%3DstateName%7DcountryName&facet.field=%7B!ex%3DstateName%7DstateName&facet.field=%7B!ex%3DstateName%7Dicity&facet=true - This does not http://192.168.2.114:8983/solr/customer/select?indent=on&q=*:*&fq=(%7B!tag%3DstateName%7DstateName:%22Gujarat%22)&fq=(%7B!tag%3DstateName%7DstateName:%22Andhra Pradesh%22)&facet=true&facet.limit=100&facet.mincount=0&facet.field=%7B!ex%3DstateName%7DcountryName&facet.field=%7B!ex%3DstateName%7DstateName&facet.field=%7B!ex%3DstateName%7Dicity&facet=true这不是

The only difference between these two is a space in {!tag=stateName}stateName="Andhra Pradesh" ( {!tag=stateName}stateName="AndhraPradesh" - this works). 两者之间的唯一区别是{!tag=stateName}stateName="Andhra Pradesh"空格{!tag=stateName}stateName="AndhraPradesh" -有效)。

I don't understand why. 我不明白为什么。 I have tried encoding the URL, ie put + or %20 for space, still no luck. 我已经尝试对URL进行编码,即为空格加+%20 ,仍然没有运气。

PFA images for the same 相同的PFA图像 在此处输入图片说明

Working copy 工作副本 在此处输入图片说明

EDIT 编辑

Here is the definition of stateName field. 这是stateName字段的定义。

<field name="stateName" type="string" multiValued="false" indexed="true" stored="true"/>

<fieldType name="string" class="solr.StrField" sortMissingLast="true"/>

Problem is that local parameters in query must be at the beginning of the string: 问题是查询中的局部参数必须在字符串的开头:

{!tag=stateName}(stateName:"Andhra Pradesh")

and not 并不是

({!tag=stateName}stateName:"Andhra Pradesh")

You can also avoid parenthesis: 您也可以避免括号:

{!tag=stateName}stateName:"Andhra Pradesh"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM