         # File lib/ferret/index.rb, line 517
    517:     def delete(arg)
    518:       @dir.synchronize do
    519:         if arg.is_a?(String) or arg.is_a?(Symbol)
    520:           ensure_writer_open()
    521:           @writer.delete(@id_field, arg.to_s)
    522:         elsif arg.is_a?(Integer)
    523:           ensure_reader_open()
    524:           cnt = @reader.delete(arg)
    525:         elsif arg.is_a?(Hash) or arg.is_a?(Array)
    526:           batch_delete(arg)
    527:         else
    528:           raise ArgumentError, "Cannot delete for arg of type #{arg.class}"
    529:         end
    530:         flush() if @auto_flush
    531:       end
    532:       return self
    533:     end