YUKI Hiroshi
null+****@clear*****
Mon Feb 3 12:19:29 JST 2014
YUKI Hiroshi 2014-02-03 12:19:29 +0900 (Mon, 03 Feb 2014) New Revision: 803773dc0e0d4c4bef959d7cb9ffa45c23076833 https://github.com/droonga/fluent-plugin-droonga/commit/803773dc0e0d4c4bef959d7cb9ffa45c23076833 Message: Allow to define reducer with its type Modified files: lib/droonga/distributed_command_planner.rb lib/droonga/plugin/distributor/crud.rb lib/droonga/plugin/distributor/groonga.rb lib/droonga/plugin/distributor/watch.rb Modified: lib/droonga/distributed_command_planner.rb (+8 -0) =================================================================== --- lib/droonga/distributed_command_planner.rb 2014-02-03 12:16:37 +0900 (3abf41d) +++ lib/droonga/distributed_command_planner.rb 2014-02-03 12:19:29 +0900 (f74d954) @@ -133,6 +133,14 @@ module Droonga end def reducer_message(command, name, reducer) + if reducer.is_a?(String) + reducer = { + "type" => reducer, + } + if reducer["type"] == "sum" + reducer["limit"] = -1 + end + end { "type" => command, "body" => { Modified: lib/droonga/plugin/distributor/crud.rb (+1 -1) =================================================================== --- lib/droonga/plugin/distributor/crud.rb 2014-02-03 12:16:37 +0900 (d69a79b) +++ lib/droonga/plugin/distributor/crud.rb 2014-02-03 12:19:29 +0900 (9532078) @@ -42,7 +42,7 @@ module Droonga super(message, :key => message["body"]["key"] || rand.to_s, :reduce => { - "success" => { "type" => "and" } + "success" => "and" }) end end Modified: lib/droonga/plugin/distributor/groonga.rb (+1 -1) =================================================================== --- lib/droonga/plugin/distributor/groonga.rb 2014-02-03 12:16:37 +0900 (aa19c95) +++ lib/droonga/plugin/distributor/groonga.rb 2014-02-03 12:19:29 +0900 (60eb8cb) @@ -47,7 +47,7 @@ module Droonga super(message, :write => true, :reduce => { - "result" => { "type" => "or" } + "result" => "or" }) end end Modified: lib/droonga/plugin/distributor/watch.rb (+1 -1) =================================================================== --- lib/droonga/plugin/distributor/watch.rb 2014-02-03 12:16:37 +0900 (477f8c4) +++ lib/droonga/plugin/distributor/watch.rb 2014-02-03 12:19:29 +0900 (cc4c1d8) @@ -46,7 +46,7 @@ module Droonga super(message, :write => true, :reduce => { - "success" => { "type" => "and" } + "success" => "and" }) end end -------------- next part -------------- HTML����������������������������... ダウンロード