Add missing TextQueryBuilder and FuzzyQueryBuilder properties
This commit is contained in:
parent
783649adc7
commit
22b2aa69d1
|
@ -40,6 +40,8 @@ public class FuzzyQueryBuilder extends BaseQueryBuilder {
|
|||
|
||||
private Integer prefixLength;
|
||||
|
||||
private Integer maxExpansions;
|
||||
|
||||
/**
|
||||
* Constructs a new term query.
|
||||
*
|
||||
|
@ -75,6 +77,11 @@ public class FuzzyQueryBuilder extends BaseQueryBuilder {
|
|||
return this;
|
||||
}
|
||||
|
||||
public FuzzyQueryBuilder maxExpansions(int maxExpansions) {
|
||||
this.maxExpansions = maxExpansions;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doXContent(XContentBuilder builder, Params params) throws IOException {
|
||||
builder.startObject(FuzzyQueryParser.NAME);
|
||||
|
@ -92,6 +99,9 @@ public class FuzzyQueryBuilder extends BaseQueryBuilder {
|
|||
if (prefixLength != null) {
|
||||
builder.field("prefix_length", prefixLength);
|
||||
}
|
||||
if (maxExpansions != null) {
|
||||
builder.field("max_expansions", maxExpansions);
|
||||
}
|
||||
builder.endObject();
|
||||
}
|
||||
builder.endObject();
|
||||
|
|
|
@ -126,6 +126,11 @@ public class TextQueryBuilder extends BaseQueryBuilder {
|
|||
return this;
|
||||
}
|
||||
|
||||
public TextQueryBuilder prefixLength(int prefixLength) {
|
||||
this.prefixLength = prefixLength;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* When using fuzzy or prefix type query, the number of term expansions to use. Defaults to unbounded
|
||||
* so its recommended to set it to a reasonable value for faster execution.
|
||||
|
|
Loading…
Reference in New Issue