-#if 0
- /* delete indices for old attributes */
- rc = index_entry_del( be, tid, e, save_attrs);
-
- /* add indices for new attributes */
- rc = index_entry_add( be, tid, e, e->e_attrs);
-#endif
+ /* update the indices of the modified attributes */
+
+ /* start with deleting the old index entries */
+ for ( ap = save_attrs; ap != NULL; ap = ap->a_next ) {
+ if ( ap->a_flags & SLAP_ATTR_IXDEL ) {
+ rc = bdb_index_values( be, tid, ap->a_desc, ap->a_vals,
+ e->e_id, SLAP_INDEX_DELETE_OP );
+ if ( rc != LDAP_SUCCESS ) {
+ attrs_free( e->e_attrs );
+ e->e_attrs = save_attrs;
+ Debug( LDAP_DEBUG_ANY,
+ "Attribute index delete failure",
+ 0, 0, 0 );
+ return rc;
+ }
+ ap->a_flags &= ~SLAP_ATTR_IXDEL;
+ }
+ }