[Date Prev][Date Next] [Chronological] [Thread] [Top]

RE: Problem finding telephonenumber in a plain numeric search when number is stored with special characters



Walter Kempel writes:
> So I guess the solution for me would be in
> servers/slapd/schema_init.c:
>
> /* Remove all spaces and '-','(',')','+' characters */
> static int
> telephoneNumberNormalize(
> ...
>  for( p = val->bv_val; *p; p++ ) {
>      if ( ! ( ASCII_SPACE( *p ) || *p == '-' || *p == '(' || *p == ')' || *p == '+' )) {
> ...
>
> Would this be sufficient?

I think so.
Then rebuild the database.  (E.g. slapcat, remove and slapadd it.)

Before rebuilding, I suggest you add an "approx" index for
telephoneNumber in slapd.conf in addition to its current indexes.
Approx matching uses the equality matching rule when there is no no
approx matching rule.

Then search for (telephoneNumber~=whatever) instead of
(telephoneNumber=whatever), and you can drop your patch if we add
similar support for approximate matching.

-- 
Hallvard