From e25d897908d93ab4f9cabadb1029ad3352602d5d Mon Sep 17 00:00:00 2001
From: boli <boli@localhost>
Date: Wed, 31 Oct 2007 22:19:14 +0000
Subject: [PATCH] This set of fixes mainly address the issues where the JE backend does not handle attributes with options and subtypes correctly when they are being indexed.  With this fix: - All values of an indexed attribute type will be indexed correctly on modifies, adds, and deletes.  - Updates to subordinate types will now update the superior type if its indexed.  - Adding and deleting superior attribute types that are not allowed by any object classes (ie. name) will be correctly handled - Deleting all values from an attribute with no options will no longer delete the values from the same attribute but with options.  

---
 opends/src/server/org/opends/server/backends/jeb/PresenceIndexer.java |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/opends/src/server/org/opends/server/backends/jeb/PresenceIndexer.java b/opends/src/server/org/opends/server/backends/jeb/PresenceIndexer.java
index 887746f..c1fa5a6 100644
--- a/opends/src/server/org/opends/server/backends/jeb/PresenceIndexer.java
+++ b/opends/src/server/org/opends/server/backends/jeb/PresenceIndexer.java
@@ -171,6 +171,23 @@
                           Set<ASN1OctetString> delKeys)
        throws DatabaseException
   {
-    replaceEntry(txn, oldEntry, newEntry, addKeys, delKeys);
+    List<Attribute> newAttributes = newEntry.getAttribute(attributeType, true);
+    List<Attribute> oldAttributes = oldEntry.getAttribute(attributeType, true);
+    if(oldAttributes == null)
+    {
+      if(newAttributes != null)
+      {
+        addKeys.add(
+              new ASN1OctetString(AttributeIndex.presenceKey.getData()));
+      }
+    }
+    else
+    {
+      if(newAttributes == null)
+      {
+        delKeys.add(
+              new ASN1OctetString(AttributeIndex.presenceKey.getData()));
+      }
+    }
   }
 }

--
Gitblit v1.10.0