From d0256dac69af82409b651042ddbf871dd11bdf72 Mon Sep 17 00:00:00 2001 From: Alex Ksikes Date: Mon, 13 Jul 2015 10:21:28 +0200 Subject: [PATCH] RegexpQueryParser takes a String as value like its Builder Relates #11896 Closes #12200 --- .../org/elasticsearch/index/mapper/MappedFieldType.java | 2 +- .../elasticsearch/index/mapper/internal/IdFieldMapper.java | 2 +- .../org/elasticsearch/index/query/RegexpQueryParser.java | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/index/mapper/MappedFieldType.java b/core/src/main/java/org/elasticsearch/index/mapper/MappedFieldType.java index 152bdca7575..4c544dbf37c 100644 --- a/core/src/main/java/org/elasticsearch/index/mapper/MappedFieldType.java +++ b/core/src/main/java/org/elasticsearch/index/mapper/MappedFieldType.java @@ -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); diff --git a/core/src/main/java/org/elasticsearch/index/mapper/internal/IdFieldMapper.java b/core/src/main/java/org/elasticsearch/index/mapper/internal/IdFieldMapper.java index 1669015ed13..3e5a5092228 100644 --- a/core/src/main/java/org/elasticsearch/index/mapper/internal/IdFieldMapper.java +++ b/core/src/main/java/org/elasticsearch/index/mapper/internal/IdFieldMapper.java @@ -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); } diff --git a/core/src/main/java/org/elasticsearch/index/query/RegexpQueryParser.java b/core/src/main/java/org/elasticsearch/index/query/RegexpQueryParser.java index 9085b42d48f..533e3cdfe43 100644 --- a/core/src/main/java/org/elasticsearch/index/query/RegexpQueryParser.java +++ b/core/src/main/java/org/elasticsearch/index/query/RegexpQueryParser.java @@ -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(); } } }