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

Method handle_facet_parameters

haystack/fields.py:492–527  ·  view source on GitHub ↗
(self, kwargs)

Source from the content-addressed store, hash-verified

490 super().__init__(**handled_kwargs)
491
492 def handle_facet_parameters(self, kwargs):
493 if kwargs.get("faceted", False):
494 raise SearchFieldError(
495 "FacetField (%s) does not accept the 'faceted' argument."
496 % self.instance_name
497 )
498
499 if not kwargs.get("null", True):
500 raise SearchFieldError(
501 "FacetField (%s) does not accept False for the 'null' argument."
502 % self.instance_name
503 )
504
505 if not kwargs.get("indexed", True):
506 raise SearchFieldError(
507 "FacetField (%s) does not accept False for the 'indexed' argument."
508 % self.instance_name
509 )
510
511 if kwargs.get("facet_class"):
512 raise SearchFieldError(
513 "FacetField (%s) does not accept the 'facet_class' argument."
514 % self.instance_name
515 )
516
517 self.facet_for = None
518 self.facet_class = None
519
520 # Make sure the field is nullable.
521 kwargs["null"] = True
522
523 if "facet_for" in kwargs:
524 self.facet_for = kwargs["facet_for"]
525 del kwargs["facet_for"]
526
527 return kwargs
528
529 def get_facet_for_name(self):
530 return self.facet_for or self.instance_name

Callers 1

__init__Method · 0.95

Calls 2

SearchFieldErrorClass · 0.90
getMethod · 0.80

Tested by

no test coverage detected