Java api: add missing rewrite parameter to FuzzyQueryBuilder

We parse the rewrite field in FuzzyQueryParser but we don't allow to set it via FuzzyQueryBuilder for our java api users. Added missing field and setter.

Closes #11130
Closes #11139
This commit is contained in:
javanna 2015-05-13 10:44:04 +02:00 committed by Luca Cavanna
parent 491b00c4ec
commit d2765a2e26
1 changed files with 10 additions and 0 deletions

View File

@ -46,6 +46,8 @@ public class FuzzyQueryBuilder extends BaseQueryBuilder implements MultiTermQuer
//LUCENE 4 UPGRADE we need a testcase for this + documentation
private Boolean transpositions;
private String rewrite;
private String queryName;
/**
@ -89,6 +91,11 @@ public class FuzzyQueryBuilder extends BaseQueryBuilder implements MultiTermQuer
return this;
}
public FuzzyQueryBuilder rewrite(String rewrite) {
this.rewrite = rewrite;
return this;
}
/**
* Sets the query name for the filter that can be used when searching for matched_filters per hit.
*/
@ -120,6 +127,9 @@ public class FuzzyQueryBuilder extends BaseQueryBuilder implements MultiTermQuer
if (maxExpansions != null) {
builder.field("max_expansions", maxExpansions);
}
if (rewrite != null) {
builder.field("rewrite", rewrite);
}
if (queryName != null) {
builder.field("_name", queryName);
}