mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-04 21:44:44 +00:00
fix undefined variable when raising the 'unrecognised lookup' error
This commit is contained in:
parent
ba9f580ef0
commit
c21f148071
2 changed files with 7 additions and 1 deletions
|
|
@ -210,7 +210,7 @@ class ElasticSearchQuery(object):
|
|||
}
|
||||
}
|
||||
|
||||
raise FilterError('Could not apply filter on ElasticSearch results: "' + field_name + '__' + lookup + ' = ' + unicode(value) + '". Lookup "' + lookup + '"" not recognosed.')
|
||||
raise FilterError('Could not apply filter on ElasticSearch results: "' + field_attname + '__' + lookup + ' = ' + unicode(value) + '". Lookup "' + lookup + '"" not recognised.')
|
||||
|
||||
def _get_filters_from_where(self, where_node):
|
||||
# Check if this is a leaf node
|
||||
|
|
|
|||
|
|
@ -31,6 +31,12 @@ class TestElasticSearchBackend(BackendTests, TestCase):
|
|||
with self.assertRaises(FieldError):
|
||||
results = list(self.backend.search("Hello", models.SearchTest, filters=dict(id=42)))
|
||||
|
||||
def test_filter_with_unsupported_lookup_type(self):
|
||||
from wagtail.wagtailsearch.backends.elasticsearch import FilterError
|
||||
|
||||
with self.assertRaises(FilterError):
|
||||
results = list(self.backend.search("Hello", models.SearchTest, filters=dict(title__iregex='h(ea)llo')))
|
||||
|
||||
def test_partial_search(self):
|
||||
# Reset the index
|
||||
self.backend.reset_index()
|
||||
|
|
|
|||
Loading…
Reference in a new issue