def index_del_instance(sender, instance, **kwargs):
    try:
        # Try to get the arrribute get_search_attributes. It is not needed
        # in this method (and therefore not called) but it tells us if the
        # instance is searchable.
        instance.get_search_index_string
    except AttributeError:
        # If the instance is not searchable, then exit this signal early.
        return

    with index.get_or_create_index().writer() as writer:
        writer.delete_by_term('id_collection', combine_id_and_collection(instance))
Like index_add_instance but deletes the instance from the index.
dataset/ETHPy150Open OpenSlides/OpenSlides/openslides/utils/search.py/index_del_instance