mirror of
https://github.com/django/django.git
synced 2025-08-30 07:17:49 +00:00
Fixed #29997 -- Allowed combining SearchQuerys with different configs.
Seems to be a needless restriction in
978a00e39f
.
This commit is contained in:
parent
793a71b7be
commit
8a1a919468
2 changed files with 16 additions and 6 deletions
|
@ -276,12 +276,24 @@ class TestCombinations(GrailTestData, PostgreSQLTestCase):
|
|||
searched = Line.objects.filter(character=self.minstrel, dialogue__search=~SearchQuery('kneecaps'))
|
||||
self.assertCountEqual(searched, [self.verse0, self.verse2])
|
||||
|
||||
def test_query_config_mismatch(self):
|
||||
with self.assertRaisesMessage(TypeError, "SearchQuery configs don't match."):
|
||||
Line.objects.filter(
|
||||
dialogue__search=SearchQuery('kneecaps', config='german') |
|
||||
def test_combine_different_configs(self):
|
||||
searched = Line.objects.filter(
|
||||
dialogue__search=(
|
||||
SearchQuery('cadeau', config='french') |
|
||||
SearchQuery('nostrils', config='english')
|
||||
)
|
||||
)
|
||||
self.assertCountEqual(searched, [self.french, self.verse2])
|
||||
|
||||
@skipUnlessDBFeature('has_phraseto_tsquery')
|
||||
def test_combine_raw_phrase(self):
|
||||
searched = Line.objects.filter(
|
||||
dialogue__search=(
|
||||
SearchQuery('burn:*', search_type='raw', config='simple') |
|
||||
SearchQuery('rode forth from Camelot', search_type='phrase')
|
||||
)
|
||||
)
|
||||
self.assertCountEqual(searched, [self.verse0, self.verse1, self.verse2])
|
||||
|
||||
def test_query_combined_mismatch(self):
|
||||
msg = "SearchQuery can only be combined with other SearchQuerys, got"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue