mirror of
https://github.com/Viren070/MediaFusion.git
synced 2025-12-01 23:21:11 +01:00
refactor: remove total_streams filter and simplify text index in models to improve searching accuracy
This commit is contained in:
@@ -1109,7 +1109,6 @@ async def process_search_query(
|
||||
"$caseSensitive": False,
|
||||
},
|
||||
"type": catalog_type,
|
||||
"total_streams": {"$gt": 0},
|
||||
}
|
||||
filter_conditions = []
|
||||
|
||||
|
||||
+1
-4
@@ -73,10 +73,7 @@ class MediaFusionMetaData(Document):
|
||||
[("title", ASCENDING), ("year", ASCENDING), ("type", ASCENDING)],
|
||||
unique=False,
|
||||
),
|
||||
IndexModel(
|
||||
[("title", TEXT), ("aka_titles", TEXT)],
|
||||
weights={"title": 10, "aka_titles": 5}, # Prioritize main title matches
|
||||
),
|
||||
IndexModel([("title", TEXT)]),
|
||||
IndexModel([("year", ASCENDING), ("end_year", ASCENDING)]),
|
||||
IndexModel([("_class_id", ASCENDING)]),
|
||||
IndexModel([("type", ASCENDING), ("genres", ASCENDING)]),
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
from beanie import Document, free_fall_migration
|
||||
|
||||
|
||||
class MediaFusionMetaData(Document):
|
||||
id: str
|
||||
|
||||
class Settings:
|
||||
name = "MediaFusionMetaData"
|
||||
|
||||
|
||||
class Forward:
|
||||
@free_fall_migration(document_models=[MediaFusionMetaData])
|
||||
async def update_text_index(self, session):
|
||||
"""Update text index to use only title field for better search relevance"""
|
||||
metadata_collection = MediaFusionMetaData.get_motor_collection()
|
||||
# drop index "title_text_aka_titles_text"
|
||||
await metadata_collection.drop_index("title_text_aka_titles_text")
|
||||
|
||||
print("title_text_aka_titles_text Index dropped successfully.")
|
||||
|
||||
|
||||
class Backward: ...
|
||||
Reference in New Issue
Block a user