def index_del_instance(sender, instance, **kwargs):
    """
    Like index_add_instance but deletes the instance from the index.

    Should be called by the post_delete signal.
    """
    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 __HOLE__:
        # 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))
dataset/ETHPy150Open OpenSlides/OpenSlides/openslides/utils/search.py/index_del_instance