Commit
•
ef89f97
1
Parent(s):
41c9393
Update app.py
Browse files
app.py
CHANGED
@@ -72,9 +72,9 @@ for i in range(0, 5):
|
|
72 |
ill_check_df = pd.DataFrame(ill_check_lst).T
|
73 |
ill_check_html = ill_check_df.to_html(escape = False, render_links = True, index = False, header = False)
|
74 |
|
75 |
-
ill_links = ill_links[['ID', 'title', 'url', 'abstract', 'filepath', 'Date Created', 'post_filepath']]
|
76 |
-
ill_links_title = ill_links_title[['ID', 'title', 'url', 'abstract', 'filepath', 'Date Created', 'Description', 'post_filepath']]
|
77 |
-
ill_links_ai = ill_links_ai[['ID', 'title', 'url', 'abstract', 'filepath', 'Date Created', 'Description', 'post_filepath']]
|
78 |
|
79 |
ind_main, doc_main, tf_main = funky.index_documents(ill_links)
|
80 |
del ill_links
|
@@ -137,8 +137,12 @@ def search_index(search_text, sd, ks, sort_by, max_results, user_num, search_tit
|
|
137 |
output_df['missing_desc'] = np.where(output_df['abstract'].str.contains('eyfs|ks1|ks2', regex = True), 0, 1)
|
138 |
output_df2 = output_df
|
139 |
output_df2['ind'] = output_df2.index
|
|
|
|
|
|
|
|
|
140 |
if sort_by == 'Relevance':
|
141 |
-
output_df2 = output_df2.sort_values(by = ['missing_desc', '
|
142 |
elif sort_by == 'Date Created':
|
143 |
output_df2 = output_df2.sort_values(by = ['Date Created'], ascending = False)
|
144 |
elif sort_by == 'A-Z':
|
|
|
72 |
ill_check_df = pd.DataFrame(ill_check_lst).T
|
73 |
ill_check_html = ill_check_df.to_html(escape = False, render_links = True, index = False, header = False)
|
74 |
|
75 |
+
ill_links = ill_links[['ID', 'title', 'url', 'abstract', 'filepath', 'Date Created', 'post_filepath', 'parent_id']]
|
76 |
+
ill_links_title = ill_links_title[['ID', 'title', 'url', 'abstract', 'filepath', 'Date Created', 'Description', 'post_filepath', 'parent_id']]
|
77 |
+
ill_links_ai = ill_links_ai[['ID', 'title', 'url', 'abstract', 'filepath', 'Date Created', 'Description', 'post_filepath', 'parent_id']]
|
78 |
|
79 |
ind_main, doc_main, tf_main = funky.index_documents(ill_links)
|
80 |
del ill_links
|
|
|
137 |
output_df['missing_desc'] = np.where(output_df['abstract'].str.contains('eyfs|ks1|ks2', regex = True), 0, 1)
|
138 |
output_df2 = output_df
|
139 |
output_df2['ind'] = output_df2.index
|
140 |
+
min_parent_score = output_df2.groupby('parent_id')['ind'].min().reset_index()
|
141 |
+
min_parent_score.columns = ['parent_id', 'min_parent_ind']
|
142 |
+
output_df2 = output_df2.merge(min_parent_score, how = 'left', on = 'parent_id')
|
143 |
+
|
144 |
if sort_by == 'Relevance':
|
145 |
+
output_df2 = output_df2.sort_values(by = ['missing_desc', 'min_parent_ind'], ascending = [True, True])
|
146 |
elif sort_by == 'Date Created':
|
147 |
output_df2 = output_df2.sort_values(by = ['Date Created'], ascending = False)
|
148 |
elif sort_by == 'A-Z':
|