private void limitChunkFeature(Hit hit, Query query, String fieldName, Set<Integer> topChunkIndexes) {
        String[] components = fieldName.split("\\.");
        FeatureData features = (FeatureData)hit.getField(components[0]);
        if (features == null) return;
        Tensor tensor = features.getTensor(components[1]);
        if (tensor == null) return;
        if (tensor.type().rank() != 1) {
            query.trace("Tensor '" + fieldName + "' doesn't have a single mapped dimension, but has type " +
                        tensor.type() + ". Not limiting.", 2);
        }
        if (tensor.size() <= topChunkIndexes.size()) return;
        Tensor.Builder b = Tensor.Builder.of(tensor.type());
        for (Integer index : topChunkIndexes)
            b.cell(tensor.get(TensorAddress.of(index)), index);
        features.set(components[1], b.build());
    }
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