private void limitChunkField(Hit hit, Query query, String fieldName, Set<Integer> topChunkIndexes) {
        var chunks = ((Inspectable) hit.getField(fieldName)).inspect();
        if (chunks.type() != Type.ARRAY) return;
        if (chunks.entryCount() <= topChunkIndexes.size()) return;
        var limitedChunks = new Value.ArrayValue(topChunkIndexes.size());
        for (int i = 0; i < chunks.entryCount(); i++) {
            if (topChunkIndexes.contains(i))
                limitedChunks.add(chunks.entry(i));
        }
        hit.setField(fieldName, limitedChunks);
        if (query.getTrace().isTraceable(3))
            query.trace("limited '" + fieldName + "' in " + hit.getDisplayId() +
                        " to " + limitedChunks.entryCount() +
                        " chunks, down from " + chunks.entryCount(), 3);
    }
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