Discussion:
Extra character when using search filter but won't appear in the search result
Wan Mohd Khairi Wan Mohamed
2010-05-14 10:21:56 UTC
Permalink
Hi all,

We have a little bit of a problem here. When we tried to search in openldap
with the following filter:-

(&(uid=user1)(customAttribute=somevalue))

... it returned no results. But when we use a similar filter, with an
asterisk (*) appended for the 2nd attribute:-

(&(uid=user1)(customAttribute=somevalue*))

We got the result just fine. The funny thing is, the result listed
customAttribute value as just 'somevalue'. We were wondering what's the
extra character that's preventing us from getting the result when using the
filter without the asterisk.

Have anyone encountered similar problem before?

Thanks.

Regards,
Wan Mohd Khairi Wan Mohamed
wankhairi [at] nervesis [dot] com [dot] my
http://www.nervesis.com.my
m***@aero.polimi.it
2010-05-15 02:40:45 UTC
Permalink
Post by Wan Mohd Khairi Wan Mohamed
Hi all,
We have a little bit of a problem here. When we tried to search in openldap
with the following filter:-
(&(uid=user1)(customAttribute=somevalue))
... it returned no results. But when we use a similar filter, with an
asterisk (*) appended for the 2nd attribute:-
(&(uid=user1)(customAttribute=somevalue*))
We got the result just fine. The funny thing is, the result listed
customAttribute value as just 'somevalue'. We were wondering what's the
extra character that's preventing us from getting the result when using the
filter without the asterisk.
Have anyone encountered similar problem before?
All those that change indexes without reindexing the database (man
slapindex(8) for details) experience a similar behavior. Could it be your
case?

p.
m***@aero.polimi.it
2010-05-20 13:27:54 UTC
Permalink
Yes, indeed this is our case. I had to manually slapindex, then only we
got
the correct result (even though we have specified the attribute to index
automatically in slapd.conf).
How do you specify automatic attribute indexing in slapd.conf? I didn't
know about that.
However, do we have to slapindex nightly since this is a case, or is this
a
bug (we're using openldap 2.4.19)?
Apparently, you ran slapindex without even reading the man page. It
*must* be run when you change indexes in slapd.conf, and only in that
case. And slapd *must not* be running when you run slapindex (it
complains and refuses to start, otherwise, as far as I know).

Or, if you modify indexes using ldapmodify in cn=config, re-indexing will
be automatical, no need to run slapindex. Is this what you meant?

p.
m***@aero.polimi.it
2010-05-21 12:45:40 UTC
Permalink
Post by m***@aero.polimi.it
Yes, indeed this is our case. I had to manually slapindex, then only
we
got
the correct result (even though we have specified the attribute to
index
automatically in slapd.conf).
How do you specify automatic attribute indexing in slapd.conf? I didn't
know about that.
We have this line in slapd.conf.
index customAttribute pres,eq
Is this not automatic indexing? Or is it just specifying which attribute
to
index when running slapindex?
man slapd.conf(5):

(about index settings)
...
Note: Indexing support depends on the particular backend in use. Also,
changing these settings will generally require deleting any indices
that depend on these parameters and recreating them with slapindex(8).
...

man slapd-bdb(5):

(about the index directive)
... Note: changing index settings in
slapd.conf(5) requires rebuilding indices, see slapindex(8);
changing index settings dynamically by LDAPModifying "cn=config"
automatically causes rebuilding of the indices online in a back-
ground task.

Could it be any clearer?

p.
Post by m***@aero.polimi.it
However, do we have to slapindex nightly since this is a case, or is
this
a
bug (we're using openldap 2.4.19)?
Apparently, you ran slapindex without even reading the man page. It
*must* be run when you change indexes in slapd.conf, and only in that
case. And slapd *must not* be running when you run slapindex (it
complains and refuses to start, otherwise, as far as I know).
Or, if you modify indexes using ldapmodify in cn=config, re-indexing will
be automatical, no need to run slapindex. Is this what you meant?
I think so. That means, doing ldapmodify when ldap is running live will
automatically re-index the attribute?
Post by m***@aero.polimi.it
p.
Thanks for the help!
Regards,
Wan Mohd Khairi Wan Mohamed
wankhairi [at] nervesis [dot] com [dot] my
http://www.nervesis.com.my
Wan Mohd Khairi Wan Mohamed
2010-05-22 05:36:19 UTC
Permalink
Got it.

Thanks for the help! =)
Post by m***@aero.polimi.it
Post by m***@aero.polimi.it
Yes, indeed this is our case. I had to manually slapindex, then only
we
got
the correct result (even though we have specified the attribute to
index
automatically in slapd.conf).
How do you specify automatic attribute indexing in slapd.conf? I didn't
know about that.
We have this line in slapd.conf.
index customAttribute pres,eq
Is this not automatic indexing? Or is it just specifying which attribute to
index when running slapindex?
(about index settings)
...
Note: Indexing support depends on the particular backend in use. Also,
changing these settings will generally require deleting any indices
that depend on these parameters and recreating them with slapindex(8).
...
(about the index directive)
... Note: changing index settings in
slapd.conf(5) requires rebuilding indices, see slapindex(8);
changing index settings dynamically by LDAPModifying "cn=config"
automatically causes rebuilding of the indices online in a back-
ground task.
Could it be any clearer?
p.
Post by m***@aero.polimi.it
However, do we have to slapindex nightly since this is a case, or is
this
a
bug (we're using openldap 2.4.19)?
Apparently, you ran slapindex without even reading the man page. It
*must* be run when you change indexes in slapd.conf, and only in that
case. And slapd *must not* be running when you run slapindex (it
complains and refuses to start, otherwise, as far as I know).
Or, if you modify indexes using ldapmodify in cn=config, re-indexing will
be automatical, no need to run slapindex. Is this what you meant?
I think so. That means, doing ldapmodify when ldap is running live will
automatically re-index the attribute?
Post by m***@aero.polimi.it
p.
Thanks for the help!
Regards,
Wan Mohd Khairi Wan Mohamed
wankhairi [at] nervesis [dot] com [dot] my
http://www.nervesis.com.my
Wan Mohd Khairi Wan Mohamed
2010-05-21 09:02:24 UTC
Permalink
Post by m***@aero.polimi.it
Post by Wan Mohd Khairi Wan Mohamed
Yes, indeed this is our case. I had to manually slapindex, then only we got
the correct result (even though we have specified the attribute to index
automatically in slapd.conf).
How do you specify automatic attribute indexing in slapd.conf? I didn't
know about that.
We have this line in slapd.conf.

index customAttribute pres,eq

Is this not automatic indexing? Or is it just specifying which attribute to
index when running slapindex?
Post by m***@aero.polimi.it
Post by Wan Mohd Khairi Wan Mohamed
However, do we have to slapindex nightly since this is a case, or is this a
bug (we're using openldap 2.4.19)?
Apparently, you ran slapindex without even reading the man page. It
*must* be run when you change indexes in slapd.conf, and only in that
case. And slapd *must not* be running when you run slapindex (it
complains and refuses to start, otherwise, as far as I know).
Or, if you modify indexes using ldapmodify in cn=config, re-indexing will
be automatical, no need to run slapindex. Is this what you meant?
I think so. That means, doing ldapmodify when ldap is running live will
automatically re-index the attribute?
Post by m***@aero.polimi.it
p.
Thanks for the help!

Regards,
Wan Mohd Khairi Wan Mohamed
wankhairi [at] nervesis [dot] com [dot] my
http://www.nervesis.com.my
Wan Mohd Khairi Wan Mohamed
2010-05-20 08:08:14 UTC
Permalink
Yes, indeed this is our case. I had to manually slapindex, then only we got
the correct result (even though we have specified the attribute to index
automatically in slapd.conf).

However, do we have to slapindex nightly since this is a case, or is this a
bug (we're using openldap 2.4.19)?

Thanks.

Regards,
Wan Mohd Khairi Wan Mohamed
wankhairi [at] nervesis [dot] com [dot] my
http://www.nervesis.com.my
Post by m***@aero.polimi.it
Post by Wan Mohd Khairi Wan Mohamed
Hi all,
We have a little bit of a problem here. When we tried to search in openldap
with the following filter:-
(&(uid=user1)(customAttribute=somevalue))
... it returned no results. But when we use a similar filter, with an
asterisk (*) appended for the 2nd attribute:-
(&(uid=user1)(customAttribute=somevalue*))
We got the result just fine. The funny thing is, the result listed
customAttribute value as just 'somevalue'. We were wondering what's the
extra character that's preventing us from getting the result when using the
filter without the asterisk.
Have anyone encountered similar problem before?
All those that change indexes without reindexing the database (man
slapindex(8) for details) experience a similar behavior. Could it be your
case?
p.
Michael Ströder
2010-05-21 09:18:29 UTC
Permalink
Yes, indeed this is our case. I had to manually slapindex, then only we
got the correct result (even though we have specified the attribute to
index automatically in slapd.conf).
Anything wrong with ownership/permission of the database files?

http://www.openldap.org/faq/data/cache/136.html
However, do we have to slapindex nightly since this is a case, or is
this a bug (we're using openldap 2.4.19)?
No.

Ciao, Michael.
Continue reading on narkive:
Loading...