protected CompositeItem createGramRoot(Query query) {
        return switch (query.properties().getString(gramMatch, "all")) {
            case "all" -> new AndItem();
            case "any" -> new OrItem();
            case "weakAnd" -> new WeakAndItem();
            case "phrase" -> new PhraseItem();
            case "near" -> new NearItem();
            case "onear" -> new ONearItem();
            default -> throw new IllegalArgumentException("Invalid gram.match value '" + query.properties().getString(gramMatch) +
                                                          "'. Must be 'all', 'any', 'weakAnd', 'phrase', 'near' or 'onear'");
        };
    }
Creates the root of the query subtree without access to the term being replaced.
container-search/src/main/java/com/yahoo/search/querytransform/NGramSearcher.java