mirror of
https://github.com/wagtail/wagtail.git
synced 2024-12-01 11:41:20 +01:00
Test annotate_score on PostgreSQL search backend.
This commit is contained in:
parent
937254f321
commit
389835438c
@ -114,19 +114,6 @@ class ElasticsearchCommonSearchBackendTests(BackendTests):
|
||||
results = self.backend.search(MATCH_ALL, models.Book)
|
||||
self.assertSetEqual(set(results), set())
|
||||
|
||||
def test_annotate_score(self):
|
||||
results = self.backend.search("JavaScript", models.Book).annotate_score('_score')
|
||||
|
||||
for result in results:
|
||||
self.assertIsInstance(result._score, float)
|
||||
|
||||
def test_annotate_score_with_slice(self):
|
||||
# #3431 - Annotate score wasn't being passed to new queryset when slicing
|
||||
results = self.backend.search("JavaScript", models.Book).annotate_score('_score')[:10]
|
||||
|
||||
for result in results:
|
||||
self.assertIsInstance(result._score, float)
|
||||
|
||||
def test_more_than_ten_results(self):
|
||||
# #3431 reported that Elasticsearch only sends back 10 results if the results set is not sliced
|
||||
results = self.backend.search(MATCH_ALL, models.Book)
|
||||
|
@ -78,6 +78,19 @@ class BackendTests(WagtailTestUtils):
|
||||
# "JavaScript: The Definitive Guide" should be first
|
||||
self.assertEqual(results[0].title, "JavaScript: The Definitive Guide")
|
||||
|
||||
def test_annotate_score(self):
|
||||
results = self.backend.search("JavaScript", models.Book).annotate_score('_score')
|
||||
|
||||
for result in results:
|
||||
self.assertIsInstance(result._score, float)
|
||||
|
||||
def test_annotate_score_with_slice(self):
|
||||
# #3431 - Annotate score wasn't being passed to new queryset when slicing
|
||||
results = self.backend.search("JavaScript", models.Book).annotate_score('_score')[:10]
|
||||
|
||||
for result in results:
|
||||
self.assertIsInstance(result._score, float)
|
||||
|
||||
def test_search_and_operator(self):
|
||||
# Should not return "JavaScript: The good parts" as it does not have "Definitive"
|
||||
results = self.backend.search("JavaScript Definitive", models.Book, operator='and')
|
||||
|
@ -13,6 +13,16 @@ class TestDBBackend(BackendTests, TestCase):
|
||||
def test_ranking(self):
|
||||
super().test_ranking()
|
||||
|
||||
# Doesn't support ranking
|
||||
@unittest.expectedFailure
|
||||
def test_annotate_score(self):
|
||||
super().test_annotate_score()
|
||||
|
||||
# Doesn't support ranking
|
||||
@unittest.expectedFailure
|
||||
def test_annotate_score_with_slice(self):
|
||||
super().test_annotate_score_with_slice()
|
||||
|
||||
# Doesn't support ranking
|
||||
@unittest.expectedFailure
|
||||
def test_search_boosting_on_related_fields(self):
|
||||
|
Loading…
Reference in New Issue
Block a user