Skip to content

Commit fc59a5c

Browse files
prepare 0.13.1
1 parent 36da2ca commit fc59a5c

File tree

10 files changed

+52
-9
lines changed

10 files changed

+52
-9
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.13.1
19+
------
20+
2018-07-26
21+
22+
- Minor fix in suggesters on Elasticsearch 6.x.
23+
1824
0.13
1925
----
2026
2018-07-23

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.13.1
19+
------
20+
2018-07-26
21+
22+
- Minor fix in suggesters on Elasticsearch 6.x.
23+
1824
0.13
1925
----
2026
2018-07-23

docs/installing_elasticsearch.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ Docker
2121
~~~
2222
.. code-block:: sh
2323
24-
docker pull docker.elastic.co/elasticsearch/elasticsearch:6.3.0
25-
docker run -p 9200:9200 -e "discovery.type=single-node" -e "xpack.security.enabled=false" docker.elastic.co/elasticsearch/elasticsearch:6.3.0
24+
docker pull docker.elastic.co/elasticsearch/elasticsearch:6.3.1
25+
docker run -p 9200:9200 -e "discovery.type=single-node" -e "xpack.security.enabled=false" docker.elastic.co/elasticsearch/elasticsearch:6.3.1
2626
2727
Vagrant
2828
-------

installing_elasticsearch.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ Docker
2121
~~~
2222
.. code-block:: sh
2323
24-
docker pull docker.elastic.co/elasticsearch/elasticsearch:6.3.0
25-
docker run -p 9200:9200 -e "discovery.type=single-node" -e "xpack.security.enabled=false" docker.elastic.co/elasticsearch/elasticsearch:6.3.0
24+
docker pull docker.elastic.co/elasticsearch/elasticsearch:6.3.1
25+
docker run -p 9200:9200 -e "discovery.type=single-node" -e "xpack.security.enabled=false" docker.elastic.co/elasticsearch/elasticsearch:6.3.1
2626
2727
Vagrant
2828
-------

scripts/create_index.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/usr/bin/env bash
22
cd examples/simple/
33
./manage.py search_index --create -f
4-
./manage.py search_index --populate -f
4+
#./manage.py search_index --populate -f

scripts/delete_index.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
cd examples/simple/
3+
./manage.py search_index --delete -f "$@"

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.13'
5+
version = '0.13.1'
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.13'
6+
__version__ = '0.13.1'
77
__author__ = 'Artur Barseghyan <[email protected]>'
88
__copyright__ = '2017-2018 Artur Barseghyan'
99
__license__ = 'GPL 2.0/LGPL 2.1'

src/django_elasticsearch_dsl_drf/pagination.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def paginate_queryset(self, queryset, request, view=None):
127127
is_suggest = getattr(queryset, '_suggest', False)
128128
if is_suggest:
129129
if ELASTICSEARCH_GTE_6_0:
130-
return queryset.execute().to_dict()['suggest']
130+
return queryset.execute().to_dict().get('suggest')
131131
return queryset.execute_suggest().to_dict()
132132

133133
# Check if we're using paginate queryset from `functional_suggest`
@@ -233,7 +233,7 @@ def paginate_queryset(self, queryset, request, view=None):
233233
is_suggest = getattr(queryset, '_suggest', False)
234234
if is_suggest:
235235
if ELASTICSEARCH_GTE_6_0:
236-
return queryset.execute().to_dict()['suggest']
236+
return queryset.execute().to_dict().get('suggest')
237237
return queryset.execute_suggest().to_dict()
238238

239239
# Check if we're using paginate queryset from `functional_suggest`

src/django_elasticsearch_dsl_drf/tests/test_suggesters.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
__license__ = 'GPL 2.0/LGPL 2.1'
3232
__all__ = (
3333
'TestSuggesters',
34+
'TestSuggestersEmptyIndex',
3435
)
3536

3637

@@ -314,5 +315,32 @@ def test_nested_fields_suggesters_completion(self):
314315
self._test_suggesters(test_data, self.addresses_suggest_url)
315316

316317

318+
@pytest.mark.django_db
319+
class TestSuggestersEmptyIndex(BaseRestFrameworkTestCase, AddressesMixin):
320+
"""Test suggesters on empty index."""
321+
322+
pytestmark = pytest.mark.django_db
323+
324+
@classmethod
325+
def setUpClass(cls):
326+
"""Set up class."""
327+
cls.authors_url = reverse(
328+
'authordocument-suggest',
329+
kwargs={}
330+
)
331+
# Suggest on empty index
332+
call_command('search_index', '--delete', '-f')
333+
call_command('search_index', '--create', '-f')
334+
335+
def test_suggesters_on_empty_index(self):
336+
"""Test suggesters phrase."""
337+
response = self.client.get(
338+
self.authors_url + '?name_suggest__completion=Ad',
339+
{}
340+
)
341+
self.assertEqual(response.status_code, status.HTTP_200_OK)
342+
self.assertFalse(bool(response.data))
343+
344+
317345
if __name__ == '__main__':
318346
unittest.main()

0 commit comments

Comments
 (0)