Commit 67586f66 authored by dwsrumwq7cyey7qv's avatar dwsrumwq7cyey7qv Committed by Bas de Nooijer

Add remove command for atomic updates

Official Solr wiki entry to the remove command: https://cwiki.apache.org/confluence/display/solr/Updating+Parts+of+Documents
parent 5fabd8bb
......@@ -80,6 +80,13 @@ class Document extends AbstractDocument implements DocumentInterface
*/
const MODIFIER_ADD = 'add';
/**
* Directive to remove a value (e.g. multivalued fields) using atomic updates
*
* @var string
*/
const MODIFIER_REMOVE = 'remove';
/**
* This value has the same effect as not setting a version
*
......@@ -387,7 +394,7 @@ class Document extends AbstractDocument implements DocumentInterface
*/
public function setFieldModifier($key, $modifier = null)
{
if (!in_array($modifier, array(self::MODIFIER_ADD, self::MODIFIER_INC, self::MODIFIER_SET))) {
if (!in_array($modifier, array(self::MODIFIER_ADD, self::MODIFIER_REMOVE, self::MODIFIER_INC, self::MODIFIER_SET))) {
throw new RuntimeException('Attempt to set an atomic update modifier that is not supported');
}
$this->modifiers[$key] = $modifier;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment