google.appengine.datastore.datastore_query.apply_query

Performs the given query on a set of in-memory results.

This function can perform queries impossible in the datastore (e.g a query with multiple inequality filters on different properties) because all operations are done in memory. For queries that can also be executed on the the datastore, the results produced by this function may not use the same implicit ordering as the datastore. To ensure compatibility, explicit ordering must be used (e.g. 'ORDER BY ineq_prop, ..., key').

Order by key should always be used when a consistent result is desired (unless there is a sort order on another globally unique property).

query a datastore_query.Query to apply
entities a list of results, of arbitrary type, on which to apply the query.
_key a function that takes an element of the result array as an argument and must return an entity_pb2.EntityProto. If not specified, the identity function is used (and entities must be a list of entity_pb2.EntityProto).

A subset of entities, filtered and ordered according to the query.