public Collection<Group> search(String query, int startIndex, int numResults) {
        Collection<String> groupNames = provider.search(query, startIndex, numResults);
        return new GroupCollection(groupNames);
    }
Returns the groups that match the search given a start index and desired number
of results. 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.

@param query the search string for group names.
@param startIndex the start index to retrieve the group list from
@param numResults the maximum number of results to return
@return all groups that match the search.
xmppserver/src/main/java/org/jivesoftware/openfire/group/GroupManager.java