You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by be...@apache.org on 2014/07/13 14:29:43 UTC

[3/7] couch-mrview commit: updated refs/heads/1994-merge-rcouch to 4e0f295

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/8fea62b2
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/tree/8fea62b2
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/diff/8fea62b2

Branch: refs/heads/1994-merge-rcouch
Commit: 8fea62b29b166aa685c6a93734c997dabd723aa2
Parents: 33d4a0f
Author: benoitc <bc...@gmail.com>
Authored: Tue Mar 4 13:38:55 2014 +0100
Committer: benoitc <bc...@gmail.com>
Committed: Tue Mar 4 13:38:55 2014 +0100

----------------------------------------------------------------------
 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/8fea62b2/src/couch_mrview_http.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview_http.erl b/src/couch_mrview_http.erl
index 64c9fb1..bd4d9c5 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,
@@ -47,6 +48,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,
@@ -59,7 +69,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_collector:increment({httpd, view_reads}),