@Override
    public Collection<String> search(String query, int startIndex, int numResults)
    {
        if (!isSearchSupported()) {
            throw new UnsupportedOperationException("None of the backing providers support this operation.");
        }

        // TODO improve the performance and efficiency of this! Do not collect _all_ results before returning the page!
        final List<String> allResults = new ArrayList<>();
        for ( final GroupProvider provider : getGroupProviders() )
        {
            if ( provider.isSearchSupported()) {
                allResults.addAll(provider.search(query));
            }
        }
        return allResults.subList(startIndex, Math.min(allResults.size(), startIndex + numResults));
    }
Returns the group names that match a search. The search is over group names and implicitly uses wildcard matching
(although the exact search semantics are left up to each provider implementation). For example, a search for "HR"
should match the groups "HR", "HR Department", and "The HR People".<p>

Before searching or showing a search UI, use the {@link #isSearchSupported} method to ensure that searching is
supported.

This method throws an UnsupportedOperationException when none of the backing providers support search.

@param query the search string for group names.
@return all groups that match the search.
@throws UnsupportedOperationException When none of the providers support search.
xmppserver/src/main/java/org/jivesoftware/openfire/group/GroupMultiProvider.java