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

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 .