run_codes_extract_directory

This commit is contained in:
hsafaei
2025-12-04 13:47:58 +03:30
parent e616d748c5
commit 1c6d446110
8 changed files with 960 additions and 382 deletions
+9 -6
View File
@@ -202,7 +202,7 @@ def get_dict_qanon_title(file_path):
return dict
def searchQanonTitleOfContent(elastic, qanon_title, ts_data="", index_name="mj_qa_section"):
def searchQanonTitleOfContent(elastic, qanon_title, ts_date="", index_name="mj_qa_section"):
score = 100
@@ -254,12 +254,12 @@ def searchQanonTitleOfContent(elastic, qanon_title, ts_data="", index_name="mj_q
if len(list_equal) == 1 :
item = list_equal[0]
score = 90
if ts_data == item['_source']['ts_date'] :
if ts_date == ts_date_ref :
score = 100
return item['_source']["qanon_id"], score, item
for item in list_equal :
if ts_data == item['_source']['ts_date'] :
if ts_date == ts_date_ref :
score = 100
return item['_source']["qanon_id"], score, item
@@ -271,7 +271,7 @@ def searchQanonTitleOfContent(elastic, qanon_title, ts_data="", index_name="mj_q
return 0, 0, {}
def searchQanonId(elastic, qanon_title, ts_data="", index_name="mj_qa_qanon", ts_ref=""):
def searchQanonId(elastic, qanon_title, ts_date="", index_name="mj_qa_qanon", ts_ref=""):
score = 100
body = {
"query": {
@@ -332,15 +332,18 @@ def searchQanonId(elastic, qanon_title, ts_data="", index_name="mj_qa_qanon", ts
if title_sample == qanon_title_sample or title_sample == qanon_title_sample2:
list_equal.append(item)
ts_date_ref = ''
if 'ts_date' in item['_source'] :
ts_date_ref = item['_source']['ts_date']
if len(list_equal) == 1 :
item = list_equal[0]
score = 90
if ts_data == item['_source']['ts_date'] :
if ts_date == ts_date_ref :
score = 100
return item["_id"], score, item
for item in list_equal :
if ts_data and ts_data == item['_source']['ts_date'] :
if ts_date and ts_date == ts_date_ref :
score = 100
return item["_id"], score, item