YUKI Hiroshi
null+****@clear*****
Thu Feb 20 10:32:32 JST 2014
YUKI Hiroshi 2014-02-20 10:32:32 +0900 (Thu, 20 Feb 2014) New Revision: f9ba63aa606bdbd8d527ec8f0cd3de4bb7b55ea6 https://github.com/droonga/droonga.org/commit/f9ba63aa606bdbd8d527ec8f0cd3de4bb7b55ea6 Message: Give meaningful plugin classname Modified files: reference/plugin/adapter/index.md Modified: reference/plugin/adapter/index.md (+9 -9) =================================================================== --- reference/plugin/adapter/index.md 2014-02-19 19:08:07 +0900 (21935a4) +++ reference/plugin/adapter/index.md 2014-02-20 10:32:32 +0900 (91e28bd) @@ -108,7 +108,7 @@ In this base class, this method is defined as just a placeholder and it does not To modify incoming messages, you have to override it by yours, like following: ~~~ruby -module FooPlugin +module QueryFixer class Adapter < Droonga::Adapter def adapt_input(input_message) input_message.body["query"] = "fixed query" @@ -126,7 +126,7 @@ In this base class, this method is defined as just a placeholder and it does not To modify outgoing messages, you have to override it by yours, like following: ~~~ruby -module FooPlugin +module ErrorBlocker class Adapter < Droonga::Adapter def adapt_output(output_message) output_message.status_code = StatusCode::OK @@ -144,7 +144,7 @@ This returns the `"type"` of the incoming message. You can override it by assigning a new string value, like: ~~~ruby -module FooPlugin +module MySearch class Adapter < Droonga::Adapter input_message.pattern = ["type", :equal, "my-search"] @@ -173,7 +173,7 @@ This returns the `"body"` of the incoming message. You can override it by assigning a new value, partially or fully. For example: ~~~ruby -module FooPlugin +module MinimumLimit class Adapter < Droonga::Adapter input_message.pattern = ["type", :equal, "search"] @@ -194,7 +194,7 @@ end Another case: ~~~ruby -module FooPlugin +module MySearch class Adapter < Droonga::Adapter input_message.pattern = ["type", :equal, "my-search"] @@ -232,7 +232,7 @@ This returns the `"statusCode"` of the outgoing message. You can override it by assigning a new status code. For example: ~~~ruby -module FooPlugin +module ErrorBlocker class Adapter < Droonga::Adapter input_message.pattern = ["type", :equal, "search"] @@ -256,7 +256,7 @@ This returns the `"errors"` of the outgoing message. You can override it by assigning new error information, partially or fully. For example: ~~~ruby -module FooPlugin +module ErrorExporter class Adapter < Droonga::Adapter input_message.pattern = ["type", :equal, "search"] @@ -285,14 +285,14 @@ This returns the `"body"` of the outgoing message. You can override it by assigning a new value, partially or fully. For example: ~~~ruby -module FooPlugin +module AdInsertion class Adapter < Droonga::Adapter input_message.pattern = ["type", :equal, "search"] def adapt_output(output_message) output_message.body.each do |name, result| next unless result["records"] - result["records"] << ad_entry + result["records"].shift(ad_entry) end # Now all search results include advertising. end -------------- next part -------------- HTML����������������������������...Download