         # File lib/ferret/index.rb, line 477
    477:     def query_update(query, new_val)
    478:       @dir.synchronize do
    479:         ensure_searcher_open()
    480:         docs_to_add = []
    481:         query = do_process_query(query)
    482:         @searcher.search_each(query) do |id, score|
    483:           document = @searcher[id].load
    484:           if new_val.is_a?(Hash)
    485:             document.merge!(new_val)
    486:           else new_val.is_a?(String) or new_val.is_a?(Symbol)
    487:             document[@default_input_field] = new_val.to_s
    488:           end
    489:           docs_to_add << document
    490:           @reader.delete(id)
    491:         end
    492:         ensure_writer_open()
    493:         docs_to_add.each {|doc| @writer << doc }
    494:         flush() if @auto_flush
    495:       end
    496:     end