MCPcopy
hub / github.com/django/django / __init__

Method __init__

django/contrib/postgres/search.py:461–482  ·  view source on GitHub ↗
(
        self, value, output_field=None, *, invert=False, prefix=False, weight=None
    )

Source from the content-addressed store, hash-verified

459 _output_field = SearchQueryField()
460
461 def __init__(
462 self, value, output_field=None, *, invert=False, prefix=False, weight=None
463 ):
464 if value == "":
465 raise ValueError("Lexeme value cannot be empty.")
466
467 if not isinstance(value, str):
468 raise TypeError(
469 f"Lexeme value must be a string, got {value.__class__.__name__}."
470 )
471
472 if weight is not None and (
473 not isinstance(weight, str) or weight.lower() not in {"a", "b", "c", "d"}
474 ):
475 raise ValueError(
476 f"Weight must be one of 'A', 'B', 'C', and 'D', got {weight!r}."
477 )
478
479 self.prefix = prefix
480 self.invert = invert
481 self.weight = weight
482 super().__init__(value, output_field=output_field)
483
484 def as_sql(self, compiler, connection):
485 param = quote_lexeme(self.value)

Callers 9

__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected