summaryrefslogtreecommitdiff
path: root/src/couchdb/couch_view_group.erl
diff options
context:
space:
mode:
authorJohn Christopher Anderson <jchris@apache.org>2009-02-01 22:21:09 +0000
committerJohn Christopher Anderson <jchris@apache.org>2009-02-01 22:21:09 +0000
commitcdfe55c54de515581121f6923e8301e8cbea5bcc (patch)
tree13db216a91aa8ad0f39d30324afa41023334b685 /src/couchdb/couch_view_group.erl
parent614f3c26d98ab656e095b5672511d710732f034a (diff)
Added options member to design docs. Currently the only option is include_designs (views can now run over design docs as well if they need to), the default is false, which is the current behavior. Thanks davisp for the original patch. Closes COUCHDB-156
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@739866 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_view_group.erl')
-rw-r--r--src/couchdb/couch_view_group.erl7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/couchdb/couch_view_group.erl b/src/couchdb/couch_view_group.erl
index 6d193516..4e7d7767 100644
--- a/src/couchdb/couch_view_group.erl
+++ b/src/couchdb/couch_view_group.erl
@@ -262,7 +262,7 @@ prepare_group({view, RootDir, DbName, GroupId}, ForceReset)->
catch delete_index_file(RootDir, DbName, GroupId),
Error
end;
-prepare_group({slow_view, DbName, Fd, Lang, MapSrc, RedSrc}, _ForceReset) ->
+prepare_group({slow_view, DbName, Fd, Lang, DesignOptions, MapSrc, RedSrc}, _ForceReset) ->
case couch_db:open(DbName, []) of
{ok, Db} ->
View = #view{map_names=[<<"_temp">>],
@@ -271,7 +271,7 @@ prepare_group({slow_view, DbName, Fd, Lang, MapSrc, RedSrc}, _ForceReset) ->
def=MapSrc,
reduce_funs= if RedSrc==[] -> []; true -> [{<<"_temp">>, RedSrc}] end},
{ok, init_group(Db, Fd, #group{type=slow_view, name= <<"_temp">>, db=Db,
- views=[View], def_lang=Lang}, nil)};
+ views=[View], def_lang=Lang, design_options=DesignOptions}, nil)};
Error ->
Error
end.
@@ -311,6 +311,7 @@ open_db_group(DbName, GroupId) ->
% maybe move to another module
design_doc_to_view_group(#doc{id=Id,body={Fields}}) ->
Language = proplists:get_value(<<"language">>, Fields, <<"javascript">>),
+ {DesignOptions} = proplists:get_value(<<"options">>, Fields, {[]}),
{RawViews} = proplists:get_value(<<"views">>, Fields, {[]}),
% add the views to a dictionary object, with the map source as the key
@@ -338,7 +339,7 @@ design_doc_to_view_group(#doc{id=Id,body={Fields}}) ->
{View#view{id_num=N},N+1}
end, 0, dict:to_list(DictBySrc)),
- Group = #group{name=Id, views=Views, def_lang=Language},
+ Group = #group{name=Id, views=Views, def_lang=Language, design_options=DesignOptions},
Group#group{sig=erlang:md5(term_to_binary(Group))}.
reset_group(#group{views=Views}=Group) ->