0
votes

I am in the process of defining a query in which one of the filters can have multiple values (which naturally translates into an OR). However, as I have come to realize, query filters in Objectify are aggregated into an AND operation, and even the 'in' operator is not supported by the underlying Google Cloud SDK in the version 6.

I am trying to use Datastore composite filters to fulfill my need, as this could be a possibility to aggregate predicates with an OR operator, and then pass the constructed Filter object to the Objectify Query.filter() method.

Now here's the issue: the Filter object constructed with composite filters is different from the object accepted by the Objectify .filter() method, the latter being a nested class of StructuredQuery.

Is it possible to use composite filters in an Objectify query? If so, I would appreciate an example of how to proceed.

1

1 Answers

0
votes

I think you are confusing the new Cloud Datastore Java client library (used by Objectify6) with the old Google App Engine SDK (used by Objectify5).

The old GAE SDK supports OR filters. The new one does not (yet). You may wish to request this feature from Google here: https://github.com/GoogleCloudPlatform/google-cloud-java

As an aside: I believe the old SDK was actually processing OR filters by running two separate queries and merging the results client-side. You can do something similar yourself if you're in a hurry and don't want to go back to the old GAE SDK (which only works in GAE Standard).