fix temp_view -> slow_view stuff for couchdb trunk

This commit is contained in:
Matt Lyon 2009-01-04 23:00:59 -08:00
parent 71f5ea2a1b
commit e15581b1dd
2 changed files with 8 additions and 5 deletions

View file

@ -47,12 +47,15 @@ module CouchRest
# POST a temporary view function to CouchDB for querying. This is not
# recommended, as you don't get any performance benefit from CouchDB's
# materialized views. Can be quite slow on large databases.
def temp_view funcs, params = {}
def slow_view funcs, params = {}
keys = params.delete(:keys)
funcs = funcs.merge({:keys => keys}) if keys
url = CouchRest.paramify_url "#{@root}/_temp_view", params
url = CouchRest.paramify_url "#{@root}/_slow_view", params
JSON.parse(RestClient.post(url, funcs.to_json, {"Content-Type" => 'application/json'}))
end
# backwards compatibility is a plus
alias :temp_view :slow_view
# Query a CouchDB view as defined by a <tt>_design</tt> document. Accepts
# paramaters as described in http://wiki.apache.org/couchdb/HttpViewApi