def _enable_search_index(domain, enabled): from corehq.apps.case_search.tasks import reindex_case_search_for_domain, delete_case_search_cases_for_domain from corehq.pillows.case_search import domains_needing_search_index domains_needing_search_index.clear() if enabled: reindex_case_search_for_domain.delay(domain) else: delete_case_search_cases_for_domain.delay(domain)
def disable_case_search(domain): from corehq.apps.case_search.tasks import delete_case_search_cases_for_domain try: config = CaseSearchConfig.objects.get(pk=domain) except CaseSearchConfig.DoesNotExist: # CaseSearch was never enabled return if config.enabled: config.enabled = False config.save() delete_case_search_cases_for_domain.delay(domain)
def disable_case_search(domain): from corehq.apps.case_search.tasks import delete_case_search_cases_for_domain try: config = CaseSearchConfig.objects.get(pk=domain) except CaseSearchConfig.DoesNotExist: # CaseSearch was never enabled return if config.enabled: config.enabled = False config.save() delete_case_search_cases_for_domain.delay(domain)
def disable_case_search(domain): from corehq.apps.case_search.tasks import delete_case_search_cases_for_domain from corehq.pillows.case_search import domains_needing_search_index try: config = CaseSearchConfig.objects.get(pk=domain) except CaseSearchConfig.DoesNotExist: # CaseSearch was never enabled return if config.enabled: config.enabled = False config.save() case_search_enabled_for_domain.clear(domain) domains_needing_search_index.clear() delete_case_search_cases_for_domain.delay(domain)
def disable_case_search(domain): from corehq.apps.case_search.tasks import delete_case_search_cases_for_domain from corehq.pillows.case_search import domains_needing_search_index try: config = CaseSearchConfig.objects.get(pk=domain) except CaseSearchConfig.DoesNotExist: # CaseSearch was never enabled return None if config.enabled: config.enabled = False config.save() case_search_enabled_for_domain.clear(domain) domains_needing_search_index.clear() delete_case_search_cases_for_domain.delay(domain) return config