0

Is there a way to perform ILIKE/LIKE querying on Integer/Long object attributes in Hazelcast's distributed query?

For eg: In postgres, we can query like,

select * from document where CAST(numOfPages AS TEXT) ilike '%2';

to get the documents with total number of pages ending with 2.

Please help me achieve the same scenario for a hazelcast distributed query.

syed
  • 189
  • 3
  • 13

1 Answers1

1

Try a value extractor, http://docs.hazelcast.org/docs/3.10.2/manual/html-single/index.html#custom-attributes

This would allow you to return the numeric field as a string, and then you can run LIKE upon it.

Or you could return odd or even, etc

Neil Stevenson
  • 3,060
  • 9
  • 11
  • I have tried the ValueExtractor and custom attribute approach and it worked. Thanks !. Now I face an issue on my Hazelcast java client application. My environment is using Hazelcast client-server architecture. I am able to query using the custom attribute (in my case docDates) on Hazelcast server application. But when I try to perform a count aggregation using the same custom attribute in a sqlquerypredicate, I'm facing the exception `Caused by:com.hazelcast.query.QueryException:java.lang.IllegalArgumentException: There is no suitable accessor for 'docDates' on class` – syed Jul 11 '18 at 17:22
  • Let's follow that second issue as https://stackoverflow.com/questions/51298037/hazelcast-custom-attribute-predicate-not-considered-when-used-with-imap-aggregat – Neil Stevenson Jul 12 '18 at 19:14