mirror of
https://github.com/django/django.git
synced 2025-08-30 07:17:49 +00:00
Fixed #29582 -- Fixed a crash when using SearchVector with non text-fields.
The PostgreSQL concat() function handles nulls and non-text values better than the || operator.
This commit is contained in:
parent
71a739f3d7
commit
1a28dc3887
2 changed files with 9 additions and 6 deletions
|
@ -155,6 +155,12 @@ class MultipleFieldsTest(GrailTestData, PostgreSQLTestCase):
|
|||
).filter(search='bedemir')
|
||||
self.assertEqual(set(searched), {self.bedemir0, self.bedemir1, self.crowd, self.witch, self.duck})
|
||||
|
||||
def test_search_with_non_text(self):
|
||||
searched = Line.objects.annotate(
|
||||
search=SearchVector('id'),
|
||||
).filter(search=str(self.crowd.id))
|
||||
self.assertSequenceEqual(searched, [self.crowd])
|
||||
|
||||
def test_config_query_explicit(self):
|
||||
searched = Line.objects.annotate(
|
||||
search=SearchVector('scene__setting', 'dialogue', config='french'),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue