【问题标题】:Removing a single value from a multiValue field in solr 4.5从 solr 4.5 中的 multiValue 字段中删除单个值
【发布时间】:2015-12-07 10:48:07
【问题描述】:

我是 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}}

但它没有删除数据..

【问题讨论】:

    标签: python solr solr4


    【解决方案1】:

    我猜id 是你的uniqueKey 字段。

    remove 更新选项在 Solr 4.9 之前不可用,请参阅 https://issues.apache.org/jira/browse/SOLR-3862

    我猜你必须像这样覆盖整个字段值列表:

    {
        "id"       : "0553573403",
        "cat"      : {"set":["book1"]}
    }
    

    【讨论】:

    • Thanx Simon 但不是正确的方法。这里首先获取数据然后删除该文本并再次在 solr 中设置数据
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-08-28
    • 2012-10-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多