YUKI Hiroshi
null+****@clear*****
Wed Feb 19 18:41:43 JST 2014
YUKI Hiroshi 2014-02-19 18:41:43 +0900 (Wed, 19 Feb 2014) New Revision: aae844f8eba32c65117f0c6d9ea5ec1fc34f3aea https://github.com/droonga/droonga.org/commit/aae844f8eba32c65117f0c6d9ea5ec1fc34f3aea Message: Update example to modify all responses Modified files: reference/plugin/adapter/index.md Modified: reference/plugin/adapter/index.md (+13 -2) =================================================================== --- reference/plugin/adapter/index.md 2014-02-19 18:34:56 +0900 (78c4c8e) +++ reference/plugin/adapter/index.md 2014-02-19 18:41:43 +0900 (cf324d7) @@ -26,7 +26,7 @@ module Droonga class Adapter < Droonga::Adapter # operations to configure this adapter - message.XXXXXX = XXXXXX + XXXXXX = XXXXXX def adapt_input(input_message) # operations to modify incoming messages @@ -245,7 +245,18 @@ module FooPlugin input_message.pattern = ["type", :equal, "search"] def adapt_output(output_message) - output_message.body["queries"] + output_message.body.each do |name, result| + next unless result["records"] + result["records"] << ad_entry + end + # Now all search results include advertising. + end + + def ad_entry + { + "title"=> "Buy Now!!", + "url"=> "http://..." + } end end end -------------- next part -------------- HTML����������������������������...Download