Skip to content

Commit 617cb0a

Browse files
improved coverage
1 parent 4b8ea04 commit 617cb0a

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

examples/simple/search_indexes/viewsets/author.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,19 @@ class AuthorDocumentViewSet(DocumentViewSet):
8989
'default_suggester': FUNCTIONAL_SUGGESTER_COMPLETION_PREFIX,
9090
# 'serializer_field': 'name',
9191
},
92-
'salutation.suggest': {
92+
'salutation_suggest': {
9393
'field': 'salutation.raw',
9494
'suggesters': [
9595
FUNCTIONAL_SUGGESTER_COMPLETION_PREFIX,
9696
],
9797
'default_suggester': FUNCTIONAL_SUGGESTER_COMPLETION_PREFIX,
9898
# 'serializer_field': 'salutation',
9999
},
100+
'salutation.raw': {
101+
'suggesters': [
102+
FUNCTIONAL_SUGGESTER_COMPLETION_PREFIX,
103+
],
104+
'default_suggester': FUNCTIONAL_SUGGESTER_COMPLETION_PREFIX,
105+
# 'serializer_field': 'salutation',
106+
},
100107
}

examples/simple/search_indexes/viewsets/book.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,10 @@ class BookFunctionalSuggesterDocumentViewSet(
277277
'suggesters': [FUNCTIONAL_SUGGESTER_COMPLETION_MATCH],
278278
'default_suggester': FUNCTIONAL_SUGGESTER_COMPLETION_MATCH,
279279
# 'serializer_field': 'title',
280-
}
281-
# 'publisher_suggest': 'publisher.suggest',
282-
# 'tag_suggest': 'tags.suggest',
280+
},
281+
'title.raw': None,
282+
'title_simple': 'title.raw',
283+
# 'publisher_suggest': 'publisher.raw',
284+
# 'tag_suggest': 'tags',
283285
# 'summary_suggest': 'summary',
284286
}

src/django_elasticsearch_dsl_drf/tests/test_functional_suggesters.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,13 +257,17 @@ def test_suggesters_completion(self):
257257
{
258258
'title_suggest_prefix':
259259
test_data['title_suggest_prefix__completion_prefix'],
260+
'title.raw__completion_prefix':
261+
test_data['title_suggest_prefix__completion_prefix'],
262+
'title_simple__completion_prefix':
263+
test_data['title_suggest_prefix__completion_prefix'],
260264
}
261265
)
262266
self._test_suggesters(test_data, self.books_url)
263267

264268
# Testing authors
265269
test_data = {
266-
'salutation.suggest__completion_prefix': {
270+
'salutation_suggest__completion_prefix': {
267271
'Aaa': ['Aaa Bbb', 'Aaa Ccc'],
268272
'Bbb': ['Bbb Ccc'],
269273
'Hhh': [],
@@ -272,8 +276,10 @@ def test_suggesters_completion(self):
272276
# Testing default suggesters as well
273277
test_data.update(
274278
{
275-
'salutation.suggest':
276-
test_data['salutation.suggest__completion_prefix'],
279+
'salutation_suggest':
280+
test_data['salutation_suggest__completion_prefix'],
281+
'salutation.raw':
282+
test_data['salutation_suggest__completion_prefix'],
277283
}
278284
)
279285
self._test_suggesters(test_data, self.authors_url)

0 commit comments

Comments
 (0)