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

Feature request: 'params' query for feature filtering #59

Closed
minff opened this issue Aug 27, 2020 · 4 comments
Closed

Feature request: 'params' query for feature filtering #59

minff opened this issue Aug 27, 2020 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@minff
Copy link
Contributor

minff commented Aug 27, 2020

Please implement the functionality to filter feature based in the Python client. A feature filter contains 3 components: property name, value and operator. The current implementation is not sufficient when one want to filter feature using an operator other than equal '='

Feature filtering is realized in XYZ API via 'params' query for several endpoint, for example for tile request https://xyz.api.here.com/hub/static/swagger/#/Read%20Features/getFeaturesByTile

Query Syntax ?p.property_name_1=value_1,value_2

Supported operators

"=" - equals
"!=" - not equals
">=" or "=gte=" - greater than or equals
"<=" or "=lte=" - less than or equals
">" or "=gt=" - greater than
"<" or "=lt=" - less than
"@>" or "=cs=" - contains

Thank you

@sackh sackh added the enhancement New feature or request label Aug 27, 2020
@sackh sackh self-assigned this Aug 28, 2020
@sackh
Copy link
Contributor

sackh commented Aug 28, 2020

Fixed in #61

@sackh sackh closed this as completed Aug 28, 2020
@minff
Copy link
Contributor Author

minff commented Aug 28, 2020

I would expect the 'params' query usage to be more user friendly than the query syntax as implemented in PR #61

For example:

params=[
{
"name": "property1",
"operator": ">=",
"values": [ "value1", "value2", "value3" ]
},
{
"name": "property2",
"operator": "=",
"values": [ "value1" ]
}
]

Behind the scene, it will then produce the query string ?p.property1>=value1,value2,value3&p.property2=value1

@sackh
Copy link
Contributor

sackh commented Aug 28, 2020

Below are motivation points for implementation of PR #61

  1. params have been a dictionary from the beginning and did not want to change the interface.

  2. Implementation is similar to the swagger, as the user would type the same thing to get results from swagger.

    your example can be done like this with flat structure and less typing -
    params = {"p.property1=gte": "value1,value2,value3", "p.property2": "value1"}
    Also in your example, we will need one more key in dictionary to specify if it's property or attribute of the feature.
    to implement - ?p.property_name_1=property_value_1&f.special_property_name_1=special_property_value_1

The main motivation is to not change the interface and not nested structure for inputs.

@minff
Copy link
Contributor Author

minff commented Aug 28, 2020

Well I dont particularly like the idea that the user need to put in the prefix "p." and the suffix "=gt" to the property name. Also they are likely to add the suffix "=gt=" (as per XYZ documentation) instead of "=gt". I find it quite confusing to read

Maybe passing the query string directly could be an option ?p.property_name_1>=property_value_1&f.special_property_name_1=special_property_value_1

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

No branches or pull requests

2 participants