2016-04-22 47 views
0

我想要一個多值字段上的Solr查詢,並且我希望因此只有一個特定值的所有文檔。如何搜索Solr中的多值字段

實施例:

my_field:[1,0]
my_field:[1,1]
my_field:[0,0]
my_field:[ - 1,0]

我想尋找的是具有價值-1

這是我得到

錯誤的所有文件
{ 
responseHeader: { 
status: 400, 
QTime: 1, 
params: { 
fl: "my_field_txt", 
indent: "true", 
q: "*:*", 
wt: "json", 
fq: [ 
"category:PDV", 
"my_field_txt:-1" 
] 
} 
}, 
error: { 
msg: "org.apache.solr.search.SyntaxError: Cannot parse 'my_field_txt:-1': Encountered " "-" "- "" at line 1, column 37. 
Was expecting one of: 
    <BAREOPER> ... 
    "(" ... 
    "*" ... 
    <QUOTED> ... 
    <TERM> ... 
    <PREFIXTERM> ... 
    <WILDTERM> ... 
    <REGEXPTERM> ... 
    "[" ... 
    "{" ... 
    <LPARAMS> ... 
    <NUMBER> ... 
    ", 
code: 400 
} 
} 

謝謝

回答

0

試試這個

Q =字段名: 「查詢字符串」

Q = my_field:-1

+0

這是一個多值字段,所以它不沒有工作 – Fadel

+0

我剛剛檢查過,它在我的機器上工作 – vinod

+0

如果您將示例文檔編入索引solr實例的de exampledocs文件夾。然後嘗試此URL http:// localhost:8983/solr/collection1/select?q = cat:「connector」&wt = json&indent = true – vinod