def delete(arg)
      @dir.synchronize do
        if arg.is_a?(String) or arg.is_a?(Symbol)
          ensure_writer_open()
          @writer.delete(@id_field, arg.to_s)
        elsif arg.is_a?(Integer)
          ensure_reader_open()
          _cnt = @reader.delete(arg)
        elsif arg.is_a?(Hash) or arg.is_a?(Array)
          batch_delete(arg)
        else
          raise ArgumentError, "Cannot delete for arg of type #{arg.class}"
        end
        flush() if @auto_flush
      end
      return self
    end
def delete(arg)
      @dir.synchronize do
        if arg.is_a?(String) or arg.is_a?(Symbol)
          ensure_writer_open()
          @writer.delete(@id_field, arg.to_s)
        elsif arg.is_a?(Integer)
          ensure_reader_open()
          _cnt = @reader.delete(arg)
        elsif arg.is_a?(Hash) or arg.is_a?(Array)
          batch_delete(arg)
        else
          raise ArgumentError, "Cannot delete for arg of type #{arg.class}"
        end
        flush() if @auto_flush
      end
      return self
    end
Deletes a document/documents from the index. The method for determining
 the document to delete depends on the type of the argument passed.

 If +arg+ is an Integer then delete the document based on the internal
 document number. Will raise an error if the document does not exist.

 If +arg+ is a String then search for the documents with +arg+ in the
 +id+ field. The +id+ field is either :id or whatever you set +:id_field+
 parameter to when you create the Index object. Will fail quietly if the
 no document exists.

 If +arg+ is a Hash or an Array then a batch delete will be performed.
 If +arg+ is an Array then it will be considered an array of +id+'s. If
 it is a Hash, then its keys will be used instead as the Array of
 document +id+'s. If the +id+ is an Integer then it is considered a
 Ferret document number and the corresponding document will be deleted.
 If the +id+ is a String or a Symbol then the +id+ will be considered a
 term and the documents that contain that term in the +:id_field+ will be
 deleted.