@Override
        public boolean visit(Item item) {
            if (schema.isStreaming()) return true; // prefix is always supported
            if (item instanceof PrefixItem prefixItem) {
                var field = schema.fieldInfo(prefixItem.getIndexName());
                if (field.isEmpty()) return true;
                if ( ! field.get().isAttribute())
                    errors.add(ErrorMessage.createIllegalQuery("'" + prefixItem.getIndexName() +
                                                               "' is not an attribute field: Prefix matching is not supported"));
                if (field.get().isIndex()) // index overrides attribute
                    errors.add(ErrorMessage.createIllegalQuery("'" + prefixItem.getIndexName() +
                                                               "' is an index field: Prefix matching is not supported even when it is also an attribute"));
            }
            return true;
        }
Validation of query operators against the schema which is searched

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