Ticket #31304: patch-django-2.2.9-postgres-search.diff
File patch-django-2.2.9-postgres-search.diff, 1.2 KB (added by , 5 years ago) |
---|
-
django/contrib/postgres/search.py
67 67 resolved.config = self.config.resolve_expression(query, allow_joins, reuse, summarize, for_save) 68 68 return resolved 69 69 70 def textual_expression(self, expression): 71 if isinstance(expression.output_field, (CharField, TextField)): 72 return expression 73 else: 74 return Cast(expression, TextField()) 75 70 76 def as_sql(self, compiler, connection, function=None, template=None): 71 77 clone = self.copy() 72 78 clone.set_source_expressions([ 73 Coalesce(74 expression75 if isinstance(expression.output_field, (CharField, TextField))76 else Cast(expression, TextField()),77 Value('')79 ( 80 # Coalesce nullable fields only. 81 Coalesce(self.textual_expression(expression), Value('')) 82 if expression.output_field.null 83 else self.textual_expression(expression) 78 84 ) for expression in clone.get_source_expressions() 79 85 ]) 80 86 config_params = []