| 503 | |
| 504 | |
| 505 | class CombinedLexeme(LexemeCombinable, CombinedExpression): |
| 506 | _output_field = SearchQueryField() |
| 507 | |
| 508 | def as_sql(self, compiler, connection): |
| 509 | value_params = [] |
| 510 | lsql, params = compiler.compile(self.lhs) |
| 511 | value_params.extend(params) |
| 512 | |
| 513 | rsql, params = compiler.compile(self.rhs) |
| 514 | value_params.extend(params) |
| 515 | |
| 516 | combined_sql = f"({lsql} {self.connector} {rsql})" |
| 517 | combined_value = combined_sql % tuple(value_params) |
| 518 | return "%s", (combined_value,) |
| 519 | |
| 520 | def __invert__(self): |
| 521 | # Apply De Morgan's theorem. |
| 522 | cloned = self.copy() |
| 523 | cloned.connector = self.BITAND if self.connector == self.BITOR else self.BITOR |
| 524 | cloned.lhs = ~self.lhs |
| 525 | cloned.rhs = ~self.rhs |
| 526 | return cloned |
no test coverage detected