mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-11 00:33:17 +00:00
Enabled ASCIIFolding in Elasticsearch backend
This commit is contained in:
parent
0aee07fd5a
commit
2ddf8fd3b6
2 changed files with 24 additions and 2 deletions
|
|
@ -510,12 +510,12 @@ class ElasticSearch(BaseSearch):
|
|||
'ngram_analyzer': {
|
||||
'type': 'custom',
|
||||
'tokenizer': 'lowercase',
|
||||
'filter': ['ngram']
|
||||
'filter': ['asciifolding', 'ngram']
|
||||
},
|
||||
'edgengram_analyzer': {
|
||||
'type': 'custom',
|
||||
'tokenizer': 'lowercase',
|
||||
'filter': ['edgengram']
|
||||
'filter': ['asciifolding', 'edgengram']
|
||||
}
|
||||
},
|
||||
'tokenizer': {
|
||||
|
|
|
|||
|
|
@ -65,6 +65,28 @@ class TestElasticSearchBackend(BackendTests, TestCase):
|
|||
self.assertEqual(len(results), 1)
|
||||
self.assertEqual(results[0].id, obj.id)
|
||||
|
||||
def test_ascii_folding(self):
|
||||
# Reset the index
|
||||
self.backend.reset_index()
|
||||
self.backend.add_type(models.SearchTest)
|
||||
self.backend.add_type(models.SearchTestChild)
|
||||
|
||||
# Add some test data
|
||||
obj = models.SearchTest()
|
||||
obj.title = "Ĥéỻø"
|
||||
obj.live = True
|
||||
obj.save()
|
||||
self.backend.add(obj)
|
||||
|
||||
# Refresh the index
|
||||
self.backend.refresh_index()
|
||||
|
||||
# Search and check
|
||||
results = self.backend.search("Hello", models.SearchTest.objects.all())
|
||||
|
||||
self.assertEqual(len(results), 1)
|
||||
self.assertEqual(results[0].id, obj.id)
|
||||
|
||||
|
||||
class TestElasticSearchQuery(TestCase):
|
||||
def assertDictEqual(self, a, b):
|
||||
|
|
|
|||
Loading…
Reference in a new issue