private Set<Integer> topChunkIndices(Hit hit, Query query, int chunkLimit, String chunkScoresFieldName) {
        FeatureData summaryFeatures = (FeatureData)hit.getField("summaryfeatures");
        if (summaryFeatures == null) {
            query.trace("No summaryfeatures found for hit " + hit.getDisplayId() + ", not limiting", 2);
            return null;
        }
        Tensor chunkScores = summaryFeatures.getTensor(chunkScoresFieldName);
        if (chunkScores == null) {
            query.trace("Field '" + chunkScoresFieldName + "' not present for hit " + hit.getDisplayId() + ", not limiting", 2);
            return null;
        }
        if (chunkScores.isEmpty()) {
            query.trace("Field '" + chunkScoresFieldName + "' has no entries for hit " + hit.getDisplayId() + ", not limiting", 2);
            return null;
        }

        return chunkScoresAsMap(chunkScores).entrySet().stream()
                                                       .sorted((b, a) -> a.getValue().compareTo(b.getValue()))
                                                       .limit(chunkLimit)
                                                       .map(Map.Entry::getKey).map(Long::intValue)
                                                       .collect(Collectors.toSet());
    }
Removes all but the top-n highest scoring entries for a string array field.
The scores should be computed in a tensor returned in summary-features.

@author andreer
container-search/src/main/java/com/yahoo/search/searchers/ChunkLimitingSearcher.java