Added helper for reseting the index cache
This commit is contained in:
		| @@ -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, and_parts, Q()) | ||||||
|                 q_object = reduce(lambda a, b: a & b, or_group, q_object) |                 q_object = reduce(lambda a, b: a & b, or_group, q_object) | ||||||
|                 clauses.append(q_object) |                 clauses.append(q_object) | ||||||
|  |  | ||||||
|             # Finally, $or the generated clauses in to one query. Each of the |             # Finally, $or the generated clauses in to one query. Each of the | ||||||
|             # clauses is sufficient for the query to succeed. |             # clauses is sufficient for the query to succeed. | ||||||
|             return reduce(lambda a, b: a | b, clauses, Q()) |             return reduce(lambda a, b: a | b, clauses, Q()) | ||||||
| @@ -431,6 +430,11 @@ class QuerySet(object): | |||||||
|  |  | ||||||
|         return spec |         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): |     def __call__(self, q_obj=None, class_check=True, slave_okay=False, **query): | ||||||
|         """Filter the selected documents by calling the |         """Filter the selected documents by calling the | ||||||
|         :class:`~mongoengine.queryset.QuerySet` with a query. |         :class:`~mongoengine.queryset.QuerySet` with a query. | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user