private static List<Hit> getRequestedHits(GroupList resultGroups, int offset, int hits) {
        List<Hit> receivedHits = getAllHitsFromGroupingResult(resultGroups);
        if (receivedHits.size() <= offset) {
            return List.of(); // There weren't any hits as far out as requested.
        }
        int lastRequestedHit = Math.min(offset + hits, receivedHits.size());
        return receivedHits.subList(offset, lastRequestedHit);
    }
Retrieve the actually unique hits from the grouping results.

@param resultGroups the results of the dedup grouping expression.
@param offset       the requested offset. Hits before this are discarded.
@param hits         the requested number of hits. Hits in excess of this are discarded.
@return A list of the actually requested hits, sorted as by the grouping expression.
container-search/src/main/java/com/yahoo/search/grouping/UniqueGroupingSearcher.java