Merge branch 'master' of github.com:debanjum/khoj into create-native-gui

Conflicts:
- src/main.py
  - router functions have moved to router
  - move logic to handle null query perf timer variables into
    router.py
  - set main.py to current branch, not master
This commit is contained in:
Debanjum Singh Solanky
2022-08-11 21:09:42 +03:00
4 changed files with 115 additions and 54 deletions

View File

@@ -53,9 +53,11 @@ def search(q: str, n: Optional[int] = 5, t: Optional[SearchType] = None, r: Opti
print(f'No query param (q) passed in API call to initiate search')
return {}
# initialize variables
user_query = q
results_count = n
results = {}
query_start, query_end, collate_start, collate_end = None, None, None, None
if (t == SearchType.Org or t == None) and state.model.orgmode_search:
# query org-mode notes
@@ -119,8 +121,10 @@ def search(q: str, n: Optional[int] = 5, t: Optional[SearchType] = None, r: Opti
collate_end = time.time()
if state.verbose > 1:
print(f"Query took {query_end - query_start:.3f} seconds")
print(f"Collating results took {collate_end - collate_start:.3f} seconds")
if query_start and query_end:
print(f"Query took {query_end - query_start:.3f} seconds")
if collate_start and collate_end:
print(f"Collating results took {collate_end - collate_start:.3f} seconds")
return results