@shared_task
@catch_result
def sync_search_indexes():
    management.call_command('rebuild_index', interactive=False)

    # patch whoosh backend
    haystack = getattr(settings, 'HAYSTACK_CONNECTIONS', None)

    if haystack in 'default' and 'whoosh' in haystack['default']['ENGINE']:

        try:
            os.remove(os.path.join(
                haystack['default']['PATH'], 'MAIN_WRITELOCK'))
        except:
            pass

    return {'result': 'Rebuild index OK'}
dataset/ETHPy150Open django-leonardo/django-leonardo/leonardo/module/search/tasks.py/sync_search_indexes/swapped operands of `in`