]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-ldbm/filterindex.c
Stop reducing number of substring candiadates when there is only two or
[openldap] / servers / slapd / back-ldbm / filterindex.c
index 1cf5563a4014e7a38cbb395726e84fd287afafc9..97b2c87866f97041ed8a84339f71f8136240fdcf 100644 (file)
@@ -365,6 +365,14 @@ substring_comp_candidates(
                if( idl == NULL ) {
                        break;
                }
+
+               /* if we're down to two (or less) matches, stop searching */
+               if( ID_BLOCK_NIDS(idl) < 3 ) {
+                       Debug( LDAP_DEBUG_TRACE, "substring_comp_candiates: "
+                               "down to a %ld matches, stopped search\n",
+                                       (long) ID_BLOCK_NIDS(idl), 0, 0 );
+                       break;
+               }
        }
 
        Debug( LDAP_DEBUG_TRACE, "<= substring_comp_candidates %ld\n",