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

Method build_params

haystack/backends/__init__.py:532–583  ·  view source on GitHub ↗

Generates a list of params to use when searching.

(self, spelling_query=None)

Source from the content-addressed store, hash-verified

530 return None not in (self._results, self._hit_count)
531
532 def build_params(self, spelling_query=None):
533 """Generates a list of params to use when searching."""
534 kwargs = {"start_offset": self.start_offset}
535
536 if self.order_by:
537 kwargs["sort_by"] = self.order_by
538
539 if self.end_offset is not None:
540 kwargs["end_offset"] = self.end_offset
541
542 if self.highlight:
543 kwargs["highlight"] = self.highlight
544
545 if self.facets:
546 kwargs["facets"] = self.facets
547
548 if self.date_facets:
549 kwargs["date_facets"] = self.date_facets
550
551 if self.query_facets:
552 kwargs["query_facets"] = self.query_facets
553
554 if self.narrow_queries:
555 kwargs["narrow_queries"] = self.narrow_queries
556
557 if spelling_query:
558 kwargs["spelling_query"] = spelling_query
559 elif self.spelling_query:
560 kwargs["spelling_query"] = self.spelling_query
561
562 if self.boost:
563 kwargs["boost"] = self.boost
564
565 if self.within:
566 kwargs["within"] = self.within
567
568 if self.dwithin:
569 kwargs["dwithin"] = self.dwithin
570
571 if self.distance_point:
572 kwargs["distance_point"] = self.distance_point
573
574 if self.result_class:
575 kwargs["result_class"] = self.result_class
576
577 if self.fields:
578 kwargs["fields"] = self.fields
579
580 if self.models:
581 kwargs["models"] = self.models
582
583 return kwargs
584
585 def run(self, spelling_query=None, **kwargs):
586 """Builds and executes the query. Returns a list of search results."""

Callers 6

runMethod · 0.95
run_rawMethod · 0.95
test_withinMethod · 0.45
test_dwithinMethod · 0.45
test_distanceMethod · 0.45

Calls

no outgoing calls

Tested by 4

test_withinMethod · 0.36
test_dwithinMethod · 0.36
test_distanceMethod · 0.36