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).
Args
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).
Returns
A subset of entities, filtered and ordered according to the query.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2022-09-30 UTC."],[[["This function, `apply_query`, executes a given datastore query on a list of in-memory results, enabling complex queries not supported by the datastore itself."],["For consistent results, especially when the query has inequality filters, it is recommended to use explicit ordering, particularly sorting by `key`."],["The `query` argument is a `datastore_query.Query` object, `entities` is a list of results, and `_key` is an optional function to extract an `entity_pb2.EntityProto` from an entity."],["The function returns a filtered and ordered subset of the provided `entities` based on the conditions specified in the `query`."]]],[]]