         # File lib/ferret/index.rb, line 437
    437:     def delete(arg)
    438:       @dir.synchrolock do
    439:         ensure_writer_open()
    440:         if arg.is_a?(String) or arg.is_a?(Symbol)
    441:           ensure_writer_open()
    442:           @writer.delete(@id_field, arg.to_s)
    443:         elsif arg.is_a?(Integer)
    444:           ensure_reader_open()
    445:           cnt = @reader.delete(arg)
    446:         else
    447:           raise ArgumentError, "Cannot delete for arg of type #{arg.class}"
    448:         end
    449:         flush() if @auto_flush
    450:       end
    451:       return self
    452:     end