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

Query filters for parent data fields #1646

Open
mansoor-sajjad opened this issue Jan 11, 2023 · 3 comments
Open

Query filters for parent data fields #1646

mansoor-sajjad opened this issue Jan 11, 2023 · 3 comments

Comments

@mansoor-sajjad
Copy link

mansoor-sajjad commented Jan 11, 2023

We can filter the results by country using pelias-api, by using the boundary.country query parameter which will target the country abbreviation field (country_a) under the parents.

We want to have the ability to filter on other parent fields also, may be on Ids instead of abbreviation field.

We are currently using the forked version of pelias-api where we have added ability to search on locality_id and county_id. But this is very specific to out needs.
We may find a general solution to filter on any parent field.

@mansoor-sajjad mansoor-sajjad changed the title Filter on parent data fields Query filters for parent data fields Jan 11, 2023
@missinglink
Copy link
Member

Can boundary.gid be used to replace your forked version which filters on locality_id and county_id?

eg. https://pelias.github.io/compare/#/v1/autocomplete?boundary.gid=whosonfirst%3Alocality%3A1495123997&text=cafe

@mansoor-sajjad
Copy link
Author

Hi @missinglink,

I have analyzed this option and our requirement.
boundary.gid is a nice option but it a very limited, it let us filter the results only on one gid, but we need to filter on multiple localities and counties.

I have analyzed the option to extend boundary.gid to boundary.gids
Which basically means that we will extend the elasticsearch filter query to multiple values.
But then it will be a OR filter across all the parents. And what we are looking for is the Localities AND Counties filter. i.e. separate elasticsearch filter for Localities and Counties so that it will be OR within the single filter and AND across the filters.

For example:
https://api.entur.io/geocoder/v1/autocomplete?lang=no&text=tro&boundary.locality_ids=KVE:TopographicPlace:5001,KVE:TopographicPlace:1820&boundary.county_ids=KVE:TopographicPlace:18,KVE:TopographicPlace:50

Here we are querying the results which have any of the given locality_ids AND any of given county_ids.

@arnesetzer
Copy link

A general purpose boundary.gid like boundary.gid=whosonfirst:region:85681677,whosonfirst:region:85682571 would be a very cool feature. That would simplify a mashup of the boundary.country and the boundary.rectangle filter, which still does not fit our search area completly.

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

No branches or pull requests

3 participants