Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question

Case insensitive queries

Hi, are we able to do case insensitive searches with queries and JDBC API?

Such that...

SQLQuery<myclass> query = new SQLQuery<myclass> (MyClass.class , "myField = John Smith");


SQLQuery<myclass> query = new SQLQuery<myclass> (MyClass.class , "myField = john smith");

yield the same results.

Can't seem to find any settings on the documentation.

{quote}This thread was imported from the previous forum. For your reference, the original is [available here|http://forum.openspaces.org/thread.jspa?threadID=3572]{quote}

asked 2010-12-21 20:56:30 -0500

infectedrhythms gravatar image

updated 2013-08-08 09:52:00 -0500

jaissefsfex gravatar image
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

You have 2 options:
- use like or rlike. Relatively slow. Not recommended.
- Store the data in lower case and query on lower case (or upper case)

answered 2010-12-24 01:41:24 -0500

shay hassidim gravatar image
edit flag offensive delete link more


Then can you do?

class MyClass { String name;

String getName()
      return name;

String getLowerName()
    return name.toLowerCase();


So map the entity as is... And set the @index annotation on a "to lower" method And I assume override equals and hashcode to take into account the to lower value?

infectedrhythms gravatar imageinfectedrhythms ( 2011-01-05 08:12:22 -0500 )edit

YEP! clean and simple.

shay hassidim gravatar imageshay hassidim ( 2011-01-05 08:42:11 -0500 )edit

And I assume the "lower" case value will take up the index space in memory so we are NOT doubling up on memory usage right?

infectedrhythms gravatar imageinfectedrhythms ( 2011-01-05 12:21:09 -0500 )edit

GigaSpaces will maintain an index only for indexed fields. Shay

shay hassidim gravatar imageshay hassidim ( 2011-01-06 11:20:23 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2010-12-21 20:56:30 -0500

Seen: 80 times

Last updated: Dec 24 '10