@Override
    public void fill(Result result, String summaryClass, Execution execution) {
        super.fill(result, summaryClass, execution);

        Query query = result.getQuery();

        int chunkLimit = query.properties().getInteger(CHUNK_LIMIT_MAX, 0);
        String chunkFieldNames = query.properties().getString(CHUNK_LIMIT_FIELD);
        String chunkScoresFieldName = query.properties().getString(CHUNK_LIMIT_TENSOR);
        if (chunkLimit == 0 || chunkFieldNames == null || chunkScoresFieldName == null) return;

        query.trace("Pruning excessive chunks from result", 2);
        Iterator<Hit> hitIterator = result.hits().unorderedDeepIterator();
        while (hitIterator.hasNext()) {
            Hit hit = hitIterator.next();
            Set<Integer> topChunkIndexes = topChunkIndices(hit, query, chunkLimit, chunkScoresFieldName);
            if (topChunkIndexes == null) continue;
            limitChunks(hit, query, chunkFieldNames.split(","), topChunkIndexes);
        }
    }
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