Skip to content

Commit 5e02384

Browse files
committed
Properly fix the default regex flag to ALL for RegexpQueryBuilder and Parser
Relates to #11896 Closes #12067
1 parent 67318ce commit 5e02384

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

core/src/main/java/org/elasticsearch/index/query/RegexpQueryBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class RegexpQueryBuilder extends MultiTermQueryBuilder implements Boostab
3232
private final String name;
3333
private final String regexp;
3434

35-
private int flags = -1;
35+
private int flags = RegexpQueryParser.DEFAULT_FLAGS_VALUE;
3636
private float boost = -1;
3737
private String rewrite;
3838
private String queryName;

core/src/main/java/org/elasticsearch/index/query/RegexpQueryParser.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ public class RegexpQueryParser implements QueryParser {
3939

4040
public static final String NAME = "regexp";
4141

42+
public static final int DEFAULT_FLAGS_VALUE = RegexpFlag.ALL.value();
43+
4244
@Inject
4345
public RegexpQueryParser() {
4446
}
@@ -57,7 +59,7 @@ public Query parse(QueryParseContext parseContext) throws IOException, QueryPars
5759

5860
Object value = null;
5961
float boost = 1.0f;
60-
int flagsValue = -1;
62+
int flagsValue = DEFAULT_FLAGS_VALUE;
6163
int maxDeterminizedStates = Operations.DEFAULT_MAX_DETERMINIZED_STATES;
6264
String queryName = null;
6365
String currentFieldName = null;

0 commit comments

Comments
 (0)