From 3261eca836fa3dcfb6a9381b7e48d95a8be00f66 Mon Sep 17 00:00:00 2001 From: Mokaddem Date: Wed, 15 Mar 2017 14:29:49 +0100 Subject: [PATCH] Fixed all_index newline bug + added print of what's happening --- bin/Indexer.py | 7 +++++-- var/www/Flasks/Flask_search.py | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/bin/Indexer.py b/bin/Indexer.py index 2354bd4e..8c5bfcf9 100755 --- a/bin/Indexer.py +++ b/bin/Indexer.py @@ -66,8 +66,11 @@ if __name__ == "__main__": # create the index register if not present time_now = int(time.time()) if not os.path.isfile(indexRegister_path): #index are not organised + print("Indexes are not organized") + print("moving all files in folder 'old_index' ") #move all files to old_index folder move_index_into_old_index_folder(baseindexpath) + print("Creating new index") #create all_index.txt with open(indexRegister_path, 'w') as f: f.write(str(time_now)) @@ -76,7 +79,7 @@ if __name__ == "__main__": with open(indexRegister_path, "r") as f: allIndex = f.read() - allIndex = allIndex.split(',') # format [time1,time2] + allIndex = allIndex.split() # format [time1\ntime2] allIndex.sort() try: @@ -119,7 +122,7 @@ if __name__ == "__main__": indexname = str(timestamp) #update all_index with open(indexRegister_path, "a") as f: - f.write(","+str(timestamp)) + f.write(str(timestamp)) #create new dir os.mkdir(indexpath) ix = create_in(indexpath, schema) diff --git a/var/www/Flasks/Flask_search.py b/var/www/Flasks/Flask_search.py index 47b9a71a..a89f011c 100644 --- a/var/www/Flasks/Flask_search.py +++ b/var/www/Flasks/Flask_search.py @@ -34,7 +34,7 @@ indexRegister_path = os.path.join(os.environ['AIL_HOME'], def get_current_index(): with open(indexRegister_path, "r") as f: allIndex = f.read() - allIndex = allIndex.split(',') # format [time1,time2] + allIndex = allIndex.split() # format [time1\ntime2] allIndex.sort() try: indexname = allIndex[-1].strip('\n\r')