Yoji Shidara
null+****@clear*****
Tue Dec 24 19:41:43 JST 2013
Yoji Shidara 2013-12-24 19:41:43 +0900 (Tue, 24 Dec 2013) New Revision: 09d8c6741d9519c3e8c441fc8f37e889ac74e8df https://github.com/droonga/fluent-plugin-droonga/commit/09d8c6741d9519c3e8c441fc8f37e889ac74e8df Message: Revert "Directly pass operators to Rroonga" This reverts commit 5a9c5fc434381d7b8efd7e4e4229305a86a8c4dd. This breaks test/command/suite/search/condition/nested.test Modified files: lib/droonga/searcher.rb Modified: lib/droonga/searcher.rb (+16 -2) =================================================================== --- lib/droonga/searcher.rb 2013-12-24 19:28:01 +0900 (1206cae) +++ lib/droonga/searcher.rb 2013-12-24 19:41:43 +0900 (c9ce5a5) @@ -153,6 +153,12 @@ module Droonga end class QuerySearcher + OPERATOR_CONVERSION_TABLE = { + "||" => Groonga::Operator::OR, + "&&" => Groonga::Operator::AND, + "-" => Groonga::Operator::BUT + }.freeze + class << self def search(search_request) new(search_request).search @@ -196,7 +202,12 @@ module Droonga if condition["query"] options[:syntax] = :query if condition["defaultOperator"] - options[:default_operator] = condition["defaultOperator"] + default_operator_string = condition["defaultOperator"] + default_operator = OPERATOR_CONVERSION_TABLE[default_operator_string] + unless default_operator + raise "undefined operator assigned #{default_operator_string}" + end + options[:default_operator] = default_operator end if condition["allowPragma"] options[:allow_pragma] = true @@ -218,7 +229,10 @@ module Droonga end def parse_condition_array(source, expression, condition) - operator = condition[0] + operator = OPERATOR_CONVERSION_TABLE[condition[0]] + unless operator + raise "undefined operator assigned #{condition[0]}" + end if condition[1] parse_condition(source, expression, condition[1]) end -------------- next part -------------- HTML����������������������������... Download