Skip to content

Commit 417c183

Browse files
authored
[Fix #296] Adding SearchAsYouType Field (#303)
1 parent 68b342a commit 417c183

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

django_elasticsearch_dsl/fields.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
Object,
2424
Short,
2525
Keyword,
26-
Text
26+
Text,
27+
SearchAsYouType,
2728
)
2829

2930
from .exceptions import VariableLookupError
@@ -128,7 +129,7 @@ def get_value_from_instance(self, instance, field_value_to_ignore=None):
128129
is_iterable = bool(iter(objs))
129130
except TypeError:
130131
is_iterable = False
131-
132+
132133
if is_iterable:
133134
return [
134135
self._get_inner_field_data(obj, field_value_to_ignore)
@@ -206,6 +207,18 @@ class ShortField(DEDField, Short):
206207
pass
207208

208209

210+
class KeywordField(DEDField, Keyword):
211+
pass
212+
213+
214+
class TextField(DEDField, Text):
215+
pass
216+
217+
218+
class SearchAsYouTypeField(DEDField, SearchAsYouType):
219+
pass
220+
221+
209222
class FileFieldMixin(object):
210223
def get_value_from_instance(self, instance, field_value_to_ignore=None):
211224
_file = super(FileFieldMixin, self).get_value_from_instance(
@@ -216,13 +229,5 @@ def get_value_from_instance(self, instance, field_value_to_ignore=None):
216229
return _file if _file else ''
217230

218231

219-
class KeywordField(DEDField, Keyword):
220-
pass
221-
222-
223-
class TextField(DEDField, Text):
224-
pass
225-
226-
227232
class FileField(FileFieldMixin, DEDField, Text):
228233
pass

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
],
4343
include_package_data=True,
4444
install_requires=[
45-
'elasticsearch-dsl>=7.0.0<8.0.0',
45+
'elasticsearch-dsl>=7.2.0<8.0.0',
4646
'six',
4747
],
4848
license="Apache Software License 2.0",

0 commit comments

Comments
 (0)