From f2dfc698ddb3816a096c96b27e972d71e3298027 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Fri, 18 Apr 2003 05:07:44 +0000 Subject: [PATCH] ITS#2453 import fix from HEAD --- servers/slapd/back-bdb/filterindex.c | 44 +++++++++++++++++++--------- servers/slapd/back-bdb/search.c | 2 +- 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/servers/slapd/back-bdb/filterindex.c b/servers/slapd/back-bdb/filterindex.c index 80354a7b8b..93db2904ad 100644 --- a/servers/slapd/back-bdb/filterindex.c +++ b/servers/slapd/back-bdb/filterindex.c @@ -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; diff --git a/servers/slapd/back-bdb/search.c b/servers/slapd/back-bdb/search.c index 69f37d5f96..e9b9760b33 100644 --- a/servers/slapd/back-bdb/search.c +++ b/servers/slapd/back-bdb/search.c @@ -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 ); } -- 2.47.2