add secondary sort for channel and title, #193

This commit is contained in:
simon 2022-03-25 17:28:17 +07:00
parent e4b4430e69
commit 40d7e6da37
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
1 changed files with 9 additions and 2 deletions

View File

@ -264,6 +264,13 @@ class HomeView(ArchivistResultsView):
def _update_view_data(self):
"""update view specific data dict"""
self.data["sort"].extend(
[
{"channel.channel_name.keyword": {"order": "asc"}},
{"title.keyword": {"order": "asc"}},
]
)
if self.context["hide_watched"]:
self.data["query"] = {"term": {"player.watched": {"value": False}}}
if self.search_get:
@ -425,14 +432,14 @@ class ChannelIdView(ArchivistResultsView):
def _update_view_data(self, channel_id):
"""update view specific data dict"""
query = {
self.data["query"] = {
"bool": {
"must": [
{"term": {"channel.channel_id": {"value": channel_id}}}
]
}
}
self.data["query"] = query
self.data["sort"].append({"title.keyword": {"order": "asc"}})
if self.context["hide_watched"]:
to_append = {"term": {"player.watched": {"value": False}}}