def query_update(query, new_val)
      @dir.synchronize do
        ensure_writer_open()
        ensure_searcher_open()
        docs_to_add = []
        query = do_process_query(query)
        @searcher.search_each(query, :limit => :all) do |id, score|
          document = @searcher[id].load
          if new_val.is_a?(Hash)
            document.merge!(new_val)
          else new_val.is_a?(String) or new_val.is_a?(Symbol)
            document[@default_input_field] = new_val.to_s
          end
          docs_to_add << document
          @reader.delete(id)
        end
        ensure_writer_open()
        docs_to_add.each {|doc| @writer << doc }
        flush() if @auto_flush
      end
    end
def query_update(query, new_val)
      @dir.synchronize do
        ensure_writer_open()
        ensure_searcher_open()
        docs_to_add = []
        query = do_process_query(query)
        @searcher.search_each(query, :limit => :all) do |id, score|
          document = @searcher[id].load
          if new_val.is_a?(Hash)
            document.merge!(new_val)
          else new_val.is_a?(String) or new_val.is_a?(Symbol)
            document[@default_input_field] = new_val.to_s
          end
          docs_to_add << document
          @reader.delete(id)
        end
        ensure_writer_open()
        docs_to_add.each {|doc| @writer << doc }
        flush() if @auto_flush
      end
    end
Update all the documents returned by the query.

 query::   The query to find documents you wish to update. Can either be
           a string (in which case it is parsed by the standard query
           parser) or an actual query object.
 new_val:: The values we are updating. This can be a string in which case
           the default field is updated, or it can be a hash, in which
           case, all fields in the hash are merged into the old hash.
           That is, the old fields are replaced by values in the new hash
           if they exist.

 === Example

   index << {:id => "26", :title => "Babylon", :artist => "David Grey"}
   index << {:id => "29", :title => "My Oh My", :artist => "David Grey"}

   # correct
   index.query_update('artist:"David Grey"', {:artist => "David Gray"})

   index["26"]
     #=> {:id => "26", :title => "Babylon", :artist => "David Gray"}
   index["28"]
     #=> {:id => "28", :title => "My Oh My", :artist => "David Gray"}