This project has moved. For the latest updates, please go here.

AddWildcardInFrontOfQuery property

Mar 31, 2016 at 12:49 PM
Dear Team,

I would like to include a wildcard before and after the input string

This definition is managed by the property AddWildcardInFrontOfQuery and its default value is set out to false.

You have stated that starting from the 1.4 version, this option is no longer active by default
but should be the possibility to set up it by means of the administration page.

I cannot find this option but after a deeper investigation I noticed that in the page LdapcpSettings.aspx this option has been made unavailable.

At this point I have made this option available again but when I save the configuration the option is ignored.

Due to that I tried to activate the property updating the database on the object Ldapcp.
In this way an input LDAP query is executed but after the filtering process is applied It cannot display all the results.

Looking at the code of the Ldacp.cs I noticed that in the filtering process the following code is used:

string a = properties[attributeHelper.LDAPAttribute][0].ToString();
if (exactSearch)
{
if (!string.Equals(a, input, StringComparison.InvariantCultureIgnoreCase))
    continue;
}
else if (!a.StartsWith(input, StringComparison.InvariantCultureIgnoreCase))
continue;
The code check that the result starts with the filled in input than delete some results such as herebelow:

-Input String: rossi
-I get two results (Marco Rossi, Rossi Luca)
-1 permission(s) after filtering
In this case the "Marco Rossi" result is discarded because it not start with rossi.

My question is: Is there a workaround for this issue ? and in case is there a way to activate the option ?

Thank you in advance for your kind answer

Giuseppe
Coordinator
Apr 1, 2016 at 3:44 PM
Hello Giuseppe,
Your analysis is correct, and I don't see any workaround for this.
To give you some background, this option was hidden because using a wildcard in front of input prevents LDAP from using its indexers, and it has a dramatic impact on performance, so even if it worked, you would probably not want to use it.
Can't you query an additional attribute that starts with the term instead (like the cn, displayName, sn, etc...) ?
thanks,
Yvan