-
Notifications
You must be signed in to change notification settings - Fork 15
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] Basic Filtering Options #109
Comments
@CyanRook this looks great! I think I like your proposed API. Some alternatives, just for the sake of brainstorming: // current proposal
{'parameter': 'size', 'condition': '>', 'value': 50}
// filter array
[ 'size', '>', 50 ]
// expression array
[ ">", [ "get", "size" ], "50" ] I'm partial to the object and array formats for the sake of readability + simplicity. I see that you're allowing multiple filter objects, are these AND operators or OR operators? If we go with multiple filters, it makes sense to make this option a full expression, which has this functionality described already. For example we can use the [
"all",
[ ">", [ "get", "size" ], "50" ],
[ "<", [ "get", "size" ], "100" ]
] Implementing expressions is a long-haul option, though. Something more custom that allows us to implement AND/OR operators:
👍 sounds great
probably, but not a deal-breaker for the first implementation of this feature, I think. |
I'm not 100% sure what [ "<", [ "get", "size" ], "100" ] would implement. Would that be querying on both get and size having them be less than 100? |
@CyanRook this is the same thing as By the looks of the |
I think it would be easy enough to implement this format for some basic combinations starting with Proposed new format: [
"and", // Combination operation accepting 'and' and 'or'
["size", ">", 50 ], // Filter operation accepting a keyword, comparator, and numeric value.
["size", "<", 100 ]
] |
Alternatively, do [
"all",
[ ">", [ "get", "size" ], "50" ],
[ "<", [ "get", "size" ], "100" ]
] But without an actual expression engine behind it and error out if anyone tries to do anything outside this specific pattern. |
The final format that was merged is [
"and", // Combination operation accepting 'and' and 'or'
[
["size", ">", 50 ], // Filter operation accepting a keyword, comparator, and numeric value.
["size", "<", 100 ]
]
] This example filter will return features which have 50 < 'size' < 100. Supported combination operation types are 'and' and 'or' |
Premise
VTQuery provides a way to search inside a Vector Tile but doesn't provide a way to filter out results. This feature request is to implement a basic filtering mechanism to return only results that match the filters.
Desired Capability
As part of the options parameter sent to VTQuery, an additional feature can be included labelled
filters
.filters
will contain an array of filter objects which consist of aparameter
,condition
, andvalue
. Each result returned by VTQuery will satisfy all filters.parameter
- This will be the key inside parameters which the filter will be applied tocondition
- Basic filter options <, <=, >, >=, =, !=value
- A value for which the features parameter will be compared.Example
filters: [ {'parameter': 'size', 'condition': '>', 'value': 50}]
will cause VTQuery to return only features with asize
greater than 50.To Be Determined
contains
be implemented for strings?contains StoreName
The text was updated successfully, but these errors were encountered: