couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bbast...@apache.org
Subject [15/41] couch-mrview commit: updated refs/heads/master to 28e51f3
Date Fri, 31 Oct 2014 19:53:30 GMT
add /<db>/_design/<ddocname>/_reindex handler

When you 'POST' on the _reindex handle all the views of the group will
be reindexed.

close #RCOUCH-36


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/commit/142a4c3f
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/tree/142a4c3f
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/diff/142a4c3f

Branch: refs/heads/master
Commit: 142a4c3f99a28b83c753c29db4b4b27e8175ea4a
Parents: 42ff200
Author: benoitc <bchesneau@gmail.com>
Authored: Tue Mar 4 13:38:55 2014 +0100
Committer: Benjamin Bastian <benjamin.bastian@gmail.com>
Committed: Thu Oct 30 13:38:34 2014 -0700

----------------------------------------------------------------------
 src/couch_mrview_http.erl | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/142a4c3f/src/couch_mrview_http.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview_http.erl b/src/couch_mrview_http.erl
index fb2e4ac..7a4c13c 100644
--- a/src/couch_mrview_http.erl
+++ b/src/couch_mrview_http.erl
@@ -14,6 +14,7 @@
 
 -export([
     handle_all_docs_req/2,
+    handle_reindex_req/3,
     handle_view_req/3,
     handle_temp_view_req/2,
     handle_info_req/3,
@@ -50,6 +51,15 @@ handle_all_docs_req(#httpd{method='POST'}=Req, Db) ->
 handle_all_docs_req(Req, _Db) ->
     couch_httpd:send_method_not_allowed(Req, "GET,POST,HEAD").
 
+handle_reindex_req(#httpd{method='POST',
+                          path_parts=[_, _, DName,<<"_reindex">>]}=Req,
+                   Db, DDoc) ->
+    ok = couch_db:check_is_admin(Db),
+    couch_mrview:trigger_update(Db, <<"_design/", DName/binary>>),
+    couch_httpd:send_json(Req, 201, {[{<<"ok">>, true}]});
+handle_reindex_req(Req, _Db, _DDoc) ->
+    couch_httpd:send_method_not_allowed(Req, "POST").
+
 
 handle_view_req(#httpd{method='GET',
                       path_parts=[_, _, DDocName, _, VName, <<"_info">>]}=Req,
@@ -62,7 +72,6 @@ handle_view_req(#httpd{method='GET',
                  {ddoc, DDocId},
                  {view, VName}] ++ Info,
     couch_httpd:send_json(Req, 200, {FinalInfo});
-
 handle_view_req(#httpd{method='GET'}=Req, Db, DDoc) ->
     [_, _, _, _, ViewName] = Req#httpd.path_parts,
     couch_stats:increment_counter([couchdb, httpd, view_reads]),


Mime
View raw message