how to do case sensitive search using cq-engine SQL queries?

101 views
Skip to first unread message

Ramesh M

unread,
Dec 6, 2018, 3:42:49 PM12/6/18
to cqengine-discuss
how to do case sensitive search using cq-engine SQL queries.

ResultSet<Car> results = parser.retrieve(cars, "SELECT * FROM cars WHERE ( manufacturer like '%FORD%' ");

the user may not search the same value as DB so we are planning to search case sensitive, in DB we have manufacturer values as Ford if user search ford or Ford or FoRD cq-engine has to consider as a match, we can convert the manufacturer to lower / upper case or search keys also similar case , but I can't convert huge collection performance issue and a lot of work. is there a way do to cq-engine case sensitive search?

Niall Gallagher

unread,
Dec 7, 2018, 7:12:58 PM12/7/18
to cqengine...@googlegroups.com
For case insensitive search, you don't need to modify data in your collection to be in a certain case. You can just modify your attribute (e.g. the MANUFACTURER attribute) to convert to lower or uppercase instead. This way your data can remain as-is, but whenever CQEngine accesses it, CQEngine will see it in a certain case only. (You could optionally add an index on the attribute if you wish too, to avoid the repeated conversion during retrieval)

If your attribute converts to lowercase, then you'll also need to make sure the search terms in your queries will be supplied in lowercase as well.

Best regards,
Niall

--
-- You received this message because you are subscribed to the "cqengine-discuss" group.
http://groups.google.com/group/cqengine-discuss
---
You received this message because you are subscribed to the Google Groups "cqengine-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cqengine-discu...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages