RegexpQueryParser takes a String as value like its Builder

Relates #11896
Closes #12200
This commit is contained in:
Alex Ksikes 2015-07-13 10:21:28 +02:00
parent 380648ab86
commit d0256dac69
3 changed files with 5 additions and 5 deletions

View File

@ -468,7 +468,7 @@ public abstract class MappedFieldType extends FieldType {
return query;
}
public Query regexpQuery(Object value, int flags, int maxDeterminizedStates, @Nullable MultiTermQuery.RewriteMethod method, @Nullable QueryParseContext context) {
public Query regexpQuery(String value, int flags, int maxDeterminizedStates, @Nullable MultiTermQuery.RewriteMethod method, @Nullable QueryParseContext context) {
RegexpQuery query = new RegexpQuery(createTerm(value), flags, maxDeterminizedStates);
if (method != null) {
query.setRewriteMethod(method);

View File

@ -201,7 +201,7 @@ public class IdFieldMapper extends MetadataFieldMapper {
}
@Override
public Query regexpQuery(Object value, int flags, int maxDeterminizedStates, @Nullable MultiTermQuery.RewriteMethod method, @Nullable QueryParseContext context) {
public Query regexpQuery(String value, int flags, int maxDeterminizedStates, @Nullable MultiTermQuery.RewriteMethod method, @Nullable QueryParseContext context) {
if (indexOptions() != IndexOptions.NONE || context == null) {
return super.regexpQuery(value, flags, maxDeterminizedStates, method, context);
}

View File

@ -57,7 +57,7 @@ public class RegexpQueryParser implements QueryParser {
String fieldName = parser.currentName();
String rewriteMethod = null;
Object value = null;
String value = null;
float boost = 1.0f;
int flagsValue = DEFAULT_FLAGS_VALUE;
int maxDeterminizedStates = Operations.DEFAULT_MAX_DETERMINIZED_STATES;
@ -76,7 +76,7 @@ public class RegexpQueryParser implements QueryParser {
currentFieldName = parser.currentName();
} else {
if ("value".equals(currentFieldName)) {
value = parser.objectBytes();
value = parser.textOrNull();
} else if ("boost".equals(currentFieldName)) {
boost = parser.floatValue();
} else if ("rewrite".equals(currentFieldName)) {
@ -100,7 +100,7 @@ public class RegexpQueryParser implements QueryParser {
queryName = parser.text();
} else {
fieldName = currentFieldName;
value = parser.objectBytes();
value = parser.textOrNull();
}
}
}