Upgrade to beat the rule of solr ...

Example of "add" with optional update attribute to set a field to null (i.e. delete a field):

<add>
  <doc>
    <field name="employeeId">05991</field>
    <field name="skills" update="set" null="true" />
  </doc>
</add>
parent c2eb9af5
......@@ -199,7 +199,7 @@ class Document extends AbstractDocument implements DocumentInterface
*/
public function setField($key, $value, $boost = null, $modifier = null)
{
if ($value === null) {
if ($value === null && $modifier == null) {
$this->removeField($key);
} else {
$this->fields[$key] = $value;
......
......@@ -169,6 +169,9 @@ class RequestBuilder extends BaseRequestBuilder
$xml = '<field name="' . $name . '"';
$xml .= $this->attrib('boost', $boost);
$xml .= $this->attrib('update', $modifier);
if($value === null){
$xml .= $this->attrib('null', 'true');
}
$xml .= '>' . htmlspecialchars($value, ENT_NOQUOTES, 'UTF-8');
$xml .= '</field>';
......
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