From 7096f6591f45f3b47eb01ce2a85874c90d6461a9 Mon Sep 17 00:00:00 2001 From: EzFeDezy Date: Tue, 27 May 2025 22:29:38 +0200 Subject: [PATCH] Added more useful information to output --- src/Indexer/Scripts/example.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Indexer/Scripts/example.py b/src/Indexer/Scripts/example.py index 522dd9d..6687250 100644 --- a/src/Indexer/Scripts/example.py +++ b/src/Indexer/Scripts/example.py @@ -2,6 +2,7 @@ import os from tools import * import json from dataclasses import asdict +import time example_content = "./Scripts/example_content" example_searchdomain = "example" @@ -14,7 +15,10 @@ def init(toolset: Toolset): print("This is the init function from the python example script") print(f"example_counter: {example_counter}") searchdomainlist:SearchdomainListResults = toolset.client.SearchdomainListAsync().Result - print("Currently these searchdomains exist") + if example_searchdomain not in searchdomainlist.Searchdomains: + toolset.client.SearchdomainCreateAsync(example_searchdomain).Result + searchdomainlist = toolset.client.SearchdomainListAsync().Result + print("Currently these searchdomains exist:") for searchdomain in searchdomainlist.Searchdomains: print(f" - {searchdomain}") index_files(toolset) @@ -47,5 +51,7 @@ def index_files(toolset: Toolset): jsonEntity:dict = asdict(JSONEntity(qualified_filepath, "wavg", example_searchdomain, {}, datapoints)) jsonEntities.append(jsonEntity) jsonstring = json.dumps(jsonEntities) + timer_start = time.time() result:EntityIndexResult = toolset.client.EntityIndexAsync(jsonstring).Result - print(f"Update was successful: {result.Success}") \ No newline at end of file + timer_end = time.time() + print(f"Update was successful: {result.Success} - and was done in {timer_end - timer_start} seconds.") \ No newline at end of file