MCPcopy
hub / github.com/django/django / SearchConfig

Class SearchConfig

django/contrib/postgres/search.py:86–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84
85
86class SearchConfig(Expression):
87 def __init__(self, config):
88 super().__init__()
89 if not hasattr(config, "resolve_expression"):
90 config = Value(config)
91 self.config = config
92
93 @classmethod
94 def from_parameter(cls, config):
95 if config is None or isinstance(config, cls):
96 return config
97 return cls(config)
98
99 def get_source_expressions(self):
100 return [self.config]
101
102 def set_source_expressions(self, exprs):
103 (self.config,) = exprs
104
105 def as_sql(self, compiler, connection):
106 sql, params = compiler.compile(self.config)
107 return "%s::regconfig" % sql, params
108
109
110class SearchVectorCombinable:

Callers 2

test_from_parameterMethod · 0.90
test_headlineMethod · 0.90

Calls

no outgoing calls

Tested by 2

test_from_parameterMethod · 0.72
test_headlineMethod · 0.72