         # File lib/ferret/index.rb, line 440
    440:     def update(id, new_doc)
    441:       @dir.synchronize do
    442:         delete(id)
    443:         if id.is_a?(String) or id.is_a?(Symbol)
    444:           @writer.commit
    445:         else
    446:           ensure_writer_open()
    447:         end
    448:         @writer << new_doc
    449:         flush() if @auto_flush
    450:       end
    451:     end