TLDR; Is there a way to filter on fields in a case insensitive way?
I’m trying to build a blog and on blog posts I want to link to list pages for tags. So, a blog post will have a tags property like:
{
tags: ["Apples", "Bananas"]
}
However, when I create a link for a tag I want the URL to be lowercase, so the link should be /tag/apples. When I receive a request to /tag/apples I need to search for blog posts containing the tag apples in a case insensitive way. I can’t find anything in the docs regarding case insensitive querying, except for full text search but in theory using full text search may be risky (as that would also match tags such as “Green apples”).
For most cases this work but it does introduce a potential bug. Let’s say one blog post has the tag “Green apples”, then that post shouldn’t be returned by the query but using [match] it will. Any ideas?
We would also like a way of doing a case insensitive equals search. As the [match] operator is not an exact match, it searches anywhere within the string its not really a viable option for us.
We had a problem last week where content was setup with tags all in UPPERCASE, however the tag configuration within our own database to link to that content was entered in lowercase, causing a bit of a problem when no content was found.
We are going to implement steps to enforce the same casing on both sides, but it would be great if there was a case insensitive equals operator we could use and not have to worry about the case.
Did anyone find a solution to this? My current solution is to use match and then filter the response in my application since I get too many entries in my result (for the reason joelabrahamsson pointed out above).
By the looks of this, I am assuming there is no way to to case insensitive filtering? I am having the same issue, where I am treating the a blog title as the document id (just to make URLs more SEO-friendly). But, match is not doing it for me.