<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,6 +1,7 @@
+Balint Erdi
 David Lee
 Frederick Cheung
 James Rosen
 Niket Patel
 Paul Carey
-Priit Tamboom
+Priit Tamboom
\ No newline at end of file</diff>
      <filename>CONTRIBUTORS</filename>
    </modified>
    <modified>
      <diff>@@ -16,7 +16,7 @@ module RelaxDB
     
     def __getobj__
       unless @objs
-        @objs = RelaxDB.view &quot;#{@class_name}_all&quot;, @params
+        @objs = RelaxDB.rf_view &quot;#{@class_name}_all&quot;, @params
       end
       @objs
     end</diff>
      <filename>lib/relaxdb/all_delegator.rb</filename>
    </modified>
    <modified>
      <diff>@@ -538,11 +538,11 @@ module RelaxDB
         define_method by_name do |*params|
           view_name = &quot;#{self.name}_#{by_name}&quot;
           if params.empty?
-            res = RelaxDB.view view_name, opts
+            res = RelaxDB.rf_view view_name, opts
           elsif params[0].is_a? Hash
-            res = RelaxDB.view view_name, opts.merge(params[0])
+            res = RelaxDB.rf_view view_name, opts.merge(params[0])
           else
-            res = RelaxDB.view(view_name, :key =&gt; params[0]).first
+            res = RelaxDB.rf_view(view_name, :key =&gt; params[0]).first
           end            
         end
       end</diff>
      <filename>lib/relaxdb/document.rb</filename>
    </modified>
    <modified>
      <diff>@@ -80,7 +80,7 @@ module RelaxDB
       end
       params[:limit] = 1
             
-      RelaxDB.view(view_name, params).offset
+      RelaxDB.rf_view(view_name, params).offset
     end
     
   end</diff>
      <filename>lib/relaxdb/paginator.rb</filename>
    </modified>
    <modified>
      <diff>@@ -22,13 +22,9 @@ module RelaxDB
       end
     end
         
-    def initialize(view_name, params = {})
-      # CouchDB defaults reduce to true when a reduce func is present
-      # but returning the map view is typically more useful
-      reduce(false)
-      
+    def initialize view_name, params = {}      
       @view_name = view_name
-      params.each { |k, v| send(k, v) }
+      params.each { |k, v| send k, v }
     end
     
     def keys(keys=nil)</diff>
      <filename>lib/relaxdb/query.rb</filename>
    </modified>
    <modified>
      <diff>@@ -145,6 +145,22 @@ module RelaxDB
       
       res
     end
+    
+    #
+    # CouchDB defaults reduce to true when a reduce func is present.
+    # RelaxDB used to indiscriminately set reduce=false, allowing clients to override
+    # if desired. However, as of CouchDB 0.10, such behaviour results in 
+    #   {&quot;error&quot;:&quot;query_parse_error&quot;,&quot;reason&quot;:&quot;Invalid URL parameter `reduce` for map view.&quot;} 
+    # View https://issues.apache.org/jira/browse/COUCHDB-383#action_12722350
+    # 
+    # This method is an internal workaround for this change to CouchDB and may
+    # be removed if a future change allows for a better solution e.g. map=true 
+    # or a _map endpoint
+    #
+    def rf_view view_name, params
+      params[:reduce] = false
+      view view_name, params
+    end
           
     def view(view_name, params = {})
       q = Query.new(view_name, params)
@@ -185,7 +201,8 @@ module RelaxDB
       raise paginate_params.error_msg if paginate_params.invalid? 
       
       paginator = Paginator.new(paginate_params, page_params)
-                  
+
+      atts[:reduce] = false
       query = Query.new(view_name, atts)
       query.merge(paginate_params)
       </diff>
      <filename>lib/relaxdb/relaxdb.rb</filename>
    </modified>
    <modified>
      <diff>@@ -24,55 +24,55 @@ describe RelaxDB::Query do
     
     it &quot;should list design document and view name and default reduce to false&quot; do
       q = RelaxDB::Query.new(&quot;mount&quot;)
-      q.view_path.should == &quot;_design//_view/mount?reduce=false&quot;
+      q.view_path.should == &quot;_design//_view/mount&quot;
     end
     
     it &quot;should contain URL and JSON encoded key when the key has been set&quot; do
       q = RelaxDB::Query.new(&quot;&quot;)
       q.key(&quot;olympus&quot;)
-      q.view_path.should == &quot;_design//_view/?key=%22olympus%22&amp;reduce=false&quot;
+      q.view_path.should == &quot;_design//_view/?key=%22olympus%22&quot;
     end
     
     it &quot;should honour startkey, endkey and limit&quot; do
       q = RelaxDB::Query.new(&quot;&quot;)
       q.startkey([&quot;olympus&quot;]).endkey([&quot;vesuvius&quot;, 3600]).limit(100)
-      q.view_path.should == &quot;_design//_view/?startkey=%5B%22olympus%22%5D&amp;endkey=%5B%22vesuvius%22%2C3600%5D&amp;limit=100&amp;reduce=false&quot;
+      q.view_path.should == &quot;_design//_view/?startkey=%5B%22olympus%22%5D&amp;endkey=%5B%22vesuvius%22%2C3600%5D&amp;limit=100&quot;
     end
         
     it &quot;should specify a null key if key was set to nil&quot; do
       q = RelaxDB::Query.new(&quot;&quot;)
       q.key(nil)
-      q.view_path.should == &quot;_design//_view/?key=null&amp;reduce=false&quot;
+      q.view_path.should == &quot;_design//_view/?key=null&quot;
     end
 
     it &quot;should specify a null startkey if startkey was set to nil&quot; do
       q = RelaxDB::Query.new(&quot;&quot;)
       q.startkey(nil)
-      q.view_path.should == &quot;_design//_view/?startkey=null&amp;reduce=false&quot;
+      q.view_path.should == &quot;_design//_view/?startkey=null&quot;
     end
 
     it &quot;should specify a null endkey if endkey was set to nil&quot; do
       q = RelaxDB::Query.new(&quot;&quot;)
       q.endkey(nil)
-      q.view_path.should == &quot;_design//_view/?endkey=null&amp;reduce=false&quot;
+      q.view_path.should == &quot;_design//_view/?endkey=null&quot;
     end
     
     it &quot;should not JSON encode the startkey_docid&quot; do
       q = RelaxDB::Query.new(&quot;&quot;)
       q.startkey_docid(&quot;foo&quot;)
-      q.view_path.should == &quot;_design//_view/?startkey_docid=foo&amp;reduce=false&quot;
+      q.view_path.should == &quot;_design//_view/?startkey_docid=foo&quot;
     end
 
     it &quot;should not JSON encode the endkey_docid&quot; do
       q = RelaxDB::Query.new(&quot;&quot;)
       q.endkey_docid(&quot;foo&quot;)
-      q.view_path.should == &quot;_design//_view/?endkey_docid=foo&amp;reduce=false&quot;
+      q.view_path.should == &quot;_design//_view/?endkey_docid=foo&quot;
     end
     
     it &quot;should not include design or view if it starts with a _&quot; do
       q = RelaxDB::Query.new &quot;_&quot;
       # q.view_path.should == &quot;_&quot;
-      q.view_path.should == &quot;_?reduce=false&quot;
+      q.view_path.should == &quot;_&quot;
     end
     
   end  </diff>
      <filename>spec/query_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>cb7ddf9015d2cf551f5c790397546260d93fbe68</id>
    </parent>
  </parents>
  <author>
    <name>Paul Carey</name>
    <email>paul.p.carey@gmail.com</email>
  </author>
  <url>http://github.com/paulcarey/relaxdb/commit/f09e6ccf0d4ba379fc6c136a3ea26d4a397b6ee2</url>
  <id>f09e6ccf0d4ba379fc6c136a3ea26d4a397b6ee2</id>
  <committed-date>2009-08-15T02:48:38-07:00</committed-date>
  <authored-date>2009-08-15T02:48:38-07:00</authored-date>
  <message>Removed default query param of reduce=false as setting reduce if only a map function exists results in an error on the CouchDB 0.10 branch. Based off work by Balint Erdi.</message>
  <tree>6cf19e7eda4719c817779d79c69b697e8d383a3f</tree>
  <committer>
    <name>Paul Carey</name>
    <email>paul.p.carey@gmail.com</email>
  </committer>
</commit>
