@Override
    public Result search(Query query, Execution execution) {
        var session = execution.context().schemaInfo().newSession(query);
        ToolBox.visit(new TermSearchValidator(session), query.getModel().getQueryTree().getRoot());

        // Allow the query but add errors. TODO Vespa 9: Consider throwing instead
        var prefixValidator = new PrefixSearchValidator(session);
        ToolBox.visit(prefixValidator, query.getModel().getQueryTree().getRoot());
        Result result = execution.search(query);
        prefixValidator.errors.forEach(error -> result.hits().addError(error));
        return result;
    }
Validation of query operators against the schema which is searched

@author bratseth
container-search/src/main/java/com/yahoo/search/searchers/QueryValidator.java