Skip to content

Commit 14e48f3

Browse files
Prepare 0.20.8
1 parent 42f144c commit 14e48f3

File tree

9 files changed

+30
-13
lines changed

9 files changed

+30
-13
lines changed

CHANGELOG.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ are used for versioning (schema follows below):
1515
0.3.4 to 0.4).
1616
- All backwards incompatible changes are mentioned in this document.
1717

18+
0.20.8
19+
------
20+
2020-04-10
21+
22+
- Fixes in ``skip_duplicates`` option support for native suggester.
23+
1824
0.20.7
1925
------
2026
2020-04-10

docs/changelog.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ are used for versioning (schema follows below):
1515
0.3.4 to 0.4).
1616
- All backwards incompatible changes are mentioned in this document.
1717

18+
0.20.8
19+
------
20+
2020-04-10
21+
22+
- Fixes in ``skip_duplicates`` option support for native suggester.
23+
1824
0.20.7
1925
------
2026
2020-04-10

examples/simple/search_indexes/viewsets/address/default.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ class AddressDocumentViewSet(DocumentViewSet):
141141
'title_suggest_loc': 'loc',
142142
},
143143
'size': 10,
144+
'skip_duplicates': True,
144145
}
145146
},
146147
'city_suggest': {

examples/simple/search_indexes/viewsets/book/frontend.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ class BookFrontendDocumentViewSet(DocumentViewSet):
271271
'default_suggester': SUGGESTER_COMPLETION,
272272
'options': {
273273
'size': 20,
274+
'skip_duplicates': True,
274275
},
275276
},
276277
'title_suggest_context': {

examples/simple/search_indexes/viewsets/location.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class LocationDocumentViewSet(DocumentViewSet):
115115
}
116116

117117
# Specify default ordering
118-
ordering = ("_score",) # "full", "postcode",)
118+
ordering = ("_score",) # "full", "postcode",)
119119
suggester_fields = {
120120
"full": {
121121
"field": "full.suggest",

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from setuptools import find_packages, setup
44

5-
version = '0.20.7'
5+
version = '0.20.8'
66

77
DOCS_TRANSFORMATIONS = (
88
(

src/django_elasticsearch_dsl_drf/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44

55
__title__ = 'django-elasticsearch-dsl-drf'
6-
__version__ = '0.20.7'
6+
__version__ = '0.20.8'
77
__author__ = 'Artur Barseghyan <[email protected]>'
88
__copyright__ = '2017-2020 Artur Barseghyan'
99
__license__ = 'GPL 2.0/LGPL 2.1'

src/django_elasticsearch_dsl_drf/filter_backends/filtering/common.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@
3434
)
3535
from ..mixins import FilterBackendMixin
3636

37-
from ...compat import coreapi
38-
from ...compat import coreschema
37+
from ...compat import coreapi, coreschema
3938

4039

4140
__title__ = 'django_elasticsearch_dsl_drf.filter_backends.filtering.common'
@@ -822,8 +821,8 @@ def filter_queryset(self, request, queryset, view):
822821
# `regexp` filter lookup
823822
elif options['lookup'] == LOOKUP_FILTER_REGEXP:
824823
queryset = self.apply_filter_regexp(queryset,
825-
options,
826-
value)
824+
options,
825+
value)
827826

828827
# `exists` filter lookup
829828
elif options['lookup'] == LOOKUP_FILTER_EXISTS:

src/django_elasticsearch_dsl_drf/filter_backends/suggester/native.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
>>>
6868
>>> model = Publisher # The model associate with this Document
6969
"""
70+
from collections import defaultdict
7071

7172
from django_elasticsearch_dsl_drf.constants import (
7273
SUGGESTER_TERM,
@@ -270,7 +271,6 @@ def get_suggester_context(cls, field, suggester_name, request, view):
270271
271272
:return:
272273
"""
273-
from collections import defaultdict
274274
contexts = {}
275275
query_params = request.query_params.copy()
276276

@@ -506,12 +506,16 @@ def get_suggester_query_params(self, request, view):
506506
'type': view.mapping,
507507
}
508508

509-
if 'options' in _sf and 'size' in _sf['options']:
510-
suggester_query_params[query_param].update(
511-
{
509+
if 'options' in _sf:
510+
if 'size' in _sf['options']:
511+
suggester_query_params[query_param].update({
512512
'size': _sf['options']['size']
513-
}
514-
)
513+
})
514+
if 'skip_duplicates' in _sf['options']:
515+
suggester_query_params[query_param].update({
516+
'skip_duplicates':
517+
_sf['options']['skip_duplicates']
518+
})
515519

516520
if (
517521
suggester_param == SUGGESTER_COMPLETION

0 commit comments

Comments
 (0)