File tree Expand file tree Collapse file tree 6 files changed +51
-2
lines changed Expand file tree Collapse file tree 6 files changed +51
-2
lines changed Original file line number Diff line number Diff line change @@ -51,3 +51,18 @@ def location_field_indexing(self):
5151 'lat' : self .latitude ,
5252 'lon' : self .longitude ,
5353 }
54+
55+ # @property
56+ # def country_indexing(self):
57+ # """Country data (nested) for indexing.
58+ #
59+ # :return:
60+ # """
61+ # return {
62+ # 'country': {
63+ # 'name': self.city.country.name,
64+ # 'city': {
65+ # 'name': self.city.name
66+ # }
67+ # }
68+ # }
Original file line number Diff line number Diff line change @@ -89,6 +89,30 @@ class AddressDocument(DocType):
8989 }
9090 )
9191
92+ # # Country object
93+ # country = fields.NestedField(
94+ # attr='country_indexing',
95+ # properties={
96+ # 'name': StringField(
97+ # analyzer=html_strip,
98+ # fields={
99+ # 'raw': KeywordField(),
100+ # 'suggest': fields.CompletionField(),
101+ # }
102+ # ),
103+ # 'city': fields.ObjectField(
104+ # properties={
105+ # 'name': StringField(
106+ # analyzer=html_strip,
107+ # fields={
108+ # 'raw': KeywordField(),
109+ # }
110+ # )
111+ # }
112+ # )
113+ # }
114+ # )
115+
92116 location = fields .GeoPointField (attr = 'location_field_indexing' )
93117
94118 class Meta (object ):
Original file line number Diff line number Diff line change 1+ from rest_framework import serializers
12from django_elasticsearch_dsl_drf .serializers import DocumentSerializer
23
34from ..documents import AuthorDocument
89class AuthorDocumentSimpleSerializer (DocumentSerializer ):
910 """Serializer for the Author document."""
1011
12+ source = serializers .SerializerMethodField ()
13+
1114 class Meta (object ):
1215 """Meta options."""
1316
@@ -26,3 +29,6 @@ class Meta(object):
2629 'phone_number' ,
2730 'website' ,
2831 )
32+
33+ def get_source (self , obj ):
34+ return obj ._d_
Original file line number Diff line number Diff line change @@ -82,8 +82,6 @@ def get_tags(self, obj):
8282class BookDocumentSimpleSerializer (DocumentSerializer ):
8383 """Serializer for the Book document."""
8484
85- # tags = serializers.SerializerMethodField()
86- # authors = serializers.SerializerMethodField()
8785 highlight = serializers .SerializerMethodField ()
8886
8987 class Meta (object ):
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ cd examples/simple/
3+ ./manage.py makemigrations " $@ " --settings=settings.dev
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ cd examples/simple/
3+ ./manage.py migrate " $@ " --settings=settings.dev
You can’t perform that action at this time.
0 commit comments