File tree Expand file tree Collapse file tree
mflix/server/python-fastapi Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -122,12 +122,15 @@ async def ensure_standard_index():
122122 try :
123123 comments_collection = db .get_collection ("comments" )
124124
125- existing_indexes_cursor = await comments_collection .list_search_indexes ()
125+ existing_indexes_cursor = await comments_collection .list_indexes ()
126126 existing_indexes = await existing_indexes_cursor .to_list (length = None )
127127 index_names = [index .get ("name" ) for index in existing_indexes ]
128128
129- if "movie_id" not in index_names :
130- await comments_collection .create_index ("movie_id" )
129+ print (f"Existing indexes: { existing_indexes } " )
130+
131+ standard_index_name = "movie_id_index"
132+ if standard_index_name not in index_names :
133+ await comments_collection .create_index ("movie_id" , name = standard_index_name )
131134
132135 except Exception as e :
133136 print (f"Failed to create standard index on 'comments' collection: { str (e )} . " )
Original file line number Diff line number Diff line change @@ -18,4 +18,6 @@ def get_collection(name:str):
1818def voyage_ai_available ():
1919 """Check if Voyage API Key is available and valid."""
2020 api_key = os .getenv ("VOYAGE_API_KEY" )
21+ if api_key is None or api_key == "your_voyage_api_key" :
22+ return None
2123 return api_key is not None and api_key .strip () != ""
Original file line number Diff line number Diff line change @@ -757,7 +757,7 @@ async def update_movies_batch(
757757 result = await movies_collection .update_many (filter_data , {"$set" : update_data })
758758 except Exception as e :
759759 raise HTTPException (
760- status_code = " 500" ,
760+ status_code = 500 ,
761761 detail = f"An error occurred while updating movies: { str (e )} "
762762 )
763763
You can’t perform that action at this time.
0 commit comments