         # File lib/ferret/index.rb, line 477
    477:     def update(id, new_doc)
    478:       @dir.synchrolock do
    479:         ensure_writer_open()
    480:         delete(id)
    481:         if id.is_a?(String) or id.is_a?(Symbol)
    482:           @writer.commit
    483:         else
    484:           ensure_writer_open()
    485:         end
    486:         @writer << new_doc
    487:         flush() if @auto_flush
    488:       end
    489:     end