MCPcopy Create free account
hub / github.com/django-haystack/django-haystack / start_subtree

Method start_subtree

haystack/backends/__init__.py:357–377  ·  view source on GitHub ↗

Sets up internal state so that new nodes are added to a subtree of the current node. The conn_type specifies how the sub-tree is joined to the existing children.

(self, conn_type)

Source from the content-addressed store, hash-verified

355 self.connector = self.default
356
357 def start_subtree(self, conn_type):
358 """
359 Sets up internal state so that new nodes are added to a subtree of the
360 current node. The conn_type specifies how the sub-tree is joined to the
361 existing children.
362 """
363 if len(self.children) == 1:
364 self.connector = conn_type
365 elif self.connector != conn_type:
366 self.children = [
367 self._new_instance(self.children, self.connector, self.negated)
368 ]
369 self.connector = conn_type
370 self.negated = False
371
372 self.subtree_parents.append(
373 self.__class__(self.children, self.connector, self.negated)
374 )
375 self.connector = self.default
376 self.negated = False
377 self.children = []
378
379 def end_subtree(self):
380 """

Callers 1

add_filterMethod · 0.80

Calls 1

_new_instanceMethod · 0.95

Tested by

no test coverage detected