public String getSearchFilter() {
        StringBuilder filter = new StringBuilder();
        if (searchFilter == null) {
            filter.append('(').append(usernameField).append("={0})");
        }
        else {
            filter.append("(&(").append(usernameField).append("={0})");
            filter.append(searchFilter).append(')');
        }
        return filter.toString();
    }
Returns the filter used for searching the directory for users, which includes
the default filter (username field search) plus any custom-defined search filter.

@return the search filter.
xmppserver/src/main/java/org/jivesoftware/openfire/ldap/LdapManager.java