public static Type fromString(String name) {
                return Arrays.stream(Type.values()).filter(t -> name.equals(t.asString())).findAny().orElseThrow();
            }
Use this, not name() to retrieve the string value of this.
container-search/src/main/java/com/yahoo/search/schema/DocumentSummary.java