@Override
    public Collection<String> search(String key, String value) {
        if (key.equals(Group.SHARED_ROSTER_DISPLAY_NAME_PROPERTY_KEY)){
            return super.search(key,value);
        }

        StringBuilder filter = new StringBuilder();
        filter.append("(&");
        filter.append(MessageFormat.format(manager.getGroupSearchFilter(), "*"));
        filter.append('(').append(key).append('=').append(LdapManager.sanitizeSearchFilter(value, false));
        filter.append("))");
        
        if (!PROCESSBIGGROUPS.getValue())
        {
            if (Log.isDebugEnabled()) {
                Log.debug("Trying to find group names using query: " + filter.toString());
            }

            // Perform the LDAP query
            return manager.retrieveList(
                    manager.getGroupNameField(),
                    filter.toString(),
                    -1,
                    -1,
                    null);
        }
        else
        {
            String ldapfilter = filter.toString();
            String searchRangeStr = ";range=";
            if (ldapfilter.contains(searchRangeStr))
            {
                ldapfilter=ldapfilter.substring(0,ldapfilter.indexOf(searchRangeStr))+
                        ldapfilter.substring(ldapfilter.indexOf("=",
                                ldapfilter.indexOf(searchRangeStr)+searchRangeStr.length()));
            }

            Log.debug("Trying to find group names using query: {}", ldapfilter);

            // Perform the LDAP query
            return manager.retrieveList(
                    manager.getGroupNameField(),
                    ldapfilter,
                    -1,
                    -1,
                    null);
        }
    }
Reads the group with the given DN

@param groupDN         the absolute DN of the group
@param membersToIgnore A mutable set of DNs and/or UIDs (for Posix mode) to ignore. This set will be
                       filled with visited DNs. If flatten of hierarchies of groups is active
                       ({@link LdapManager#isFlattenNestedGroups()}, this will prevent endless loops
                       for cyclic hierarchies.
@return A group (never null)
@throws NamingException When a group can't be read from LDAP.
xmppserver/src/main/java/org/jivesoftware/openfire/ldap/LdapGroupProvider.java