Configure processors too on calling /update API

- Previously only search was being reconfigured
- But Processors are configured on app start too
- Match that behavior on calling /update API
This commit is contained in:
Debanjum Singh Solanky 2023-01-03 21:42:50 -03:00
parent 9d31988f42
commit ce945f7a90

View file

@ -8,7 +8,7 @@ from typing import Optional
from fastapi import APIRouter from fastapi import APIRouter
# Internal Packages # Internal Packages
from src.configure import configure_search from src.configure import configure_processor, configure_search
from src.search_type import image_search, text_search from src.search_type import image_search, text_search
from src.utils.rawconfig import FullConfig, SearchResponse from src.utils.rawconfig import FullConfig, SearchResponse
from src.utils.config import SearchType from src.utils.config import SearchType
@ -130,4 +130,7 @@ def update(t: Optional[SearchType] = None, force: Optional[bool] = False):
state.search_index_lock.release() state.search_index_lock.release()
logger.info("Search Index updated via API call") logger.info("Search Index updated via API call")
return {'status': 'ok', 'message': 'index updated'} state.processor_config = configure_processor(state.config.processor)
logger.info("Processor reconfigured via API call")
return {'status': 'ok', 'message': 'khoj reloaded'}