From 019d3732deb484c1f6b8aa55feb750c366cbfb30 Mon Sep 17 00:00:00 2001 From: Saba Date: Tue, 13 Jun 2023 16:06:54 -0700 Subject: [PATCH] Rename orgmode_search to org_search --- src/khoj/configure.py | 2 +- src/khoj/routers/api.py | 4 ++-- src/khoj/utils/config.py | 2 +- tests/test_client.py | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/khoj/configure.py b/src/khoj/configure.py index f9735fea..6bb844cc 100644 --- a/src/khoj/configure.py +++ b/src/khoj/configure.py @@ -91,7 +91,7 @@ def configure_search(model: SearchModels, config: FullConfig, regenerate: bool, if (t == state.SearchType.Org or t == None) and config.content_type.org: logger.info("🦄 Setting up search for orgmode notes") # Extract Entries, Generate Notes Embeddings - model.orgmode_search = text_search.setup( + model.org_search = text_search.setup( OrgToJsonl, config.content_type.org, search_config=config.search_type.asymmetric, diff --git a/src/khoj/routers/api.py b/src/khoj/routers/api.py index dec496d6..7e80b827 100644 --- a/src/khoj/routers/api.py +++ b/src/khoj/routers/api.py @@ -91,11 +91,11 @@ def search( logger.debug(f"Return response from query cache") return state.query_cache[query_cache_key] - if (t == SearchType.Org or t == None) and state.model.orgmode_search: + if (t == SearchType.Org or t == None) and state.model.org_search: # query org-mode notes with timer("Query took", logger): hits, entries = text_search.query( - user_query, state.model.orgmode_search, rank_results=r, score_threshold=score_threshold, dedupe=dedupe + user_query, state.model.org_search, rank_results=r, score_threshold=score_threshold, dedupe=dedupe ) # collate and return results diff --git a/src/khoj/utils/config.py b/src/khoj/utils/config.py index cc461855..a83f7814 100644 --- a/src/khoj/utils/config.py +++ b/src/khoj/utils/config.py @@ -59,7 +59,7 @@ class ImageSearchModel: @dataclass class SearchModels: - orgmode_search: TextSearchModel = None + org_search: TextSearchModel = None ledger_search: TextSearchModel = None music_search: TextSearchModel = None markdown_search: TextSearchModel = None diff --git a/tests/test_client.py b/tests/test_client.py index cee0ee67..d74b4f2d 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -166,7 +166,7 @@ def test_image_search(client, content_config: ContentConfig, search_config: Sear # ---------------------------------------------------------------------------------------------------- def test_notes_search(client, content_config: ContentConfig, search_config: SearchConfig): # Arrange - model.orgmode_search = text_search.setup(OrgToJsonl, content_config.org, search_config.asymmetric, regenerate=False) + model.org_search = text_search.setup(OrgToJsonl, content_config.org, search_config.asymmetric, regenerate=False) user_query = quote("How to git install application?") # Act @@ -183,7 +183,7 @@ def test_notes_search(client, content_config: ContentConfig, search_config: Sear def test_notes_search_with_only_filters(client, content_config: ContentConfig, search_config: SearchConfig): # Arrange filters = [WordFilter(), FileFilter()] - model.orgmode_search = text_search.setup( + model.org_search = text_search.setup( OrgToJsonl, content_config.org, search_config.asymmetric, regenerate=False, filters=filters ) user_query = quote('+"Emacs" file:"*.org"') @@ -202,7 +202,7 @@ def test_notes_search_with_only_filters(client, content_config: ContentConfig, s def test_notes_search_with_include_filter(client, content_config: ContentConfig, search_config: SearchConfig): # Arrange filters = [WordFilter()] - model.orgmode_search = text_search.setup( + model.org_search = text_search.setup( OrgToJsonl, content_config.org, search_config.asymmetric, regenerate=False, filters=filters ) user_query = quote('How to git install application? +"Emacs"') @@ -221,7 +221,7 @@ def test_notes_search_with_include_filter(client, content_config: ContentConfig, def test_notes_search_with_exclude_filter(client, content_config: ContentConfig, search_config: SearchConfig): # Arrange filters = [WordFilter()] - model.orgmode_search = text_search.setup( + model.org_search = text_search.setup( OrgToJsonl, content_config.org, search_config.asymmetric, regenerate=False, filters=filters ) user_query = quote('How to git install application? -"clone"')