An open source, non-profit web search engine
Improve logging of new/existing index
Daoud Clarke6aa53b63f395
diff --git a/mwmbl/apps.py b/mwmbl/apps.pyindex fe72ca1..c93ea15 100644--- a/mwmbl/apps.py+++ b/mwmbl/apps.py@@ -14,11 +14,16 @@ def create_index():index_path = Path(settings.DATA_PATH) / settings.INDEX_NAMEtry:existing_index = TinyIndex(item_factory=Document, index_path=index_path)+ print("======================================")+ print(f"Found existing index at {index_path}")+ print("======================================")if existing_index.page_size != PAGE_SIZE or existing_index.num_pages != settings.NUM_PAGES:raise ValueError(f"Existing index page sizes ({existing_index.page_size}) or number of pages "f"({existing_index.num_pages}) do not match")except FileNotFoundError:- print("Creating a new index")+ print("======================================")+ print("Index not found - creating a new index")+ print("======================================")TinyIndex.create(item_factory=Document, index_path=index_path, num_pages=settings.NUM_PAGES,page_size=PAGE_SIZE)