File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed
modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,8 @@ public static enum Operator {
45
45
46
46
private String analyzer ;
47
47
48
+ private Boolean autoGeneratePhraseQueries ;
49
+
48
50
private Boolean allowLeadingWildcard ;
49
51
50
52
private Boolean lowercaseExpandedTerms ;
@@ -184,6 +186,19 @@ public FieldQueryBuilder analyzer(String analyzer) {
184
186
return this ;
185
187
}
186
188
189
+ /**
190
+ * Set to true if phrase queries will be automatically generated
191
+ * when the analyzer returns more than one term from whitespace
192
+ * delimited text.
193
+ * NOTE: this behavior may not be suitable for all languages.
194
+ * <p>
195
+ * Set to false if phrase queries should only be generated when
196
+ * surrounded by double quotes.
197
+ */
198
+ public void autoGeneratePhraseQueries (boolean autoGeneratePhraseQueries ) {
199
+ this .autoGeneratePhraseQueries = autoGeneratePhraseQueries ;
200
+ }
201
+
187
202
/**
188
203
* Should leading wildcards be allowed or not. Defaults to <tt>true</tt>.
189
204
*/
@@ -266,6 +281,9 @@ public FieldQueryBuilder analyzeWildcard(boolean analyzeWildcard) {
266
281
if (analyzer != null ) {
267
282
builder .field ("analyzer" , analyzer );
268
283
}
284
+ if (autoGeneratePhraseQueries != null ) {
285
+ builder .field ("auto_generate_phrase_queries" , autoGeneratePhraseQueries );
286
+ }
269
287
if (allowLeadingWildcard != null ) {
270
288
builder .field ("allow_leading_wildcard" , allowLeadingWildcard );
271
289
}
Original file line number Diff line number Diff line change @@ -52,6 +52,8 @@ public static enum Operator {
52
52
53
53
private String analyzer ;
54
54
55
+ private Boolean autoGeneratePhraseQueries ;
56
+
55
57
private Boolean allowLeadingWildcard ;
56
58
57
59
private Boolean lowercaseExpandedTerms ;
@@ -157,6 +159,19 @@ public QueryStringQueryBuilder analyzer(String analyzer) {
157
159
return this ;
158
160
}
159
161
162
+ /**
163
+ * Set to true if phrase queries will be automatically generated
164
+ * when the analyzer returns more than one term from whitespace
165
+ * delimited text.
166
+ * NOTE: this behavior may not be suitable for all languages.
167
+ * <p>
168
+ * Set to false if phrase queries should only be generated when
169
+ * surrounded by double quotes.
170
+ */
171
+ public void autoGeneratePhraseQueries (boolean autoGeneratePhraseQueries ) {
172
+ this .autoGeneratePhraseQueries = autoGeneratePhraseQueries ;
173
+ }
174
+
160
175
/**
161
176
* Should leading wildcards be allowed or not. Defaults to <tt>true</tt>.
162
177
*/
@@ -260,6 +275,9 @@ public QueryStringQueryBuilder boost(float boost) {
260
275
if (analyzer != null ) {
261
276
builder .field ("analyzer" , analyzer );
262
277
}
278
+ if (autoGeneratePhraseQueries != null ) {
279
+ builder .field ("auto_generate_phrase_queries" , autoGeneratePhraseQueries );
280
+ }
263
281
if (allowLeadingWildcard != null ) {
264
282
builder .field ("allow_leading_wildcard" , allowLeadingWildcard );
265
283
}
You can’t perform that action at this time.
0 commit comments