QueryBuilder search using array

Hi All
I have the following expression which I am struggling to get right. search is a array and i wanna search through the array not only by equals too but also similar values.

For example
Search [
123,
1234567,
12jefh
]

When i search 123 I want the first 2 elements to be returned

val expression = Expression.property(“meta.type”).equalTo(Expression.string(“Booking”))
.and(Function.upper(Expression.property(“payload.reference”)).like(Expression.string(“%${query.toUpperCase(Locale.ROOT)}%”))
.or(ArrayFunction.contains(
Expression.property(“payload.search”),
Expression.string(query.toUpperCase(Locale.ROOT)))))
.and(Function.upper(Expression.property(“payload.status”)).equalTo(Expression.string(Status.ACTIVE.name)))

You can use Any/Every with Satisfy expression.

Here is an example:

ArrayExpression.any(searchItem).in(payload.search).satisfies(searchItem.like(Expression.string(“climbing”))

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.