From 7a3412dc13a6745247b723d330bfadb2fa10e025 Mon Sep 17 00:00:00 2001 From: Ross Lawley Date: Wed, 13 Jul 2011 09:54:41 +0100 Subject: [PATCH] Added helper for reseting the index cache --- mongoengine/queryset.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mongoengine/queryset.py b/mongoengine/queryset.py index d55c5f7a..11c7a804 100644 --- a/mongoengine/queryset.py +++ b/mongoengine/queryset.py @@ -122,7 +122,6 @@ class QueryTreeTransformerVisitor(QNodeVisitor): q_object = reduce(lambda a, b: a & b, and_parts, Q()) q_object = reduce(lambda a, b: a & b, or_group, q_object) clauses.append(q_object) - # Finally, $or the generated clauses in to one query. Each of the # clauses is sufficient for the query to succeed. return reduce(lambda a, b: a | b, clauses, Q()) @@ -431,6 +430,11 @@ class QuerySet(object): return spec + @classmethod + def _reset_already_indexed(cls): + """Helper to reset already indexed, can be useful for testing purposes""" + cls.__already_indexed = set() + def __call__(self, q_obj=None, class_check=True, slave_okay=False, **query): """Filter the selected documents by calling the :class:`~mongoengine.queryset.QuerySet` with a query.