Reputation: 101
I'm using atomic update with Solrj. It works perfectly, but I don’t know how to delete a field within an existing document.
In the Solr tutorial (http://wiki.apache.org/solr/UpdateXmlMessages) they explain how to do it with the xml:
<add>
<doc>
<field name="employeeId">05991</field>
<field name="skills" update="set" null="true" />
</doc>
</add>
Does anyone knows how to do it from SolrJ?
Thanks!
Upvotes: 4
Views: 2526
Reputation: 101
Ok. So apparently this is the way to do so -
SolrInputDocument inputDoc = new SolrInputDocument();
Map<String, String> partialUpdateNull = new HashMap<String, String>();
partialUpdateNull.put("set", null);
inputDoc.setField("FIELD_YOU_WANT_TO_DELETE", partialUpdateNull);
Thanks anyways!
Upvotes: 6