-
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 prefix query #258
(dsl): Support prefix query #258
Conversation
* @param field | ||
* the type-safe field for which query is specified for | ||
* @param value | ||
* the value that will be used for the query, represented by an instance of type `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.
* the value that will be used for the query, represented by an instance of type `A` | |
* the text value that will be used for the 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.
Can you replace this for term method also?
* @param field | ||
* the field for which query is specified for | ||
* @param value | ||
* the value that will be used for the query, represented by an instance of type `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.
caseInsensitive: Option[Boolean] | ||
) extends PrefixQuery[S] { self => | ||
|
||
override def caseInsensitive(value: Boolean): PrefixQuery[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.
Can you omit override
?
override def caseInsensitive(value: Boolean): PrefixQuery[S] = | ||
self.copy(caseInsensitive = Some(value)) | ||
|
||
override private[elasticsearch] def toJson(fieldPath: Option[String]): Json = { |
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.
Here also.
test("prefix") { | ||
val query = prefix(TestDocument.stringField, "test") | ||
val queryWithCaseInsensitive = prefix(TestDocument.stringField, "test").caseInsensitiveTrue | ||
val queryWithAllParams = prefix(TestDocument.stringField, "test").caseInsensitiveFalse |
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.
Remove this check.
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.
We have only one parameter, so queryWithAllParams
is same as queryWithCaseInsensitive
.
title: "Prefix Query" | ||
--- | ||
|
||
The `Prefix` query returns documents that contain a specific prefix in a provided field. |
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 `Prefix` query returns documents that contain a specific prefix in a provided field. | |
The `Prefix` query returns documents that contain a specific prefix in the provided field. |
@@ -2531,6 +2531,36 @@ object ElasticQuerySpec extends ZIOSpecDefault { | |||
assert(queryWithScoreMode.toJson(fieldPath = None))(equalTo(expectedWithScoreMode.toJson)) && | |||
assert(queryWithAllParams.toJson(fieldPath = None))(equalTo(expectedWithAllParams.toJson)) | |||
}, | |||
test("prefix") { |
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 provide "prefix"
tests in "constructing"
part as well.
No description provided.