如何在Solr

时间:2016-04-22 09:57:48

标签: 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
}
}

谢谢

1 个答案:

答案 0 :(得分:0)

试试这个

  

Q =字段名: “查询字符串”

Q = my_field:-1