From ec9db8dec10ddd19da13cd41a3b2d26ef6b4aff9 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Tue, 25 Feb 2003 19:01:33 +0000 Subject: [PATCH] Quick (and incomplete) fix to " foo " indexing --- servers/slapd/schema_init.c | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/servers/slapd/schema_init.c b/servers/slapd/schema_init.c index 12d0d5d324..c7f4aadbf0 100644 --- a/servers/slapd/schema_init.c +++ b/servers/slapd/schema_init.c @@ -1246,8 +1246,8 @@ static int caseExactIgnoreIndexer( BerVarray values, BerVarray *keysp ) { - int i; - unsigned casefold; + int i,j; + unsigned casefold,wasspace; size_t slen, mlen; BerVarray keys; HASH_CONTEXT HASHcontext; @@ -1272,9 +1272,33 @@ static int caseExactIgnoreIndexer( ? LDAP_UTF8_CASEFOLD : LDAP_UTF8_NOCASEFOLD; for( i=0; values[i].bv_val != NULL; i++ ) { - struct berval value; + struct berval value, nvalue; UTF8bvnormalize( &values[i], &value, casefold ); + /* collapse spaces (in place) */ + nvalue.bv_len = 0; + nvalue.bv_val = value.bv_val; + + wasspace=1; + for( j=0; jbv_len > 0 ) { HASH_Update( &HASHcontext, @@ -1285,11 +1309,10 @@ static int caseExactIgnoreIndexer( HASH_Update( &HASHcontext, mr->smr_oid, mlen ); HASH_Update( &HASHcontext, - value.bv_val, value.bv_len ); + nvalue.bv_val, nvalue.bv_len ); HASH_Final( HASHdigest, &HASHcontext ); free( value.bv_val ); - ber_dupbv( &keys[i], &digest ); } -- 2.39.5