]> git.sur5r.net Git - openldap/commitdiff
ITS#2453 import fix from HEAD
authorHoward Chu <hyc@openldap.org>
Fri, 18 Apr 2003 05:07:44 +0000 (05:07 +0000)
committerHoward Chu <hyc@openldap.org>
Fri, 18 Apr 2003 05:07:44 +0000 (05:07 +0000)
servers/slapd/back-bdb/filterindex.c
servers/slapd/back-bdb/search.c

index 80354a7b8ba094afb12ea204e8141716ca11893e..93db2904ad291f0a42eeac2af2d7672447e4d93b 100644 (file)
@@ -50,7 +50,7 @@ bdb_filter_candidates(
        ID *tmp,
        ID *stack )
 {
-       int rc = -1;
+       int rc = 0;
 #ifdef NEW_LOGGING
        LDAP_LOG ( INDEX, ENTRY, "=> bdb_filter_candidates\n", 0, 0, 0 );
 #else
@@ -143,6 +143,10 @@ bdb_filter_candidates(
 #else
                Debug( LDAP_DEBUG_FILTER, "\tNOT\n", 0, 0, 0 );
 #endif
+                { struct bdb_info *bdb = (struct bdb_info *) be->be_private;
+               BDB_IDL_ALL( bdb, ids );
+               }
+
                break;
 
        case LDAP_FILTER_AND:
@@ -208,13 +212,6 @@ list_candidates(
        Debug( LDAP_DEBUG_FILTER, "=> bdb_list_candidates 0x%x\n", ftype, 0, 0 );
 #endif
 
-       if ( ftype == LDAP_FILTER_OR ) {
-               BDB_IDL_ALL( bdb, save );
-               BDB_IDL_ZERO( ids );
-       } else {
-               BDB_IDL_CPY( save, ids );
-       }
-
        for ( f = flist; f != NULL; f = f->f_next ) {
                rc = bdb_filter_candidates( be, f, save, tmp,
                        save+BDB_IDL_UM_SIZE );
@@ -228,12 +225,19 @@ list_candidates(
                }
                
                if ( ftype == LDAP_FILTER_AND ) {
-                       bdb_idl_intersection( ids, save );
+                       if ( f == flist ) {
+                               BDB_IDL_CPY( ids, save );
+                       } else {
+                               bdb_idl_intersection( ids, save );
+                       }
                        if( BDB_IDL_IS_ZERO( ids ) )
                                break;
                } else {
-                       bdb_idl_union( ids, save );
-                       BDB_IDL_ALL( bdb, save );
+                       if ( f == flist ) {
+                               BDB_IDL_CPY( ids, save );
+                       } else {
+                               bdb_idl_union( ids, save );
+                       }
                }
        }
 
@@ -505,7 +509,11 @@ equality_candidates(
                        break;
                }
 
-               bdb_idl_intersection( ids, tmp );
+               if ( i == 0 ) {
+                       BDB_IDL_CPY( ids, tmp );
+               } else {
+                       bdb_idl_intersection( ids, tmp );
+               }
 
                if( BDB_IDL_IS_ZERO( ids ) )
                        break;
@@ -670,7 +678,11 @@ approx_candidates(
                        break;
                }
 
-               bdb_idl_intersection( ids, tmp );
+               if ( i == 0 ) {
+                       BDB_IDL_CPY( ids, tmp );
+               } else {
+                       bdb_idl_intersection( ids, tmp );
+               }
 
                if( BDB_IDL_IS_ZERO( ids ) )
                        break;
@@ -829,7 +841,11 @@ substring_candidates(
                        break;
                }
 
-               bdb_idl_intersection( ids, tmp );
+               if ( i == 0 ) {
+                       BDB_IDL_CPY( ids, tmp );
+               } else {
+                       bdb_idl_intersection( ids, tmp );
+               }
 
                if( BDB_IDL_IS_ZERO( ids ) )
                        break;
index 69f37d5f96a0f2a414fb3def5033e3ee15b1118c..e9b9760b33d3f57f02e8382998ebebfe363ca012 100644 (file)
@@ -338,7 +338,7 @@ dn2entry_retry:
                rc = base_candidate( be, e, candidates );
 
        } else {
-               BDB_IDL_ALL( bdb, candidates );
+               BDB_IDL_ZERO( candidates );
                rc = search_candidates( be, op, e, filter,
                        scope, deref, candidates );
        }