Yoji Shidara
null+****@clear*****
Thu Dec 19 15:15:06 JST 2013
Yoji Shidara 2013-12-19 15:15:06 +0900 (Thu, 19 Dec 2013) New Revision: 50221e191729a192906e2a202134acf980014ead https://github.com/droonga/fluent-plugin-droonga/commit/50221e191729a192906e2a202134acf980014ead Merged ce62e72: Merge branch 'refactor-searcher' Message: Access query and context via @request Modified files: lib/droonga/searcher.rb Modified: lib/droonga/searcher.rb (+7 -9) =================================================================== --- lib/droonga/searcher.rb 2013-12-19 15:02:53 +0900 (11400a4) +++ lib/droonga/searcher.rb 2013-12-19 15:15:06 +0900 (ab9a06a) @@ -303,8 +303,6 @@ module Droonga class QuerySearcher def initialize(search_request) @request = search_request - @context =****@reque***** - @query =****@reque***** end def search(results) @@ -314,7 +312,7 @@ module Droonga end def need_output? - @result.records and****@query*****_key?("output") + @result.records and****@reque*****_key?("output") end def format @@ -329,7 +327,7 @@ module Droonga elsif condition.is_a? Hash options = {} if condition["matchTo"] - matchTo = Groonga::Expression.new(context: @context) + matchTo = Groonga::Expression.new(context: @request.context) matchTo.define_variable(:domain => source) match_columns = condition["matchTo"] match_columns = match_columns.join(",") if match_columns.is_a?(Array) @@ -404,17 +402,17 @@ module Droonga $log.trace("#{log_tag}: search_query: start") @result.start_time = Time.now - @records = results[@query["source"]] + @records = results[@request.query["source"]] - condition = @query["condition"] + condition =****@reque*****["condition"] apply_condition!(condition) if condition - group_by = @query["groupBy"] + group_by =****@reque*****["groupBy"] apply_group_by!(group_by) if group_by @result.count =****@recor***** - sort_by = @query["sortBy"] + sort_by =****@reque*****["sortBy"] apply_sort_by!(sort_by) if sort_by $log.trace("#{log_tag}: search_query: done") @@ -423,7 +421,7 @@ module Droonga end def apply_condition!(condition) - expression = Groonga::Expression.new(context: @context) + expression = Groonga::Expression.new(context: @request.context) expression.define_variable(:domain => @records) parseCondition(@records, expression, condition) $log.trace("#{log_tag}: search_query: select: start", -------------- next part -------------- HTML����������������������������...Download