Reputation: 33
I'm using Hazelcast PredicateBuilder(https://docs.hazelcast.org/docs/3.6-EA3/javadoc/com/hazelcast/query/PredicateBuilder.html#filter(com.hazelcast.query.impl.QueryContext)) and EntryObject(https://docs.hazelcast.org/docs/3.6-EA3/javadoc/com/hazelcast/query/EntryObject.html) to query a Data store.
Is there a way to combine these functions to get a LIKE
clause? For example if I have animals table, which has id and name field like this Animal(id, name)
and two rows - Animal(1, grey rabbit)
and Animal(2, blue rabbit)
and I'd like to get a query like this:
SELECT id FROM animal WHERE name LIKE '%rabbit%'
Upvotes: 0
Views: 543
Reputation: 556
You can use SqlPredicate, something like that:
map.values(new SqlPredicate("name like '%rabbit%');
or
map.values(new SqlPredicate("__key.name like '%rabbit%');
if you wish to query keys.
Remeber about all the performance problems when using 'like'.
Upvotes: 2