PrefixQueryParser takes a String as value like its Builder
Relates #12032 Closes #12204
This commit is contained in:
parent
7367af57cf
commit
165ee4ac7f
|
@ -460,7 +460,7 @@ public abstract class MappedFieldType extends FieldType {
|
|||
return new FuzzyQuery(createTerm(value), fuzziness.asDistance(BytesRefs.toString(value)), prefixLength, maxExpansions, transpositions);
|
||||
}
|
||||
|
||||
public Query prefixQuery(Object value, @Nullable MultiTermQuery.RewriteMethod method, @Nullable QueryParseContext context) {
|
||||
public Query prefixQuery(String value, @Nullable MultiTermQuery.RewriteMethod method, @Nullable QueryParseContext context) {
|
||||
PrefixQuery query = new PrefixQuery(createTerm(value));
|
||||
if (method != null) {
|
||||
query.setRewriteMethod(method);
|
||||
|
|
|
@ -184,7 +184,7 @@ public class IdFieldMapper extends MetadataFieldMapper {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Query prefixQuery(Object value, @Nullable MultiTermQuery.RewriteMethod method, @Nullable QueryParseContext context) {
|
||||
public Query prefixQuery(String value, @Nullable MultiTermQuery.RewriteMethod method, @Nullable QueryParseContext context) {
|
||||
if (indexOptions() != IndexOptions.NONE || context == null) {
|
||||
return super.prefixQuery(value, method, context);
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ public class PrefixQueryParser implements QueryParser {
|
|||
String rewriteMethod = null;
|
||||
String queryName = null;
|
||||
|
||||
Object value = null;
|
||||
String value = null;
|
||||
float boost = 1.0f;
|
||||
String currentFieldName = null;
|
||||
XContentParser.Token token;
|
||||
|
@ -73,7 +73,7 @@ public class PrefixQueryParser implements QueryParser {
|
|||
if ("_name".equals(currentFieldName)) {
|
||||
queryName = parser.text();
|
||||
} else if ("value".equals(currentFieldName) || "prefix".equals(currentFieldName)) {
|
||||
value = parser.objectBytes();
|
||||
value = parser.textOrNull();
|
||||
} else if ("boost".equals(currentFieldName)) {
|
||||
boost = parser.floatValue();
|
||||
} else if ("rewrite".equals(currentFieldName)) {
|
||||
|
@ -88,7 +88,7 @@ public class PrefixQueryParser implements QueryParser {
|
|||
queryName = parser.text();
|
||||
} else {
|
||||
fieldName = currentFieldName;
|
||||
value = parser.objectBytes();
|
||||
value = parser.textOrNull();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue