mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-07 13:23:15 +00:00
Make configure_content functional. Do not pass content index state to it.
This commit is contained in:
@@ -85,7 +85,7 @@ def configure_server(config: FullConfig, regenerate: bool, search_type: Optional
|
|||||||
try:
|
try:
|
||||||
state.config_lock.acquire()
|
state.config_lock.acquire()
|
||||||
state.content_index = configure_content(
|
state.content_index = configure_content(
|
||||||
state.content_index, state.config.content_type, state.search_models, regenerate, search_type
|
state.config.content_type, state.search_models, regenerate, search_type
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"🚨 Failed to index content")
|
logger.error(f"🚨 Failed to index content")
|
||||||
@@ -112,9 +112,7 @@ if not state.demo:
|
|||||||
def update_search_index():
|
def update_search_index():
|
||||||
try:
|
try:
|
||||||
state.config_lock.acquire()
|
state.config_lock.acquire()
|
||||||
state.content_index = configure_content(
|
state.content_index = configure_content(state.config.content_type, state.search_models, regenerate=False)
|
||||||
state.content_index, state.config.content_type, state.search_models, regenerate=False
|
|
||||||
)
|
|
||||||
logger.info("📬 Content index updated via Scheduler")
|
logger.info("📬 Content index updated via Scheduler")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"🚨 Error updating content index via Scheduler: {e}")
|
logger.error(f"🚨 Error updating content index via Scheduler: {e}")
|
||||||
@@ -155,7 +153,6 @@ def configure_search(search_models: SearchModels, search_config: Optional[Search
|
|||||||
|
|
||||||
|
|
||||||
def configure_content(
|
def configure_content(
|
||||||
content_index: Optional[ContentIndex],
|
|
||||||
content_config: Optional[ContentConfig],
|
content_config: Optional[ContentConfig],
|
||||||
search_models: SearchModels,
|
search_models: SearchModels,
|
||||||
regenerate: bool,
|
regenerate: bool,
|
||||||
@@ -165,8 +162,9 @@ def configure_content(
|
|||||||
if content_config is None:
|
if content_config is None:
|
||||||
logger.warning("🚨 No Content configuration available.")
|
logger.warning("🚨 No Content configuration available.")
|
||||||
return None
|
return None
|
||||||
if content_index is None:
|
|
||||||
content_index = ContentIndex()
|
# Initialize Variables
|
||||||
|
content_index = ContentIndex()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Initialize Org Notes Search
|
# Initialize Org Notes Search
|
||||||
|
|||||||
Reference in New Issue
Block a user