-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(dsl): Support matchBooleanPrefix
query
#304
(dsl): Support matchBooleanPrefix
query
#304
Conversation
@@ -0,0 +1,26 @@ | |||
--- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please show using of miniumum_should_match
parameter in doc.
@@ -415,6 +415,44 @@ object ElasticQuery { | |||
final def matches[A: ElasticPrimitive](field: String, value: A): MatchQuery[Any] = | |||
Match(field = field, value = value) | |||
|
|||
/** | |||
* Constructs a type-safe instance of [[zio.elasticsearch.query.MatchBooleanPrefixQuery]] using the specified | |||
* parameters. [[zio.elasticsearch.query.MatchBooleanPrefixQuery]] analyzes its input and constructs a `bool` query |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make bool query a reference.
* @tparam S | ||
* document for which field query is executed | ||
* @tparam A | ||
* the type of value to be matched. A JSON decoder must be in scope for this type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* the type of value to be matched. A JSON decoder must be in scope for this type | |
* the type of value to be matched. A JSON decoder must be provided in the scope for this type |
|
||
/** | ||
* Constructs an instance of [[zio.elasticsearch.query.MatchBooleanPrefixQuery]] using the specified parameters. | ||
* [[zio.elasticsearch.query.MatchBooleanPrefixQuery]] analyzes its input and constructs a `bool` query from the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
* the field for which query is specified for | ||
* @param value | ||
* the value to be matched, represented by an instance of type `A` | ||
* @tparam A |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
) extends MatchBooleanPrefixQuery[S] { self => | ||
def minimumShouldMatch(value: Int): MatchBooleanPrefixQuery[S] = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put an empty line between.
@@ -873,6 +873,53 @@ object ElasticQuerySpec extends ZIOSpecDefault { | |||
equalTo(Match[TestDocument, Double](field = "doubleField", value = 3.14)) | |||
) | |||
}, | |||
test("matchBooleanPrefix") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add one test for query with suffix (for creating json too).
@@ -917,6 +917,48 @@ object HttpExecutorSpec extends IntegrationSpec { | |||
Executor.execute(ElasticRequest.createIndex(firstSearchIndex)), | |||
Executor.execute(ElasticRequest.deleteIndex(firstSearchIndex)).orDie | |||
), | |||
test("search for a document using a match boolean prefix query") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Write just one it-test for this query. There is no need to check minimumShouldMatch
only.
``` | ||
|
||
You can find more information about `MatchBooleanPrefix` query [here](https://www.elastic.co/guide/en/elasticsearch/reference/7.17/query-dsl-match-bool-prefix-query.html). | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary new line.
@@ -873,6 +873,57 @@ object ElasticQuerySpec extends ZIOSpecDefault { | |||
equalTo(Match[TestDocument, Double](field = "doubleField", value = 3.14)) | |||
) | |||
}, | |||
test("matchBooleanPrefix") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this between matchAll
and matches
.
@@ -2427,6 +2478,76 @@ object ElasticQuerySpec extends ZIOSpecDefault { | |||
assert(queryTsInt.toJson(fieldPath = None))(equalTo(expectedTsInt.toJson)) && | |||
assert(queryTsString.toJson(fieldPath = None))(equalTo(expectedTsString.toJson)) | |||
}, | |||
test("matchBooleanPrefix") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this between matchAll
and matches
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job!
Part of #91