Skip to content

Commit

Permalink
Articles: ES ordering by updated_at
Browse files Browse the repository at this point in the history
  • Loading branch information
ErnestaP committed Jul 9, 2024
1 parent 00ef423 commit 56d4dd8
Show file tree
Hide file tree
Showing 2 changed files with 8,459 additions and 2 deletions.
7 changes: 6 additions & 1 deletion scoap3/articles/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
FacetedSearchFilterBackend,
FilteringFilterBackend,
SearchFilterBackend,
OrderingFilterBackend
)
from django_elasticsearch_dsl_drf.viewsets import BaseDocumentViewSet
from opensearch_dsl import DateHistogramFacet, TermsFacet
Expand Down Expand Up @@ -91,6 +92,7 @@ def __init__(self, *args, **kwargs):
SearchFilterBackend,
FacetedSearchFilterBackend,
FilteringFilterBackend,
OrderingFilterBackend,
]
renderer_classes = api_settings.DEFAULT_RENDERER_CLASSES + [ArticleCSVRenderer]

Expand All @@ -106,7 +108,10 @@ def __init__(self, *args, **kwargs):
"article_identifiers.identifier_value",
)

ordering = ["-updated_at"]
ordering_fields = {
'_updated_at': '_updated_at'
}
ordering = ["-_updated_at"]

filter_fields = {
"publication_year": {
Expand Down
8,454 changes: 8,453 additions & 1 deletion scoap3/fixtures/local.json

Large diffs are not rendered by default.

0 comments on commit 56d4dd8

Please sign in to comment.