mirror of
https://github.com/Alexander-D-Karpov/akarpov
synced 2024-11-22 01:36:33 +03:00
updated search, improved music tasks
This commit is contained in:
parent
a2da7e724f
commit
5e0fafd3b7
|
@ -60,6 +60,10 @@ class Index:
|
||||||
"type": "stemmer",
|
"type": "stemmer",
|
||||||
"language": "russian",
|
"language": "russian",
|
||||||
},
|
},
|
||||||
|
"english_stemmer": {
|
||||||
|
"type": "stemmer",
|
||||||
|
"language": "english",
|
||||||
|
},
|
||||||
"autocomplete_filter": {
|
"autocomplete_filter": {
|
||||||
"type": "edge_ngram",
|
"type": "edge_ngram",
|
||||||
"min_gram": 1,
|
"min_gram": 1,
|
||||||
|
@ -68,9 +72,10 @@ class Index:
|
||||||
"synonym_filter": {
|
"synonym_filter": {
|
||||||
"type": "synonym",
|
"type": "synonym",
|
||||||
"synonyms": [
|
"synonyms": [
|
||||||
"бит,трек,песня,музыка,песня,мелодия,композиция",
|
"бит, трек => песня",
|
||||||
"певец,исполнитель,артист,музыкант",
|
"песня, музыка, мелодия, композиция",
|
||||||
"альбом,диск,пластинка,сборник,коллекция",
|
"певец, исполнитель, артист, музыкант",
|
||||||
|
"альбом, диск, пластинка, сборник, коллекция",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -83,21 +88,42 @@ class Index:
|
||||||
"russian_stemmer",
|
"russian_stemmer",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"russian_icu": {
|
"russian_with_synonyms_and_stemming": {
|
||||||
"tokenizer": "icu_tokenizer",
|
"tokenizer": "standard",
|
||||||
"filter": [
|
"filter": [
|
||||||
|
"lowercase",
|
||||||
"russian_stop",
|
"russian_stop",
|
||||||
"russian_keywords",
|
"russian_keywords",
|
||||||
"russian_stemmer",
|
"russian_stemmer",
|
||||||
|
"synonym_filter",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"autocomplete": {
|
"english_with_stemming": {
|
||||||
|
"type": "custom",
|
||||||
|
"tokenizer": "standard",
|
||||||
|
"filter": [
|
||||||
|
"lowercase",
|
||||||
|
"english_stemmer",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
"autocomplete_with_stemming": {
|
||||||
"type": "custom",
|
"type": "custom",
|
||||||
"tokenizer": "standard",
|
"tokenizer": "standard",
|
||||||
"filter": [
|
"filter": [
|
||||||
"lowercase",
|
"lowercase",
|
||||||
"autocomplete_filter",
|
"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",
|
"synonym_filter",
|
||||||
|
"english_stemmer", # Apply English stemming for synonym search
|
||||||
|
"russian_stemmer", # Include Russian stemming if processing Russian synonyms
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
logger = structlog.get_logger(__name__)
|
logger = structlog.get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@shared_task
|
@shared_task(soft_time_limit=60 * 20, time_limit=60 * 30)
|
||||||
def list_tracks(url, user_id):
|
def list_tracks(url, user_id):
|
||||||
if "music.youtube.com" in url or "youtu.be" in url:
|
if "music.youtube.com" in url or "youtu.be" in url:
|
||||||
url = url.replace("music.youtube.com", "youtube.com")
|
url = url.replace("music.youtube.com", "youtube.com")
|
||||||
|
@ -43,7 +43,6 @@ def list_tracks(url, user_id):
|
||||||
ytmusic = ytmusicapi.YTMusic()
|
ytmusic = ytmusicapi.YTMusic()
|
||||||
channel_id = url.split("/")[-1]
|
channel_id = url.split("/")[-1]
|
||||||
channel_songs = ytmusic.get_artist(channel_id)["songs"]["results"]
|
channel_songs = ytmusic.get_artist(channel_id)["songs"]["results"]
|
||||||
print(channel_songs)
|
|
||||||
|
|
||||||
for song in channel_songs:
|
for song in channel_songs:
|
||||||
process_yb.apply_async(
|
process_yb.apply_async(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user