public Optional<String> getString(String name) {
        Object feature = features.get(name);
        if (feature == null) return Optional.empty();
        if (feature instanceof String) return Optional.of((String)feature);
        throw new IllegalArgumentException("Expected '" + name + "' to be a string, but it is " +
                                           (feature instanceof Tensor ? "the tensor " + ((Tensor)feature).toAbbreviatedString() :
                                                                        "the double " + feature));
    }
Returns a rank feature as a string, or empty if there is no value with this name.

@throws IllegalArgumentException if the value is a tensor or double, not a string
container-search/src/main/java/com/yahoo/search/query/ranking/RankFeatures.java