kopia lustrzana https://github.com/wagtail/wagtail
Make autocomplete() fail with a NotImplementedError on sqlite and mysql FTS backends
rodzic
f5633dbfb6
commit
89205730de
|
@ -633,7 +633,11 @@ class MySQLSearchAtomicRebuilder(MySQLSearchRebuilder):
|
|||
|
||||
class MySQLSearchBackend(BaseSearchBackend):
|
||||
query_compiler_class = MySQLSearchQueryCompiler
|
||||
autocomplete_query_compiler_class = MySQLAutocompleteQueryCompiler
|
||||
|
||||
# FIXME: the implementation of MySQLAutocompleteQueryCompiler is incomplete -
|
||||
# leave this undefined so that we get a clean NotImplementedError from BaseSearchBackend
|
||||
# autocomplete_query_compiler_class = MySQLAutocompleteQueryCompiler
|
||||
|
||||
results_class = MySQLSearchResults
|
||||
rebuilder_class = MySQLSearchRebuilder
|
||||
atomic_rebuilder_class = MySQLSearchAtomicRebuilder
|
||||
|
|
|
@ -650,7 +650,11 @@ class SQLiteSearchResults(BaseSearchResults):
|
|||
|
||||
class SQLiteSearchBackend(BaseSearchBackend):
|
||||
query_compiler_class = SQLiteSearchQueryCompiler
|
||||
autocomplete_query_compiler_class = SQLiteAutocompleteQueryCompiler
|
||||
|
||||
# FIXME: the implementation of SQLiteAutocompleteQueryCompiler is incomplete -
|
||||
# leave this undefined so that we get a clean NotImplementedError from BaseSearchBackend
|
||||
# autocomplete_query_compiler_class = SQLiteAutocompleteQueryCompiler
|
||||
|
||||
results_class = SQLiteSearchResults
|
||||
rebuilder_class = SQLiteSearchRebuilder
|
||||
atomic_rebuilder_class = SQLiteSearchAtomicRebuilder
|
||||
|
|
|
@ -90,6 +90,10 @@ class TestMySQLSearchBackend(BackendTests, TransactionTestCase):
|
|||
def test_annotate_score_with_slice(self):
|
||||
return super().test_annotate_score_with_slice()
|
||||
|
||||
def test_autocomplete_raises_not_implemented_error(self):
|
||||
with self.assertRaises(NotImplementedError):
|
||||
self.backend.autocomplete("Py", models.Book)
|
||||
|
||||
@skip("The MySQL backend doesn't support autocomplete.")
|
||||
def test_autocomplete(self):
|
||||
return super().test_autocomplete()
|
||||
|
|
|
@ -8,6 +8,7 @@ from django.test.utils import override_settings
|
|||
|
||||
from wagtail.search.backends.database.sqlite.utils import fts5_available
|
||||
from wagtail.search.tests.test_backends import BackendTests
|
||||
from wagtail.test.search import models
|
||||
|
||||
|
||||
@unittest.skipUnless(
|
||||
|
@ -43,6 +44,10 @@ class TestSQLiteSearchBackend(BackendTests, TestCase):
|
|||
def test_annotate_score_with_slice(self):
|
||||
return super().test_annotate_score_with_slice()
|
||||
|
||||
def test_autocomplete_raises_not_implemented_error(self):
|
||||
with self.assertRaises(NotImplementedError):
|
||||
self.backend.autocomplete("Py", models.Book)
|
||||
|
||||
@skip("The SQLite backend doesn't support autocomplete.")
|
||||
def test_autocomplete(self):
|
||||
return super().test_autocomplete()
|
||||
|
|
Ładowanie…
Reference in New Issue