diff --git a/akarpov/music/documents.py b/akarpov/music/documents.py index e1e1548..b0a4efd 100644 --- a/akarpov/music/documents.py +++ b/akarpov/music/documents.py @@ -60,6 +60,10 @@ class Index: "type": "stemmer", "language": "russian", }, + "english_stemmer": { + "type": "stemmer", + "language": "english", + }, "autocomplete_filter": { "type": "edge_ngram", "min_gram": 1, @@ -68,9 +72,10 @@ class Index: "synonym_filter": { "type": "synonym", "synonyms": [ - "бит,трек,песня,музыка,песня,мелодия,композиция", - "певец,исполнитель,артист,музыкант", - "альбом,диск,пластинка,сборник,коллекция", + "бит, трек => песня", + "песня, музыка, мелодия, композиция", + "певец, исполнитель, артист, музыкант", + "альбом, диск, пластинка, сборник, коллекция", ], }, }, @@ -83,21 +88,42 @@ class Index: "russian_stemmer", ], }, - "russian_icu": { - "tokenizer": "icu_tokenizer", + "russian_with_synonyms_and_stemming": { + "tokenizer": "standard", "filter": [ + "lowercase", "russian_stop", "russian_keywords", "russian_stemmer", + "synonym_filter", ], }, - "autocomplete": { + "english_with_stemming": { + "type": "custom", + "tokenizer": "standard", + "filter": [ + "lowercase", + "english_stemmer", + ], + }, + "autocomplete_with_stemming": { "type": "custom", "tokenizer": "standard", "filter": [ "lowercase", "autocomplete_filter", + "english_stemmer", # Apply English stemming for autocomplete + "russian_stemmer", # Include Russian stemming if applicable + ], + }, + "search_synonym_with_stemming": { + "type": "custom", + "tokenizer": "standard", + "filter": [ + "lowercase", "synonym_filter", + "english_stemmer", # Apply English stemming for synonym search + "russian_stemmer", # Include Russian stemming if processing Russian synonyms ], }, }, diff --git a/akarpov/music/tasks.py b/akarpov/music/tasks.py index b4df83c..9523fc2 100644 --- a/akarpov/music/tasks.py +++ b/akarpov/music/tasks.py @@ -29,7 +29,7 @@ logger = structlog.get_logger(__name__) -@shared_task +@shared_task(soft_time_limit=60 * 20, time_limit=60 * 30) def list_tracks(url, user_id): if "music.youtube.com" in url or "youtu.be" in url: url = url.replace("music.youtube.com", "youtube.com") @@ -43,7 +43,6 @@ def list_tracks(url, user_id): ytmusic = ytmusicapi.YTMusic() channel_id = url.split("/")[-1] channel_songs = ytmusic.get_artist(channel_id)["songs"]["results"] - print(channel_songs) for song in channel_songs: process_yb.apply_async(