bradley6597 commited on
Commit
b9cabd2
1 Parent(s): e4e0ca7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -84,9 +84,14 @@ def search_index(search_text, sd, ks, sort_by, max_results, user_num, search_tit
84
  else:
85
  output = funky.search(tf_main, doc_main, ind_main, search_text, search_type='AND', ranking = True)
86
  output = [x for o in output for x in o if type(x) is not float]
87
- output_df = pd.DataFrame(output).reset_index(drop = True)
88
 
89
- if output_df.shape[0] > 0:
 
 
 
 
 
 
90
 
91
  output_df['url'] = output_df['url'].str.replace("/u/0/", f"/u/{int(user_num)}/", regex = False)
92
  if len(sd) == 1:
 
84
  else:
85
  output = funky.search(tf_main, doc_main, ind_main, search_text, search_type='AND', ranking = True)
86
  output = [x for o in output for x in o if type(x) is not float]
 
87
 
88
+ if len(output) > 0:
89
+
90
+ output_df = (pd.DataFrame(output)
91
+ .groupby('url')
92
+ .first()
93
+ .reset_index()
94
+ .drop_duplicates())
95
 
96
  output_df['url'] = output_df['url'].str.replace("/u/0/", f"/u/{int(user_num)}/", regex = False)
97
  if len(sd) == 1: