Removing record assignments

You can update records in a running data store by removing standard attribute and managed value assignments.

The ingestRecords operation has two elements that delete assignments from records in the data store:
  • deleteAssignments
  • wildcardDeletes

Both elements can delete standard attribute assignments as well as managed value assignments. Note that the standard attributes or managed values are not removed from the data store; they are removed only from the specified records.

You can use both elements in the same ingestRecords operation. In this case, the wildcardDeletes request is processed before the deleteAssignments request.

Both elements are case sensitive, including the standard attribute and managed value names and their assignment values.

Note: If you submit the ingestRecords request after a Transaction Web Service request that starts an transaction, the request must specify the outer transaction ID. If no outer transactions have been started, the ID attribute must be omitted in the request.

deleteAssignments request

The deleteAssignments element of the ingestRecords operation removes individual standard attribute and/or managed value assignments from Endeca records, but does not otherwise affect the record. You can remove one or more assignments in the same request.

The request must specify the primary key of the record to be updated. The deleteAssignments request format is:
<ingest:ingestRecords 
      xmlns:ingest="http://www.endeca.com/MDEX/ingest/1/0" 
      xmlns:mdex="http://www.endeca.com/MDEX/XQuery/2009/09">
   <ingest:deleteAssignments>
      <mdex:record>
         <primaryKeyProp>keyValue</primaryKeyProp>
         <propName>keyValueToRemove</propName>
         <!-- Other property or dimension value assignments to remove -->
      </mdex:record>
   </ingest:deleteAssignments>
</ingest:ingestRecords>
To remove an individual assignment, specify the key name (i.e., standard attribute name or managed value name) and its value, as in this example:
<ingest:ingestRecords 
      xmlns:ingest="http://www.endeca.com/MDEX/ingest/1/0" 
      xmlns:mdex="http://www.endeca.com/MDEX/XQuery/2009/09">
   <ingest:deleteAssignments>
      <mdex:record>
         <partID>P123</partID>
         <color>red</color>
         <color>blue</color>
         <Component>crankset</Component>
      </mdex:record>
   </ingest:deleteAssignments>
</ingest:ingestRecords>

The example removes two values ("red" and "blue") of the color standard attribute assignment and one managed value ("crankset") from the Component managed value assignment.

A successful ingestRecordsResponse returned from the above sample request should look like this:
<ingest:ingestRecordsResponse 
     xmlns:ingest="http://www.endeca.com/MDEX/ingest/1/0">
   <ingest:numPropertiesCreated>0</ingest:numPropertiesCreated>
   <ingest:numRecordsAffected>1</ingest:numRecordsAffected>
   <ingest:numRecordsDeleted>0</ingest:numRecordsDeleted>
</ingest:ingestRecordsResponse>

The numRecordsAffected element in the response shows that one record was successfully modified.

wildcardDeletes request

The wildcardDeletes element of the ingestRecords operation removes all assignments from the same standard attribute or managed value at once.

The request must specify the primary key of the record to be updated, using this request format:
<ingest:ingestRecords 
      xmlns:ingest="http://www.endeca.com/MDEX/ingest/1/0" 
      xmlns:mdex="http://www.endeca.com/MDEX/XQuery/2009/09">
   <ingest:wildcardDeletes>
      <mdex:record>
         <primaryKeyProp>keyValue</primaryKeyProp>
         <propToRemove />
         <!-- Other property or dimension value assignments to remove -->
      </mdex:record>
   </ingest:wildcardDeletes>
</ingest:ingestRecords>

Note that unlike the deleteAssignments usage, the wildcardDeletes element requires that the propToRemove specification cannot have an assignment value. Only the name of the standard attribute or managed value can be specified.

To remove all assignments on the record from a specific standard attribute or managed value, use a single tag with the attribute, as in this example that removes all assignments from the color standard attribute:
<ingest:ingestRecords 
      xmlns:ingest="http://www.endeca.com/MDEX/ingest/1/0" 
      xmlns:mdex="http://www.endeca.com/MDEX/XQuery/2009/09">
   <ingest:wildcardDeletes>
      <mdex:record>
         <partID>P123</partID>
         <color/>
         <sizes/>
      </mdex:record>
   </ingest:wildcardDeletes>
</ingest:ingestRecords>

In the example, if record P123 had six assignments from the color standard attribute, then all six assignments would be removed; if it had three assignments from the sizes standard attribute, all three would be removed.

If successful, the operation returns the same ingestRecordsResponse as a deleteAssignments request.