|
@@ -641,30 +641,34 @@ index_add_mods(
|
|
|
* for this attribute?)
|
|
|
*/
|
|
|
if (evals == NULL || evals[0] == NULL) {
|
|
|
- flags = BE_INDEX_DEL|BE_INDEX_PRESENCE;
|
|
|
+ /* The new entry newe does not have the attribute at all
|
|
|
+ * including the one with subtypes. Thus it's safe to
|
|
|
+ * remove the presence and equality index.
|
|
|
+ */
|
|
|
+ flags = BE_INDEX_DEL|BE_INDEX_PRESENCE|BE_INDEX_EQUALITY;
|
|
|
} else {
|
|
|
flags = BE_INDEX_DEL;
|
|
|
- }
|
|
|
|
|
|
- /* If the same value doesn't exist in a subtype, set
|
|
|
- * BE_INDEX_EQUALITY flag so the equality index is
|
|
|
- * removed.
|
|
|
- */
|
|
|
- slapi_entry_attr_find( newe->ep_entry, mods[i]->mod_type, &curr_attr);
|
|
|
- if (curr_attr) {
|
|
|
- for (j = 0; mods_valueArray[j] != NULL; j++ ) {
|
|
|
- if ( valuearray_find(curr_attr, evals, mods_valueArray[j]) == -1 ) {
|
|
|
- if (!(flags & BE_INDEX_EQUALITY)) {
|
|
|
- flags |= BE_INDEX_EQUALITY;
|
|
|
+ /* If the same value doesn't exist in a subtype, set
|
|
|
+ * BE_INDEX_EQUALITY flag so the equality index is
|
|
|
+ * removed.
|
|
|
+ */
|
|
|
+ slapi_entry_attr_find( olde->ep_entry, mods[i]->mod_type, &curr_attr );
|
|
|
+ if (curr_attr) {
|
|
|
+ int found = 0;
|
|
|
+ for (j = 0; mods_valueArray[j] != NULL; j++ ) {
|
|
|
+ if ( valuearray_find(curr_attr, evals, mods_valueArray[j]) > -1 ) {
|
|
|
+ found = 1;
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- } else {
|
|
|
- /* If we didn't find the attribute in the new
|
|
|
- * entry, we should remove the equality index. */
|
|
|
- if (!(flags & BE_INDEX_EQUALITY)) {
|
|
|
- flags |= BE_INDEX_EQUALITY;
|
|
|
- }
|
|
|
+ /*
|
|
|
+ * to-be-deleted curr_attr does not exist in the
|
|
|
+ * new value set evals. So, we can remove it.
|
|
|
+ */
|
|
|
+ if (!found && !(flags & BE_INDEX_EQUALITY)) {
|
|
|
+ flags |= BE_INDEX_EQUALITY;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
rc = index_addordel_values_sv( be, basetype,
|