PrefixQueryParser takes a String as value like its Builder

Relates #12032
Closes #12204
This commit is contained in:
Alex Ksikes 2015-07-13 14:45:17 +02:00
parent 7367af57cf
commit 165ee4ac7f
3 changed files with 5 additions and 5 deletions

View File

@ -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);

View File

@ -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);
}

View File

@ -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();
}
}
}