Skip to content

(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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

markok4
Copy link

@markok4 markok4 commented Jun 19, 2025

Part of #91

* @return
* an instance of [[zio.elasticsearch.query.GeoBoundingBoxQuery]] enriched with the `boost` parameter.
*/
def boost(value: Double): GeoBoundingBoxQuery[S]
Copy link
Member

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]
Copy link
Member

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.

Copy link
Collaborator

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?

Copy link
Collaborator

@dbulaja98 dbulaja98 left a 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]
Copy link
Collaborator

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]
Copy link
Collaborator

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]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also this one.

Comment on lines +556 to +557
topLeft: GeoPoint,
bottomRight: GeoPoint,
Copy link
Collaborator

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 =
Copy link
Collaborator

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

Copy link
Collaborator

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:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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))
Copy link
Collaborator

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))
Copy link
Collaborator

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))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use named parameters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants