Skip to content
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

Add GeoBoundingBoxCondition #420

Merged

Conversation

ker0x
Copy link
Contributor

@ker0x ker0x commented Sep 14, 2024

@ker0x ker0x marked this pull request as draft September 14, 2024 10:25
@alexander-schranz alexander-schranz added features New feature or request Adapter: Elasticsearch Elasticsearch Adapter releated issue Adapter: Opensearch Opensearch Adapter related issue Adapter: Memory Memory Adapter related issue Adapter: Meilisearch Meilisearch Adapter related issue Adapter: Algolia Algolia Adapter related issue Adapter: Solr Solr Adapter related issue Adapter: Typesense Typesense Adapter related issue Adapter: RediSearch RediSearch Adapter related issue Adapter: Loupe Loupe Adapter related issue SEAL Core Seal Core related issue labels Sep 14, 2024
@alexander-schranz alexander-schranz force-pushed the feature/geo-bounding-box-condition branch from 9bcdfad to c149865 Compare September 14, 2024 14:07
@alexander-schranz
Copy link
Member

I rebased the branch as I merged the Algolia v4 upgrade: #414

Comment on lines 97 to 100
$this->escapeFilterValue($filter->minLatitude),
$this->escapeFilterValue($filter->minLongitude),
$this->escapeFilterValue($filter->maxLatitude),
$this->escapeFilterValue($filter->maxLongitude),
Copy link
Member

Choose a reason for hiding this comment

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

Meilisearch seems to be Top Right to Bottom Left while others are the other way around. I even think about make that default because JS libraries like Google Maps and Mapbox return NorthEast (TopRight) -> SouthWest (BottomLeft) as the bounded context for a map.

@alexander-schranz
Copy link
Member

Loupe supports in the 0.7 version now also GeoBoundingBox: https://github.com/loupe-php/loupe/releases/tag/0.7.0

@alexander-schranz alexander-schranz force-pushed the feature/geo-bounding-box-condition branch from e206d9e to 59e3088 Compare September 18, 2024 16:13
Comment on lines +100 to +116
$filter instanceof Condition\GeoBoundingBoxCondition => ($filters[] = \sprintf(
'@%s:[WITHIN $filter_%s]',
$this->getFilterField($search->indexes, $filter->field),
$key,
)) && ($parameters['filter_' . $key] = \sprintf(
'POLYGON((%s %s, %s %s, %s %s, %s %s, %s %s))',
$filter->westLongitude,
$filter->northLatitude,
$filter->westLongitude,
$filter->southLatitude,
$filter->eastLongitude,
$filter->southLatitude,
$filter->eastLongitude,
$filter->northLatitude,
$filter->westLongitude,
$filter->northLatitude,
)),
Copy link
Member

Choose a reason for hiding this comment

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

GEO type does not support yet filtering by Polygon. Open issue is here: RediSearch/RediSearch#680. Maybe it for them easier to support the bounding box. Lets wait for feedback from them: RediSearch/RediSearch#5032

@alexander-schranz
Copy link
Member

Loupe is implemented now. So only thing we need is to wait feedback from the @RediSearch team about there support for GeoBoundingBox or even Polygon based queries.

@alexander-schranz
Copy link
Member

alexander-schranz commented Sep 20, 2024

I will go with merging the current state maybe we get a response from @RediSearch team soon how the state of the support for bounding box and polygon based queries is on there side.

#422

@alexander-schranz alexander-schranz marked this pull request as ready for review September 20, 2024 09:11
@alexander-schranz alexander-schranz merged commit 15f7024 into PHP-CMSIG:0.5 Sep 20, 2024
4 of 6 checks passed
@ker0x ker0x deleted the feature/geo-bounding-box-condition branch September 20, 2024 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Adapter: Algolia Algolia Adapter related issue Adapter: Elasticsearch Elasticsearch Adapter releated issue Adapter: Loupe Loupe Adapter related issue Adapter: Meilisearch Meilisearch Adapter related issue Adapter: Memory Memory Adapter related issue Adapter: Opensearch Opensearch Adapter related issue Adapter: RediSearch RediSearch Adapter related issue Adapter: Solr Solr Adapter related issue Adapter: Typesense Typesense Adapter related issue features New feature or request SEAL Core Seal Core related issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Core] Add condition GeoBoundingBoxCondition
2 participants