mj_plan tested
This commit is contained in:
@@ -135,6 +135,19 @@ def import_paln_json_to_elastic(elastic, file_path, index_name):
|
||||
# print(':D')
|
||||
|
||||
|
||||
def list_json_files(directory):
|
||||
import os
|
||||
json_files = []
|
||||
|
||||
# مرور در دایرکتوری
|
||||
for root, _, files in os.walk(directory):
|
||||
for file in files:
|
||||
if file.endswith('.json'):
|
||||
# افزودن مسیر کامل فایل به لیست
|
||||
json_files.append(os.path.join(root, file))
|
||||
|
||||
return json_files
|
||||
|
||||
|
||||
# -------------------------------------------------------------------- Run
|
||||
if __name__ == "__main__":
|
||||
@@ -155,13 +168,16 @@ if __name__ == "__main__":
|
||||
path_base_map = "G:/Project2/gateway2_main/repo/_other/"
|
||||
elastic = ElasticHelper(host, password, "elastic", path_base_map)
|
||||
|
||||
file_path=r'data/plans/gpt120b_49_1/data_1/آمار، برنامه و بودجه.json'
|
||||
index_name='mj_plan'
|
||||
import_paln_json_to_elastic(
|
||||
elastic=elastic,
|
||||
file_path=file_path,
|
||||
index_name=index_name
|
||||
)
|
||||
# file_path=r'data/plans/gpt120b_49_1/data_1/آمار، برنامه و بودجه.json'
|
||||
file_path=r'data/plans/gpt120b_49_1/data_1/'
|
||||
|
||||
for file in list_json_files(file_path):
|
||||
import_paln_json_to_elastic(
|
||||
elastic=elastic,
|
||||
file_path=file,
|
||||
index_name=index_name
|
||||
)
|
||||
|
||||
# all_codes = []
|
||||
# with open("./data/codes49.json", "r", encoding="utf8") as f:
|
||||
|
||||
Reference in New Issue
Block a user