improve playlist mapping, serializer, better none desc
This commit is contained in:
parent
fe50b413d5
commit
8d9b33bcb4
|
|
@ -501,37 +501,9 @@
|
|||
{
|
||||
"index_name": "playlist",
|
||||
"expected_map": {
|
||||
"playlist_id": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"playlist_description": {
|
||||
"type": "text"
|
||||
},
|
||||
"playlist_subscribed": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"playlist_type": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"playlist_active": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"playlist_name": {
|
||||
"type": "text",
|
||||
"analyzer": "english",
|
||||
"fields": {
|
||||
"keyword": {
|
||||
"type": "keyword",
|
||||
"ignore_above": 256,
|
||||
"normalizer": "to_lower"
|
||||
},
|
||||
"search_as_you_type": {
|
||||
"type": "search_as_you_type",
|
||||
"doc_values": false,
|
||||
"max_shingle_size": 3
|
||||
}
|
||||
}
|
||||
},
|
||||
"playlist_channel": {
|
||||
"type": "text",
|
||||
"fields": {
|
||||
|
|
@ -545,15 +517,8 @@
|
|||
"playlist_channel_id": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"playlist_thumbnail": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"playlist_last_refresh": {
|
||||
"type": "date",
|
||||
"format": "epoch_second"
|
||||
},
|
||||
"playlist_sort_order": {
|
||||
"type": "keyword"
|
||||
"playlist_description": {
|
||||
"type": "text"
|
||||
},
|
||||
"playlist_entries": {
|
||||
"properties": {
|
||||
|
|
@ -589,6 +554,41 @@
|
|||
"type": "keyword"
|
||||
}
|
||||
}
|
||||
},
|
||||
"playlist_id": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"playlist_last_refresh": {
|
||||
"type": "date",
|
||||
"format": "epoch_second"
|
||||
},
|
||||
"playlist_name": {
|
||||
"type": "text",
|
||||
"analyzer": "english",
|
||||
"fields": {
|
||||
"keyword": {
|
||||
"type": "keyword",
|
||||
"ignore_above": 256,
|
||||
"normalizer": "to_lower"
|
||||
},
|
||||
"search_as_you_type": {
|
||||
"type": "search_as_you_type",
|
||||
"doc_values": false,
|
||||
"max_shingle_size": 3
|
||||
}
|
||||
}
|
||||
},
|
||||
"playlist_sort_order": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"playlist_subscribed": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"playlist_thumbnail": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"playlist_type": {
|
||||
"type": "keyword"
|
||||
}
|
||||
},
|
||||
"expected_set": {
|
||||
|
|
|
|||
|
|
@ -168,10 +168,12 @@ class SearchProcess:
|
|||
)
|
||||
cache_root = EnvironmentSettings().get_cache_root()
|
||||
playlist_thumbnail = f"{cache_root}/playlists/{playlist_id}.jpg"
|
||||
description = playlist_dict.get("playlist_description")
|
||||
playlist_dict.update(
|
||||
{
|
||||
"playlist_thumbnail": playlist_thumbnail,
|
||||
"playlist_last_refresh": playlist_last_refresh,
|
||||
"playlist_description": description,
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -330,7 +330,7 @@ class Command(BaseCommand):
|
|||
desc="fix playlist description data type",
|
||||
query={"term": {"playlist_description": {"value": False}}},
|
||||
script={
|
||||
"source": "ctx._source.playlist_description = null",
|
||||
"source": "ctx._source.remove(playlist_description)",
|
||||
"lang": "painless",
|
||||
},
|
||||
)
|
||||
|
|
|
|||
|
|
@ -81,10 +81,13 @@ class YoutubePlaylist(YouTubeItem):
|
|||
"playlist_channel": self.youtube_meta["channel"],
|
||||
"playlist_channel_id": self.youtube_meta["channel_id"],
|
||||
"playlist_thumbnail": playlist_thumbnail,
|
||||
"playlist_description": self.youtube_meta["description"] or None,
|
||||
"playlist_last_refresh": int(datetime.now().timestamp()),
|
||||
"playlist_type": "regular",
|
||||
}
|
||||
if self.youtube_meta.get("description"):
|
||||
self.json_data["playlist_description"] = self.youtube_meta[
|
||||
"description"
|
||||
]
|
||||
|
||||
def _ensure_channel(self):
|
||||
"""make sure channel is indexed"""
|
||||
|
|
|
|||
Loading…
Reference in New Issue