From 5e023848ded6b5de64c55fec3d604fc93a2ac64b Mon Sep 17 00:00:00 2001 From: Alex Ksikes Date: Tue, 7 Jul 2015 01:46:17 +0200 Subject: [PATCH] Properly fix the default regex flag to ALL for RegexpQueryBuilder and Parser Relates to #11896 Closes #12067 --- .../org/elasticsearch/index/query/RegexpQueryBuilder.java | 2 +- .../java/org/elasticsearch/index/query/RegexpQueryParser.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/index/query/RegexpQueryBuilder.java b/core/src/main/java/org/elasticsearch/index/query/RegexpQueryBuilder.java index fcb41717aa8..ee143eba77c 100644 --- a/core/src/main/java/org/elasticsearch/index/query/RegexpQueryBuilder.java +++ b/core/src/main/java/org/elasticsearch/index/query/RegexpQueryBuilder.java @@ -32,7 +32,7 @@ public class RegexpQueryBuilder extends MultiTermQueryBuilder implements Boostab private final String name; private final String regexp; - private int flags = -1; + private int flags = RegexpQueryParser.DEFAULT_FLAGS_VALUE; private float boost = -1; private String rewrite; private String queryName; 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 7be5b798eac..88a2d6773bb 100644 --- a/core/src/main/java/org/elasticsearch/index/query/RegexpQueryParser.java +++ b/core/src/main/java/org/elasticsearch/index/query/RegexpQueryParser.java @@ -39,6 +39,8 @@ public class RegexpQueryParser implements QueryParser { public static final String NAME = "regexp"; + public static final int DEFAULT_FLAGS_VALUE = RegexpFlag.ALL.value(); + @Inject public RegexpQueryParser() { } @@ -57,7 +59,7 @@ public class RegexpQueryParser implements QueryParser { Object value = null; float boost = 1.0f; - int flagsValue = -1; + int flagsValue = DEFAULT_FLAGS_VALUE; int maxDeterminizedStates = Operations.DEFAULT_MAX_DETERMINIZED_STATES; String queryName = null; String currentFieldName = null;