Skip to content

Commit 537d56c

Browse files
Address code review comments
1 parent 11bcab7 commit 537d56c

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

server/src/main/java/org/elasticsearch/index/query/WildcardQueryBuilder.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@ public class WildcardQueryBuilder extends AbstractQueryBuilder<WildcardQueryBuil
5656
private static final ParseField CASE_INSENSITIVE_FIELD = new ParseField("case_insensitive");
5757
private boolean caseInsensitive = DEFAULT_CASE_INSENSITIVITY;
5858

59-
// forces a string like match instead of a wildcard match
59+
/**
60+
* Force string matching instead of the field-type-aware wildcard matching.
61+
* When this is true the {@link org.elasticsearch.index.mapper.IndexFieldMapper} will always match of the
62+
* {@code cluster_name:index_name} instead of emulating the glob pattern on the URL.
63+
*/
6064
private boolean forceStringMatch = false;
6165

6266
/**
@@ -81,9 +85,14 @@ public WildcardQueryBuilder(String fieldName, String value) {
8185
this.value = value;
8286
}
8387

84-
public WildcardQueryBuilder(String fieldName, String value, boolean isForESQL) {
88+
/**
89+
* @param forceStringMatch Force string matching instead of the field-type-aware wildcard matching.
90+
* When this is true the {@link org.elasticsearch.index.mapper.IndexFieldMapper} will always match of the
91+
* {@code cluster_name:index_name} instead of emulating the glob pattern on the URL.
92+
*/
93+
public WildcardQueryBuilder(String fieldName, String value, boolean forceStringMatch) {
8594
this(fieldName, value);
86-
this.forceStringMatch = isForESQL;
95+
this.forceStringMatch = forceStringMatch;
8796
}
8897

8998
/**

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/io/stream/ExpressionQueryBuilder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
/**
3232
* Implements an Expression query builder, which matches documents based on a given expression.
33-
* The expression itself must provide the asLuceneQuery and getLuceneQueryDescription methods
33+
* The expression itself must provide the {@link TranslationAware#asLuceneQuery} interface to be translated into a Lucene query.
3434
* It allows for serialization of the expression and generate an AutomatonQuery on the data node
3535
* as Automaton does not support serialization.
3636
*/
@@ -94,7 +94,7 @@ protected void doXContent(XContentBuilder builder, Params params) throws IOExcep
9494
}
9595

9696
@Override
97-
protected Query doToQuery(SearchExecutionContext context) throws IOException {
97+
protected Query doToQuery(SearchExecutionContext context) {
9898
if (expression instanceof TranslationAware translationAware) {
9999
MappedFieldType fieldType = context.getFieldType(fieldName);
100100
if (fieldType == null) {

0 commit comments

Comments
 (0)