StationA / tilenol

Scalable, multi-backend geo vector tile server
MIT License
22 stars 6 forks source link

Implements basic support for Elasticsearch "query_string_query" per #20 #27

Closed jerluc closed 4 years ago

jerluc commented 4 years ago

Partially imports simple layer filtering support (as described in #20) by exposing and optional query parameter q. This parameter is used as-is to form an Elasticsearch query_string_query, supporting Lucene query syntax.

Below is an example of this is in action using pre-indexed OSM building data and real-time filtering based on the street name of the building address:

tilenol-qsq

Eventually, it would be good to convert this field such that it could be used for an arbitrary ES query, but for now this gives us some simple filtering in a fairly straightforward fashion.

jerluc commented 4 years ago

LGTM and good to see what we can get this working with a fairly small patch.

My only nitpicky comment is that via TileRequest the entire HTTP Request structure makes it through several layers. -- Just wondering if it would make sense to extract the query in getVectorTile and then pass the query string along rather than the HTTP Request, to avoid having HTTP bleed into other parts of the code.

Because ya know, maybe some day we'll serve other requests than HTTP via tilenol? :)

Good point. My original reason for this is I'm unsure whether or not we'll want to support additional parameters for other source types (e.g. a SQL-backed source or even a file-backed source/mbtiles/Shapefiles/etc.). Maybe what I'll do is change the TileRequest struct to include an extra/optional Args map[string]string field instead, so as to prevent leaking too much of the HTTP details.