MCPcopy Index your code
hub / github.com/django-haystack/django-haystack / _determine_backend

Method _determine_backend

haystack/query.py:39–58  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

37 self.log = logging.getLogger("haystack")
38
39 def _determine_backend(self):
40 # A backend has been manually selected. Use it instead.
41 if self._using is not None:
42 self.query = connections[self._using].get_query()
43 return
44
45 # No backend, so rely on the routers to figure out what's right.
46 hints = {}
47
48 if self.query:
49 hints["models"] = self.query.models
50
51 backend_alias = connection_router.for_read(**hints)
52
53 # The ``SearchQuery`` might swap itself out for a different variant
54 # here.
55 if self.query:
56 self.query = self.query.using(backend_alias)
57 else:
58 self.query = connections[backend_alias].get_query()
59
60 def __getstate__(self):
61 """

Callers 1

__init__Method · 0.95

Calls 3

get_queryMethod · 0.45
for_readMethod · 0.45
usingMethod · 0.45

Tested by

no test coverage detected