(
self,
value,
output_field=None,
*,
config=None,
invert=False,
search_type="plain",
)
| 234 | } |
| 235 | |
| 236 | def __init__( |
| 237 | self, |
| 238 | value, |
| 239 | output_field=None, |
| 240 | *, |
| 241 | config=None, |
| 242 | invert=False, |
| 243 | search_type="plain", |
| 244 | ): |
| 245 | if isinstance(value, LexemeCombinable): |
| 246 | search_type = "raw" |
| 247 | |
| 248 | self.function = self.SEARCH_TYPES.get(search_type) |
| 249 | if self.function is None: |
| 250 | raise ValueError("Unknown search_type argument '%s'." % search_type) |
| 251 | if not hasattr(value, "resolve_expression"): |
| 252 | value = Value(value) |
| 253 | expressions = (value,) |
| 254 | self.config = SearchConfig.from_parameter(config) |
| 255 | if self.config is not None: |
| 256 | expressions = [self.config, *expressions] |
| 257 | self.invert = invert |
| 258 | super().__init__(*expressions, output_field=output_field) |
| 259 | |
| 260 | def as_sql(self, compiler, connection, function=None, template=None): |
| 261 | sql, params = super().as_sql(compiler, connection, function, template) |
nothing calls this directly
no test coverage detected