From: Kurt Zeilenga Date: Tue, 6 Jun 2000 19:32:15 +0000 (+0000) Subject: Add presense indexing X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~2735 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=dd00feb04db5227ee9d138f3e54f5ad43b69683d;p=openldap Add presense indexing --- diff --git a/servers/slapd/back-ldbm/filterindex.c b/servers/slapd/back-ldbm/filterindex.c index 57a760659a..238c3ae36f 100644 --- a/servers/slapd/back-ldbm/filterindex.c +++ b/servers/slapd/back-ldbm/filterindex.c @@ -136,11 +136,58 @@ presence_candidates( ) { ID_BLOCK *idl; +#ifdef SLAPD_SCHEMA_NOT_COMPAT + DBCache *db; + int rc; + char *dbname; + slap_index mask; + struct berval *prefix; +#endif Debug( LDAP_DEBUG_TRACE, "=> presence_candidates\n", 0, 0, 0 ); #ifdef SLAPD_SCHEMA_NOT_COMPAT idl = idl_allids( be ); + + rc = index_param( be, desc, LDAP_FILTER_PRESENT, + &dbname, &mask, &prefix ); + + if( rc != LDAP_SUCCESS ) { + return idl; + } + + if( dbname == NULL ) { + /* not indexed */ + return idl; + } + + db = ldbm_cache_open( be, dbname, LDBM_SUFFIX, LDBM_READER ); + + if ( db == NULL ) { + Debug( LDAP_DEBUG_ANY, + "<= presense_candidates db open failed (%s%s)\n", + dbname, LDBM_SUFFIX, 0 ); + return idl; + } + + if( prefix != NULL ) { + idl_free( idl ); + idl = NULL; + + rc = key_read( be, db, prefix, &idl ); + + if( rc != LDAP_SUCCESS ) { + Debug( LDAP_DEBUG_TRACE, "<= presense_candidates key read failed (%d)\n", + rc, 0, 0 ); + + } else if( idl == NULL ) { + Debug( LDAP_DEBUG_TRACE, "<= presense_candidates NULL\n", + 0, 0, 0 ); + } + } + + ldbm_cache_close( be, db ); + #else idl = index_read( be, desc, SLAP_INDEX_PRESENT, NULL ); #endif @@ -220,12 +267,6 @@ equality_candidates( return idl; } - if( rc != LDAP_SUCCESS ) { - Debug( LDAP_DEBUG_TRACE, "<= equality_candidates open failed (%d)\n", - rc, 0, 0 ); - return idl; - } - for ( i= 0; keys[i] != NULL; i++ ) { ID_BLOCK *save; ID_BLOCK *tmp; @@ -347,12 +388,6 @@ approx_candidates( return idl; } - if( rc != LDAP_SUCCESS ) { - Debug( LDAP_DEBUG_TRACE, "<= approx_candidates open failed (%d)\n", - rc, 0, 0 ); - return idl; - } - for ( i= 0; keys[i] != NULL; i++ ) { ID_BLOCK *save; ID_BLOCK *tmp;