2016-09-20 47 views
0

我正在使用排除和標記進行分面。奇怪的是,這是有用的,我沒有空間的價值。Solr方面標記排除不適用於空間

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 - 這工作

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 - 這不

這兩者之間的唯一區別是空間{!tag=stateName}stateName="Andhra Pradesh"{!tag=stateName}stateName="AndhraPradesh" - 這工作)。

我不明白爲什麼。我試過編碼的URL,即把+%20的空間,仍然沒有運氣。

PFA圖片爲同一enter image description here

工作拷貝enter image description here

編輯

這裏是stateName字段的定義。

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

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

+0

您能否在第二張圖片中發佈完整的請求產生錯誤?它說「無法解析...」似乎在查詢中有一個非轉義的特殊字符。 btw%27不適用於空間,%20是。 – Zac

+0

這是完整的形象,我只是去了這麼多的迴應。 – Akshay

+0

是的,我用%20試過,輸入問題時出現錯字。我編輯了這個問題 – Akshay

回答

0

問題是,local parameters查詢必須在字符串的開頭:

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

,而不是

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

您還可以避免括號:

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

不明白答案,這三個中的哪一個會起作用?括號問題? – Akshay

+0

是的,似乎局部參數(所有介於'{!'和'}'之間的參數)應該停留在圓括號之外 – Zac