import majles...

This commit is contained in:
hsafaei
2026-01-22 13:37:24 +03:30
parent 1e24fc6caf
commit 939127354d
12 changed files with 5057 additions and 28 deletions
+6 -6
View File
@@ -349,7 +349,7 @@ class ElasticHelper:
# - داده‌ها را از فایل ZIP به Elasticsearch بازیابی می‌کند
# -----------------------------end----------------------------
def restorFileToElastic(
self, path_back, index_name, app_key="", queryDelete=True, map_name=""
self, path_back, index_name, app_key="", queryDelete=True, map_name="", mapping_file_path = ""
):
if not os.path.exists(path_back):
print(" **** error *** path not exist: ", path_back)
@@ -362,14 +362,14 @@ class ElasticHelper:
if queryDelete:
# اگر وجود داشته باشد، از کاربر برای حذفش سوال میکند
if self.deleteIndex(index_name):
self.createIndex(index_name, app_key, map_name)
self.createIndex(index_name, app_key, map_name, mapping_file_path)
self.zipFileToElastic(file_path, index_name)
else: # اگر وجود داشته باشد پرش می کند و کاری نمیکند
self.createIndex(index_name, app_key, map_name)
self.createIndex(index_name, app_key, map_name, mapping_file_path)
self.zipFileToElastic(file_path, index_name)
def restorFileToElastic2(
self, path_file, index_name, app_key="", queryDelete=True, map_name=""
self, path_file, index_name, app_key="", queryDelete=True, map_name="", mapping_file_path = ""
):
if not os.path.exists(path_file):
print(" **** error *** path not exist: ", path_file)
@@ -382,10 +382,10 @@ class ElasticHelper:
if queryDelete:
# اگر وجود داشته باشد، از کاربر برای حذفش سوال میکند
if self.deleteIndex(index_name):
self.createIndex(index_name, app_key, map_name)
self.createIndex(index_name, app_key, map_name, mapping_file_path)
self.zipFileToElastic(file_path, index_name)
else: # اگر وجود داشته باشد پرش می کند و کاری نمیکند
self.createIndex(index_name, app_key, map_name)
self.createIndex(index_name, app_key, map_name, mapping_file_path)
self.zipFileToElastic(file_path, index_name)
# ----------------------------start---------------------------
+7
View File
@@ -158,6 +158,13 @@ def split_words(text) :
words = re.split(r"[\t\n\r\.\"«»\)\(\]\[,;،؛ \-!?:]+", text)
return words
def is_number_string(value):
try:
float(value)
return True
except ValueError:
return False
def normalHeadingTitle(text, last_path = '', keyTitles=[]):
global _normalizer
lines = text.split('\n')