从 solr 4.5 中的多值字段中删除单个值
Removing a single value from a multiValue field in solr 4.5
我是 solr.solr 查询的新手 我正在获取类似
的数据
{
"responseHeader": {
"status": 0,
"QTime": 0,
"params": {
"indent": "true",
"q": "*:*",
"_": "1449483445811",
"wt": "json",
"fq": "id:0553573403"
}
},
"response": {
"numFound": 1,
"start": 0,
"docs": [
{
"id": "0553573403",
"cat": [
"book",
"book1"
],
"name": "Cyberpunk",
"price": 7.99,
"price_c": "7.99,USD",
"inStock": true,
"author": "George R.R. Martin",
"author_s": "George R.R. Martin",
"series_t": "A Song of Ice and Fire",
"sequence_i": 1,
"genre_s": "fantasy1111",
"labelRequest_j_12536_matching_profile": "1",
"_version_": 1519893543721631700
}
]
}
}
schema.xml 是
<field name="cat" type="string" indexed="true" stored="true" multiValued="true"/>
然后我尝试使用 postman 删除数据,post 方法和内容类型 json 使用此
url-http://localhost:8983/solr/collection1/update/json?commit=true
{
"id" : "0553573403",
"cat" : {"remove":"book1"}
}
然后回复
{"responseHeader":{"status":0,"QTime":616}}
但它没有删除数据..
我猜 id
是你的 uniqueKey
字段。
remove
更新选项在 Solr 4.9 之前不可用,请参阅
https://issues.apache.org/jira/browse/SOLR-3862
我猜你必须像这样覆盖整个字段值列表:
{
"id" : "0553573403",
"cat" : {"set":["book1"]}
}
我是 solr.solr 查询的新手 我正在获取类似
的数据{
"responseHeader": {
"status": 0,
"QTime": 0,
"params": {
"indent": "true",
"q": "*:*",
"_": "1449483445811",
"wt": "json",
"fq": "id:0553573403"
}
},
"response": {
"numFound": 1,
"start": 0,
"docs": [
{
"id": "0553573403",
"cat": [
"book",
"book1"
],
"name": "Cyberpunk",
"price": 7.99,
"price_c": "7.99,USD",
"inStock": true,
"author": "George R.R. Martin",
"author_s": "George R.R. Martin",
"series_t": "A Song of Ice and Fire",
"sequence_i": 1,
"genre_s": "fantasy1111",
"labelRequest_j_12536_matching_profile": "1",
"_version_": 1519893543721631700
}
]
}
}
schema.xml 是
<field name="cat" type="string" indexed="true" stored="true" multiValued="true"/>
然后我尝试使用 postman 删除数据,post 方法和内容类型 json 使用此
url-http://localhost:8983/solr/collection1/update/json?commit=true
{
"id" : "0553573403",
"cat" : {"remove":"book1"}
}
然后回复
{"responseHeader":{"status":0,"QTime":616}}
但它没有删除数据..
我猜 id
是你的 uniqueKey
字段。
remove
更新选项在 Solr 4.9 之前不可用,请参阅
https://issues.apache.org/jira/browse/SOLR-3862
我猜你必须像这样覆盖整个字段值列表:
{
"id" : "0553573403",
"cat" : {"set":["book1"]}
}