1

In solr 4 is possible to make partial document updates. For example:

<add>
 <doc>
  <field name="id">1</field>
  <field update="set" name="myfield">newvalue</field>
 </doc>
</add>

updates myfield to "newvalue" in record 1 without affecting other fields. But how can I update myfield to NULL?

I tried with

<field update="set" name="myfield"></field>

but obviously it sets an empty string (not NULL) and for date fields raises an error.

Is there a way to do this without updating whole document?

4

1 回答 1

3

根据 set 命令的原子更新文档,您需要null="true"在字段上设置属性。

<add>
 <doc>
  <field name="id">1</field>
  <field update="set" name="myfield" null="true" />
 </doc>
</add>
于 2013-05-30T17:07:44.123 回答