@@ -807,6 +807,7 @@ def check_for_indexing(self: Task, *, tenant_id: str) -> int | None:
807
807
primary_cc_pair_ids = standard_cc_pair_ids + user_file_cc_pair_ids
808
808
809
809
# Get CC pairs for secondary search settings
810
+ secondary_cc_pair_ids : list [int ] = []
810
811
secondary_search_settings = get_secondary_search_settings (db_session )
811
812
if secondary_search_settings :
812
813
# Include paused CC pairs during embedding swap
@@ -855,10 +856,11 @@ def check_for_indexing(self: Task, *, tenant_id: str) -> int | None:
855
856
tenant_id = tenant_id ,
856
857
)
857
858
859
+ # Secondary indexing (only if secondary search settings exist and background reindex is enabled)
858
860
if (
859
- secondary_cc_pair_ids
860
- and secondary_search_settings
861
+ secondary_search_settings
861
862
and secondary_search_settings .background_reindex_enabled
863
+ and secondary_cc_pair_ids
862
864
):
863
865
tasks_created += _kickoff_indexing_tasks (
864
866
celery_app = self .app ,
@@ -870,9 +872,14 @@ def check_for_indexing(self: Task, *, tenant_id: str) -> int | None:
870
872
lock_beat = lock_beat ,
871
873
tenant_id = tenant_id ,
872
874
)
873
- else :
874
- task_logger .warning (
875
- "Secondary search settings are not live, skipping indexing attempts"
875
+ elif (
876
+ secondary_search_settings
877
+ and not secondary_search_settings .background_reindex_enabled
878
+ ):
879
+ task_logger .info (
880
+ f"Skipping secondary indexing: "
881
+ f"background_reindex_enabled=False "
882
+ f"for search_settings={ secondary_search_settings .id } "
876
883
)
877
884
878
885
# 2/3: VALIDATE
0 commit comments