def delete_index(sender, instance, **kwargs):

    if isinstance(instance, Object) and instance.is_searchable():
        ix = index.open_dir(settings.WHOOSH_INDEX)
        try:
            writer = ix.writer()
            try:
                writer.delete_by_term(u'id', unicode(instance.id))
                writer.commit()
            except:
                writer.cancel()
        except:
            pass
Delete Object from search index
dataset/ETHPy150Open treeio/treeio/treeio/core/search/models.py/delete_index