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

Support for filtering by a GeoBoundingBox #83

Closed
Tracked by #420
alexander-schranz opened this issue Sep 16, 2024 · 3 comments · Fixed by #84
Closed
Tracked by #420

Support for filtering by a GeoBoundingBox #83

alexander-schranz opened this issue Sep 16, 2024 · 3 comments · Fixed by #84
Labels
enhancement New feature or request

Comments

@alexander-schranz
Copy link
Contributor

alexander-schranz commented Sep 16, 2024

Why Loupe already supports filtering by a GeoDistance. Which support we already merged also int SEAL. It would also be nice to filter by a bounding box (rectangle). That is mostly used for things when a user navigates around a map and have a specific area shown.

Example for a bounding box search AirBnB:

Bildschirmfoto 2024-09-16 um 09 36 00


I did some research about it what input parameters most search engine uses:

Algolia, Elasticsearch / Opensearch are using Top Left -> Bottom Right ↘️

Meilisearch is using Top Right -> Bottom Left ↙️

For me it was little bit strange and unusually that Meilisearch did go here another way. But after some research I found out it totally make sense. The JS libraries Google Maps API and MapBox API returns NorthEast (TopRight) -> SouthWest (BottomLeft). meilisearch/specifications#223. I like that way to be similar to the JS libraries most people will use and think that make more sense to avoid converting to another way.

So I think the $north, $east, $south, $west or [$north, $east], [$south, $west] make most sense for input parameters.

Links to the different search engines docs about this can be found here: PHP-CMSIG/search#365 (comment).


Some search engine only support polygon. That might be a problem if you view on areas which are bigger as half the world map as polygon goes then the shorter way and than completly exclude the area you view. In a polygon based search on areas bigger half worldmap we would need fill things with additional coordinates to avoid that flip of the polygon.

@Toflar Toflar added the enhancement New feature or request label Sep 16, 2024
@Toflar
Copy link
Contributor

Toflar commented Sep 16, 2024

This shouldn't be too hard to implement and would be a nice addition. I think I might want to add this, yes.
Personally, I feel like we should keep the same API as Meilisearch because the rest of Loupe is already heavily inspired by it, wdyt? Would you care to create a PR with a test case for this new feature? Maybe you already have something in SEAL? I will then see if I can take care of the feature implementation itself :)

@alexander-schranz
Copy link
Contributor Author

Would you care to create a PR with a test case for this new feature?

Sure, I will provide a merge request with a test case for this feature, as soon as I finished the test case on SEAL side.

I feel like we should keep the same API as Meilisearch because the rest of Loupe is already heavily inspired by it, wdyt?

I agree here I even will go with the Meilisearch based arguments in SEAL because it makes for me more sense to be as near as possible to the JS libraries and avoid that they need to convert or calculate reversed coordinates.

@alexander-schranz
Copy link
Contributor Author

@Toflar here you go: #84 (review) :)

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

Successfully merging a pull request may close this issue.

2 participants