From 668183d216ba6bcf49e361e5749ac8f2f9a2b780 Mon Sep 17 00:00:00 2001
From: ludovicp <ludovicp@localhost>
Date: Thu, 27 May 2010 14:59:40 +0000
Subject: [PATCH] Fix issue #4468. Now values in filters and indexes are normalized according to the MR used and not the equality MR.

---
 opends/src/server/org/opends/server/backends/jeb/SubstringIndexer.java |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/opends/src/server/org/opends/server/backends/jeb/SubstringIndexer.java b/opends/src/server/org/opends/server/backends/jeb/SubstringIndexer.java
index bcc55e0..f223a00 100644
--- a/opends/src/server/org/opends/server/backends/jeb/SubstringIndexer.java
+++ b/opends/src/server/org/opends/server/backends/jeb/SubstringIndexer.java
@@ -31,6 +31,7 @@
 import org.opends.server.types.*;
 
 import java.util.*;
+import org.opends.server.api.SubstringMatchingRule;
 
 /**
  * An implementation of an Indexer for attribute substrings.
@@ -161,18 +162,21 @@
                               Set<byte[]> keys)
   {
     if (attrList == null) return;
-
     for (Attribute attr : attrList)
     {
       if (attr.isVirtual())
       {
         continue;
       }
+      //Get the substring matching rule.
+      SubstringMatchingRule rule =
+              attr.getAttributeType().getSubstringMatchingRule();
       for (AttributeValue value : attr)
       {
         try
         {
-          byte[] normalizedBytes = value.getNormalizedValue().toByteArray();
+          byte[] normalizedBytes = rule.normalizeValue(value.getValue()).
+                  toByteArray();
 
           substringKeys(normalizedBytes, keys);
         }
@@ -249,11 +253,16 @@
       {
         continue;
       }
+            //Get the substring matching rule.
+      SubstringMatchingRule rule =
+              attr.getAttributeType().getSubstringMatchingRule();
+
       for (AttributeValue value : attr)
       {
         try
         {
-          byte[] normalizedBytes = value.getNormalizedValue().toByteArray();
+          byte[] normalizedBytes = rule.normalizeValue(value.getValue())
+                  .toByteArray();
 
           substringKeys(normalizedBytes, modifiedKeys, insert);
         }

--
Gitblit v1.10.0