         # File lib/ferret/index.rb, line 487
    487:     def update(id, new_doc)
    488:       @dir.synchrolock do
    489:         ensure_writer_open()
    490:         delete(id)
    491:         if id.is_a?(String) or id.is_a?(Symbol)
    492:           @writer.commit
    493:         else
    494:           ensure_writer_open()
    495:         end
    496:         @writer << new_doc
    497:         flush() if @auto_flush
    498:       end
    499:     end