A typical geohash filter will look for events in a given bounding box, which can be described by a list of geohash prefixes.
Following the discussion here, I think it would be useful if specifying a "*" at the end of a geohash will mean a search for all events with a geohash tag that contains the requested prefix.
I think the change should be somewhere here, but I'm not familiar with Knex. If filterName[1] is "g" and criterion.slice(-1) is "*", then instead of checking that event_tags contain a pair of [filterName[1], criterion], we should check that event_tags contain a pair with a first element of "g" and a second element that starts withcriterion.slice(0, -1).
A possible alternative is to assume that every geohash filter that has less than 9 characters is actually a "prefix filter", even if it doesn't end with "*".
Another crazy option is to index every geohash value with all of its prefixes (i.e. for and event containing ["g","dqcjqcpew"], also add to the database ["g","dqcjqcpe"],["g","dqcjqcp"],["g","dqcjqc"],["g","dqcjq"],["g","dqcj"],["g","dqc"],["g","dq"],["g","d"] - this is crazy but will make the queries simpler.
A typical geohash filter will look for events in a given bounding box, which can be described by a list of geohash prefixes. Following the discussion here, I think it would be useful if specifying a "*" at the end of a geohash will mean a search for all events with a geohash tag that contains the requested prefix.
I think the change should be somewhere here, but I'm not familiar with Knex. If
filterName[1]
is "g" andcriterion.slice(-1)
is "*", then instead of checking thatevent_tags
contain a pair of[filterName[1], criterion]
, we should check thatevent_tags
contain a pair with a first element of "g" and a second element that starts withcriterion.slice(0, -1)
.A possible alternative is to assume that every geohash filter that has less than 9 characters is actually a "prefix filter", even if it doesn't end with "*".
Another crazy option is to index every geohash value with all of its prefixes (i.e. for and event containing
["g","dqcjqcpew"]
, also add to the database["g","dqcjqcpe"],["g","dqcjqcp"],["g","dqcjqc"],["g","dqcjq"],["g","dqcj"],["g","dqc"],["g","dq"],["g","d"]
- this is crazy but will make the queries simpler.Thanks!