/** * Expert: Returns the rewrite method for multiterm queries such as wildcards. * @param parser The {@link org.apache.solr.search.QParser} calling the method * @param field The {@link org.apache.solr.schema.SchemaField} of the field to search * @return A suitable rewrite method for rewriting multi-term queries to primitive queries. */ public MultiTermQuery.RewriteMethod getRewriteMethod(QParser parser, SchemaField field) { if (!field.indexed() && field.hasDocValues()) { return field.multiValued() ? new DocTermOrdsRewriteMethod() : new FieldCacheRewriteMethod(); } else { return MultiTermQuery.CONSTANT_SCORE_AUTO_REWRITE_DEFAULT; } }