]> git.sur5r.net Git - openldap/commitdiff
Improve handling of initials in approximate search strings.
authorMark Adamson <adamson@openldap.org>
Fri, 3 Nov 2000 16:16:27 +0000 (16:16 +0000)
committerMark Adamson <adamson@openldap.org>
Fri, 3 Nov 2000 16:16:27 +0000 (16:16 +0000)
servers/slapd/schema_init.c

index 1f2c29eaa4d894f59000d63c4df9139144582d70..2e46cac04067ca47fc7f934a1bfa475b036bba13 100644 (file)
@@ -788,17 +788,21 @@ approxMatch(
        len = 0;
        while ( nextchunk < ((struct berval *)assertedValue)->bv_len ) {
                len = strcspn( assertv + nextchunk, SLAPD_APPROX_DELIMITER);
+               if( len == 0 ) {
+                       nextchunk++;
+                       continue;
+               }
 #if defined(SLAPD_APPROX_INITIALS)
-               if( len <= 1 ) {
+               else if( len == 1 ) {
                        /* Single letter words need to at least match one word's initial */
                        for( i=nextavail; i<count; i++ )
-                               if( !strncasecmp( assertv+nextchunk, words[i], 1 ))
+                               if( !strncasecmp( assertv+nextchunk, words[i], 1 )) {
+                                       nextavail=i+1;
                                        break;
+                               }
                }
-
-               else
 #endif
-               {
+               else {
                        /* Isolate the next word in the asserted value and phonetic it */
                        assertv[nextchunk+len] = '\0';
                        val = phonetic( assertv + nextchunk );