mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-27 17:35:07 +01:00
Streamline None checking in initialize_search
This commit is contained in:
parent
da52433d89
commit
bf8ae31e6a
1 changed files with 8 additions and 8 deletions
16
src/main.py
16
src/main.py
|
@ -127,23 +127,23 @@ def initialize_search(config: FullConfig, regenerate, verbose):
|
||||||
search_config = SearchConfig()
|
search_config = SearchConfig()
|
||||||
|
|
||||||
# Initialize Org Notes Search
|
# Initialize Org Notes Search
|
||||||
search_config.notes = TextSearchConfig(config.content_type.org, verbose) if config.content_type.org else None
|
if config.content_type.org:
|
||||||
if search_config.notes:
|
search_config.notes = TextSearchConfig(config.content_type.org, verbose)
|
||||||
model.notes_search = asymmetric.setup(search_config.notes, regenerate=regenerate)
|
model.notes_search = asymmetric.setup(search_config.notes, regenerate=regenerate)
|
||||||
|
|
||||||
# Initialize Org Music Search
|
# Initialize Org Music Search
|
||||||
search_config.music = TextSearchConfig(config.content_type.music, verbose) if config.content_type.music else None
|
if config.content_type.music:
|
||||||
if search_config.music:
|
search_config.music = TextSearchConfig(config.content_type.music, verbose)
|
||||||
model.music_search = asymmetric.setup(search_config.music, regenerate=regenerate)
|
model.music_search = asymmetric.setup(search_config.music, regenerate=regenerate)
|
||||||
|
|
||||||
# Initialize Ledger Search
|
# Initialize Ledger Search
|
||||||
search_config.ledger = TextSearchConfig(config.content_type.org, verbose) if config.content_type.ledger else None
|
if config.content_type.ledger:
|
||||||
if search_config.ledger:
|
search_config.ledger = TextSearchConfig(config.content_type.org, verbose)
|
||||||
model.ledger_search = symmetric_ledger.setup(search_config.ledger, regenerate=regenerate)
|
model.ledger_search = symmetric_ledger.setup(search_config.ledger, regenerate=regenerate)
|
||||||
|
|
||||||
# Initialize Image Search
|
# Initialize Image Search
|
||||||
search_config.image = ImageSearchConfig(config.content_type.image, verbose) if config.content_type.image else None
|
if config.content_type.image:
|
||||||
if search_config.image:
|
search_config.image = ImageSearchConfig(config.content_type.image, verbose)
|
||||||
model.image_search = image_search.setup(search_config.image, regenerate=regenerate)
|
model.image_search = image_search.setup(search_config.image, regenerate=regenerate)
|
||||||
|
|
||||||
return model, search_config
|
return model, search_config
|
||||||
|
|
Loading…
Reference in a new issue