         # File lib/ferret/index.rb, line 569
    569:     def update(id, new_doc)
    570:       @dir.synchronize do
    571:         ensure_writer_open()
    572:         delete(id)
    573:         if id.is_a?(String) or id.is_a?(Symbol)
    574:           @writer.commit
    575:         else
    576:           ensure_writer_open()
    577:         end
    578:         @writer << new_doc
    579:         flush() if @auto_flush
    580:       end
    581:     end