GIScience / oshdb

OpenStreetMap History Data Analysis Framework
https://ohsome.org
GNU Lesser General Public License v3.0
111 stars 18 forks source link

Working regular expression filters #285

Open tyrasd opened 3 years ago

tyrasd commented 3 years ago

There's already some functionality in the OSHDB to filter by OSM tags using regular expressions. But the current implementation does not work on distributed backends (Ignite) because of the non-serializable nature of connections to the keytables database.

I see two possible ways to go forward:

  1. implement a regex -> OSHDBTag matching on the client
  2. if #225 is implemented (i.e. the string tables are distributed as well), regexes can be directly matched with the actualy OSM tags on the server
tyrasd commented 3 years ago

Some initial comments:

Solution 1 has the downside that it only works for "well behaved" regexes which don't match too many tags: it would be problematic when used with unspecific filters like .osmTag("name", Pattern.compile("^[a-z]")) as the amount of tags this translates to could be enormous.

Solution 2 can also optionally have an optimized path which uses solution 1 in cases where it is known that the regex does not produce too many results. But IMHO that would be low priority, because in such cases end users can already choose to use to use an "expanded" non-regex variant of their query.