Skip to content

Commit

Permalink
Add analyzer and operator parameters to match_bool_prefix in sql and ppl
Browse files Browse the repository at this point in the history
Signed-off-by: MaxKsyunz <[email protected]>
  • Loading branch information
MaxKsyunz committed Jun 16, 2022
1 parent 0bcc123 commit 37992ac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import com.google.common.collect.ImmutableMap;
import org.opensearch.index.query.MatchBoolPrefixQueryBuilder;
import org.opensearch.index.query.Operator;
import org.opensearch.index.query.QueryBuilders;

/**
Expand All @@ -28,6 +29,8 @@ public MatchBoolPrefixQuery() {
(b, v) -> b.fuzzyTranspositions(Boolean.parseBoolean(v.stringValue())))
.put("fuzzy_rewrite", (b, v) -> b.fuzzyRewrite(v.stringValue()))
.put("boost", (b, v) -> b.boost(Float.parseFloat(v.stringValue())))
.put("analyzer", (b, v) -> b.analyzer(v.stringValue()))
.put("operator", (b,v) -> b.operator(Operator.fromString(v.stringValue())))
.build());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ static Stream<List<Expression>> generateValidData() {
dsl.namedArgument("fuzzy_transpositions", DSL.literal("true")),
dsl.namedArgument("fuzzy_rewrite", DSL.literal("constant_score")),
dsl.namedArgument("minimum_should_match", DSL.literal("3")),
dsl.namedArgument("boost", DSL.literal("1"))
dsl.namedArgument("boost", DSL.literal("1")),
dsl.namedArgument("analyzer", DSL.literal("simple")),
dsl.namedArgument("operator", DSL.literal("Or")),
dsl.namedArgument("operator", DSL.literal("and"))
).stream().map(arg -> List.of(field, query, arg));
}

Expand Down

0 comments on commit 37992ac

Please sign in to comment.