cqengine
cqengine copied to clipboard
Case insensitive search no supported
Hi,
I want to use case insensitive in like query which seems to be not supported with cq
we're also looking for this feature. Any updates ?
Doing this completely transparently in CQEngine would be non-trivial, because fundamentally uppercase and lowercase characters are represented by different bytes. It means many indexes like HashIndex would not support case insensitive search.
However it's pretty easy to solve this/workaround it in your application.
Let's say you wanted case-insensitive search for a field MyObject.foo -
-
Define a FOO_LOWERCASE attribute, which returns object.foo.toLowerCase(). This way you won't actually need to modify your domain objects or store the lowercase text per-se (if you don't want to), the attribute will convert it on-the-fly.
-
When constructing your query, convert the query text .toLowerCase() and use that in your query on the FOO_LOWERCASE attribute.
You can then add any indexes on the FOO_LOWERCASE attribute if you wish.
Hope that helps, Niall
On Thu 16 Sep 2021, 16:26 ankursharma180, @.***> wrote:
we're also looking for this feature. Any updates ?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/npgall/cqengine/issues/290#issuecomment-921003352, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVYTCS4G3OWW2MUIZG27PDUCIEEBANCNFSM5C2WYYTQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.