directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1611363 - /directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/CursorBuilder.java
Date Thu, 17 Jul 2014 14:26:04 GMT
Author: kayyagari
Date: Thu Jul 17 14:26:04 2014
New Revision: 1611363

URL: http://svn.apache.org/r1611363
Log:
keep searching for matches in full index scan mode (DIRSERVER-1965)

Modified:
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/CursorBuilder.java

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/CursorBuilder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/CursorBuilder.java?rev=1611363&r1=1611362&r2=1611363&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/CursorBuilder.java
(original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/CursorBuilder.java
Thu Jul 17 14:26:04 2014
@@ -586,9 +586,22 @@ public class CursorBuilder
 
             // Position the index on the element we should start from
             IndexEntry<String, String> indexEntry = new IndexEntry<String, String>();
-            indexEntry.setKey( node.getInitial() );
-
-            cursor.before( indexEntry );
+            String initial = node.getInitial();
+            
+            boolean fullIndexScan = false;
+            
+            if ( initial == null )
+            {
+                fullIndexScan = true;
+                cursor.beforeFirst();
+            }
+            else
+            {
+                indexEntry.setKey( initial );
+                
+                cursor.before( indexEntry );
+            }
+            
             int nbResults = 0;
 
             MatchingRule rule = attributeType.getSubstring();
@@ -630,13 +643,20 @@ public class CursorBuilder
 
                 String key = indexEntry.getKey();
 
-                if ( !regexp.matcher( key ).matches() )
+                boolean matched = regexp.matcher( key ).matches();
+                
+                if ( !fullIndexScan & !matched )
                 {
                     cursor.close();
 
                     return nbResults;
                 }
 
+                if ( !matched )
+                {
+                    continue;
+                }
+                
                 String uuid = indexEntry.getId();
 
                 if ( !uuidSet.contains( uuid ) )



Mime
View raw message