diff --git a/scoap3/articles/api/views.py b/scoap3/articles/api/views.py index 33ec9794a..fe01f0c70 100644 --- a/scoap3/articles/api/views.py +++ b/scoap3/articles/api/views.py @@ -88,6 +88,7 @@ class ArticleDocumentView(BaseDocumentViewSet): LOOKUP_QUERY_IN, ], }, + "country": "authors.affiliations.country.name" } faceted_search_fields = { @@ -104,6 +105,11 @@ class ArticleDocumentView(BaseDocumentViewSet): "facet": TermsFacet, "enabled": True, }, + "country": { + "field": "authors.affiliations.country.name", + "facet": TermsFacet, + "enabled": True, + }, } def get_serializer_class(self): diff --git a/scoap3/articles/documents.py b/scoap3/articles/documents.py index 026852584..92ebdb02f 100644 --- a/scoap3/articles/documents.py +++ b/scoap3/articles/documents.py @@ -62,15 +62,15 @@ class ArticleDocument(Document): } ) - authors = fields.NestedField( + authors = fields.ObjectField( properties={ "first_name": fields.TextField(), "last_name": fields.TextField(), - "affiliations": fields.NestedField( + "affiliations": fields.ObjectField( properties={ "value": fields.TextField(), "organization": fields.TextField(), - "country": fields.NestedField( + "country": fields.ObjectField( properties={ "code": fields.TextField(), "name": fields.KeywordField(),