platformOS Community

Case-insensitive Graph Query Filters

Adam Cook Dec 20 2020 at 04:49

Is there a way to filter records in a case-insensitive way? If not, can I recommend a new feature?

In the following graph query:

query records_unique($filter:RecordsFilterInput!) {
    records(
        per_page: 1
        filter: $filter
    ) {
        total_entries
    }
}

We could insert flags, so my param data would be:

{
    "filter": {
        "table": {
            "value": "modules/listings/business"
        },
        "properties": {
            "name": "name",
            "value": "Kings of Cuts",
            "flags": "i"
        }
    }
}
Maciej.Krajowski Dec 22 2020 at 12:19

Thanks AdamC for the suggestion. We would probably want to avoid doing such things on the fly due to the performance considerations. What we were thinking about is to solve this and other similar use cases by giving full control in terms of defining elastic search documents, to which all kinds of transformations could be easily applied. Currently the solution which comes to mind is to have a duplicated property with downcase filter applied, which will be used for search. However, we are also heavily thinking on improving the way how indexes are handled, and applying some filters directly in an index is supported by the DB engines, so it's definitely possible to be able to achieve something like this. What I don't like about flags is that i would make sense only for strings, and there are many other possibilites on the same level - value_int, value_boolean etc. But that's something to determine later - currently we are working on improving the mechanics which would allow us to implement such requests with scalability in mind.

  • Adam Cook Dec 25 2020 at 01:41
    Thanks Maciek. I can see the performance issue.
Rich - One Orange Cow Jan 05 2021 at 10:21

It's a hacky answer, but you could always store a fully lowercase version of the text you wanted to search, downcase the search text, filter on it, but show the actual (non lowercased) version in results.

Please sign in or fill up your profile to answer a question