Skip to content

[REQUEST] search geohash tags by prefix #265

Closed

Description

@oren-z0

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 with criterion.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!

Activity

  1. kanishka0411 commented on Apr 27, 2026

    @kanishka0411
    Contributor

    Opened #586 for this. Went with the * suffix - if a #g criterion ends with *, the SQL uses LIKE 'prefix%' and the in-memory matcher uses startsWith(prefix). Without * it's still exact match. Kept scoped to #g, other generic tags untouched.

  2. cameri commented on Apr 30, 2026

    @cameri
    Owner

    Thank you @kanishka0411 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions