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

Method narrow

haystack/query.py:458–469  ·  view source on GitHub ↗

Pushes existing facet choices into the search.

(self, query)

Source from the content-addressed store, hash-verified

456 return clone
457
458 def narrow(self, query):
459 """Pushes existing facet choices into the search."""
460
461 if isinstance(query, SQ):
462 # produce query string using empty query of the same class
463 empty_query = self.query._clone()
464 empty_query._reset()
465 query = query.as_query_string(empty_query.build_query_fragment)
466
467 clone = self._clone()
468 clone.query.add_narrow_query(query)
469 return clone
470
471 def raw_search(self, query_string, **kwargs):
472 """Passes a raw query directly to the backend."""

Callers 15

searchMethod · 0.45
searchMethod · 0.45
test_narrowMethod · 0.45
test_narrowMethod · 0.45
test_narrow_sqMethod · 0.45
test_multiple_narrowMethod · 0.45
test_narrowMethod · 0.45
test_narrow_sqMethod · 0.45
test_multiple_narrowMethod · 0.45
test_narrowMethod · 0.45
test_narrow_sqMethod · 0.45
test_multiple_narrowMethod · 0.45

Calls 4

_cloneMethod · 0.95
_resetMethod · 0.80
as_query_stringMethod · 0.80
add_narrow_queryMethod · 0.80

Tested by 13

test_narrowMethod · 0.36
test_narrowMethod · 0.36
test_narrow_sqMethod · 0.36
test_multiple_narrowMethod · 0.36
test_narrowMethod · 0.36
test_narrow_sqMethod · 0.36
test_multiple_narrowMethod · 0.36
test_narrowMethod · 0.36
test_narrow_sqMethod · 0.36
test_multiple_narrowMethod · 0.36
test_narrowMethod · 0.36
test_narrow_sqMethod · 0.36