codes rapair
This commit is contained in:
@@ -4,7 +4,7 @@ import traceback
|
||||
import json
|
||||
from dotenv import load_dotenv
|
||||
from app.common.config_base import *
|
||||
# from app.common.general_functions import *
|
||||
from app.common.general_functions import *
|
||||
from app.common.text_normalizer import TextNormalizer
|
||||
from app.common.elastic_helper import ElasticHelper
|
||||
# from excel_helper import ExcelHelper
|
||||
@@ -205,6 +205,13 @@ def get_dict_qanon_title(file_path):
|
||||
def searchQanonTitleOfContent(elastic, qanon_title, ts_date="", index_name="mj_qa_section"):
|
||||
score = 100
|
||||
|
||||
ts_date_f = ""
|
||||
try :
|
||||
ts_date_f = jdate2Gregorian(ts_date)
|
||||
except :
|
||||
ts_date_f = ""
|
||||
|
||||
|
||||
|
||||
body = {
|
||||
"query": {
|
||||
@@ -254,12 +261,12 @@ def searchQanonTitleOfContent(elastic, qanon_title, ts_date="", index_name="mj_q
|
||||
if len(list_equal) == 1 :
|
||||
item = list_equal[0]
|
||||
score = 90
|
||||
if ts_date == ts_date_ref :
|
||||
if ts_date == ts_date_ref or ts_date_f == ts_date_ref :
|
||||
score = 100
|
||||
return item['_source']["qanon_id"], score, item
|
||||
|
||||
for item in list_equal :
|
||||
if ts_date == ts_date_ref :
|
||||
if ts_date == ts_date_ref or ts_date_f == ts_date_ref :
|
||||
score = 100
|
||||
return item['_source']["qanon_id"], score, item
|
||||
|
||||
@@ -288,6 +295,13 @@ def searchQanonId(elastic, qanon_title, ts_date="", index_name="mj_qa_qanon", ts
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ts_date_f = ""
|
||||
try :
|
||||
ts_date_f = jdate2Gregorian(ts_date)
|
||||
except :
|
||||
ts_date_f = ""
|
||||
|
||||
s_res = elastic.es.search(index=index_name, body=body)
|
||||
total = s_res["hits"]["total"]['value']
|
||||
if total == 1 :
|
||||
@@ -338,12 +352,12 @@ def searchQanonId(elastic, qanon_title, ts_date="", index_name="mj_qa_qanon", ts
|
||||
if len(list_equal) == 1 :
|
||||
item = list_equal[0]
|
||||
score = 90
|
||||
if ts_date == ts_date_ref :
|
||||
if ts_date == ts_date_ref or ts_date_f == ts_date_ref:
|
||||
score = 100
|
||||
return item["_id"], score, item
|
||||
|
||||
for item in list_equal :
|
||||
if ts_date and ts_date == ts_date_ref :
|
||||
if ts_date and ts_date == ts_date_ref or ts_date_f == ts_date_ref :
|
||||
score = 100
|
||||
return item["_id"], score, item
|
||||
|
||||
|
||||
Reference in New Issue
Block a user