mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-12-12 08:43:03 +01:00
Rename orgmode_search to org_search
This commit is contained in:
parent
08d79f5ba4
commit
019d3732de
4 changed files with 8 additions and 8 deletions
|
@ -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:
|
if (t == state.SearchType.Org or t == None) and config.content_type.org:
|
||||||
logger.info("🦄 Setting up search for orgmode notes")
|
logger.info("🦄 Setting up search for orgmode notes")
|
||||||
# Extract Entries, Generate Notes Embeddings
|
# Extract Entries, Generate Notes Embeddings
|
||||||
model.orgmode_search = text_search.setup(
|
model.org_search = text_search.setup(
|
||||||
OrgToJsonl,
|
OrgToJsonl,
|
||||||
config.content_type.org,
|
config.content_type.org,
|
||||||
search_config=config.search_type.asymmetric,
|
search_config=config.search_type.asymmetric,
|
||||||
|
|
|
@ -91,11 +91,11 @@ def search(
|
||||||
logger.debug(f"Return response from query cache")
|
logger.debug(f"Return response from query cache")
|
||||||
return state.query_cache[query_cache_key]
|
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
|
# query org-mode notes
|
||||||
with timer("Query took", logger):
|
with timer("Query took", logger):
|
||||||
hits, entries = text_search.query(
|
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
|
# collate and return results
|
||||||
|
|
|
@ -59,7 +59,7 @@ class ImageSearchModel:
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class SearchModels:
|
class SearchModels:
|
||||||
orgmode_search: TextSearchModel = None
|
org_search: TextSearchModel = None
|
||||||
ledger_search: TextSearchModel = None
|
ledger_search: TextSearchModel = None
|
||||||
music_search: TextSearchModel = None
|
music_search: TextSearchModel = None
|
||||||
markdown_search: TextSearchModel = None
|
markdown_search: TextSearchModel = None
|
||||||
|
|
|
@ -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):
|
def test_notes_search(client, content_config: ContentConfig, search_config: SearchConfig):
|
||||||
# Arrange
|
# 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?")
|
user_query = quote("How to git install application?")
|
||||||
|
|
||||||
# Act
|
# 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):
|
def test_notes_search_with_only_filters(client, content_config: ContentConfig, search_config: SearchConfig):
|
||||||
# Arrange
|
# Arrange
|
||||||
filters = [WordFilter(), FileFilter()]
|
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
|
OrgToJsonl, content_config.org, search_config.asymmetric, regenerate=False, filters=filters
|
||||||
)
|
)
|
||||||
user_query = quote('+"Emacs" file:"*.org"')
|
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):
|
def test_notes_search_with_include_filter(client, content_config: ContentConfig, search_config: SearchConfig):
|
||||||
# Arrange
|
# Arrange
|
||||||
filters = [WordFilter()]
|
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
|
OrgToJsonl, content_config.org, search_config.asymmetric, regenerate=False, filters=filters
|
||||||
)
|
)
|
||||||
user_query = quote('How to git install application? +"Emacs"')
|
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):
|
def test_notes_search_with_exclude_filter(client, content_config: ContentConfig, search_config: SearchConfig):
|
||||||
# Arrange
|
# Arrange
|
||||||
filters = [WordFilter()]
|
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
|
OrgToJsonl, content_config.org, search_config.asymmetric, regenerate=False, filters=filters
|
||||||
)
|
)
|
||||||
user_query = quote('How to git install application? -"clone"')
|
user_query = quote('How to git install application? -"clone"')
|
||||||
|
|
Loading…
Reference in a new issue