-
Notifications
You must be signed in to change notification settings - Fork 20
(dsl): Support Geo bounding box query #651
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
base: main
Are you sure you want to change the base?
Conversation
* @return | ||
* an instance of [[zio.elasticsearch.query.GeoBoundingBoxQuery]] enriched with the `boost` parameter. | ||
*/ | ||
def boost(value: Double): GeoBoundingBoxQuery[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.
Why don't we extend HasBoost
?
* @return | ||
* an instance of [[zio.elasticsearch.query.GeoBoundingBoxQuery]] enriched with the `ignoreUnmapped` parameter. | ||
*/ | ||
def ignoreUnmapped(value: Boolean = false): GeoBoundingBoxQuery[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.
Let's use ignoreUnmapped
without params.
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.
Also, why shouldn't we use already existing HasIgnoreUnmapped
?
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.
Great PR overall!
* @return | ||
* an instance of [[zio.elasticsearch.query.GeoBoundingBoxQuery]] enriched with the `ignoreUnmapped` parameter. | ||
*/ | ||
def ignoreUnmapped(value: Boolean = false): GeoBoundingBoxQuery[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.
Also, why shouldn't we use already existing HasIgnoreUnmapped
?
* @return | ||
* an instance of [[zio.elasticsearch.query.GeoBoundingBoxQuery]] enriched with the `queryName` parameter. | ||
*/ | ||
def name(value: String): GeoBoundingBoxQuery[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.
Since we have this in GeoDistanceQuery
, you should extract this as HasQueryName
and use this option in both queries.
* @return | ||
* an instance of [[zio.elasticsearch.query.GeoDistanceQuery]] enriched with the `validationMethod` parameter. | ||
*/ | ||
def validationMethod(value: ValidationMethod): GeoBoundingBoxQuery[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.
Also this one.
topLeft: GeoPoint, | ||
bottomRight: GeoPoint, |
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.
Reorder these two.
def validationMethod(value: ValidationMethod): GeoBoundingBoxQuery[S] = | ||
self.copy(validationMethod = Some(value)) | ||
|
||
private[elasticsearch] override 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.
Omit override
.
|
||
To ignore unmapped fields (fields that do not exist in the mapping), use the ignoreUnmapped method: | ||
```scala | ||
|
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.
Omit empty line.
.boost(1.5) | ||
``` | ||
|
||
To ignore unmapped fields (fields that do not exist in the mapping), use the ignoreUnmapped method: |
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.
To ignore unmapped fields (fields that do not exist in the mapping), use the ignoreUnmapped method: | |
To ignore unmapped fields (fields that do not exist in the mapping), use the `ignoreUnmapped` method: |
```scala | ||
|
||
val queryWithIgnoreUnmapped = | ||
geoBoundingBoxQuery("location", GeoPoint(40.73, -74.1), GeoPoint(40.01, -71.12)) |
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.
Use named parameters.
To give the query a name for identification in the response, use the name method: | ||
```scala | ||
val queryWithName = | ||
geoBoundingBoxQuery("location", GeoPoint(40.73, -74.1), GeoPoint(40.01, -71.12)) |
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.
Use named parameters.
import zio.elasticsearch.query.ValidationMethod | ||
|
||
val queryWithValidationMethod = | ||
geoBoundingBoxQuery("location", GeoPoint(40.73, -74.1), GeoPoint(40.01, -71.12)) |
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.
Use named parameters.
Part of #91