YUKI Hiroshi
null+****@clear*****
Thu Feb 6 19:22:52 JST 2014
YUKI Hiroshi 2014-02-06 19:22:52 +0900 (Thu, 06 Feb 2014) New Revision: 313eb240deb5449f34c26a32fc789a4326ed779f https://github.com/droonga/fluent-plugin-droonga/commit/313eb240deb5449f34c26a32fc789a4326ed779f Message: Raise error for search requests with no query Modified files: lib/droonga/plugin/distributor/distributed_search_planner.rb lib/droonga/searcher.rb Modified: lib/droonga/plugin/distributor/distributed_search_planner.rb (+2 -0) =================================================================== --- lib/droonga/plugin/distributor/distributed_search_planner.rb 2014-02-06 19:22:33 +0900 (cc1a6c2) +++ lib/droonga/plugin/distributor/distributed_search_planner.rb 2014-02-06 19:22:52 +0900 (ec320ab) @@ -28,6 +28,8 @@ module Droonga end def plan + raise Searcher::NoQuery.new if****@queri*****? || @queries.empty? + Searcher::QuerySorter.validate_dependencies(@queries) ensure_unifiable! Modified: lib/droonga/searcher.rb (+8 -3) =================================================================== --- lib/droonga/searcher.rb 2014-02-06 19:22:33 +0900 (b5aaddd) +++ lib/droonga/searcher.rb 2014-02-06 19:22:52 +0900 (d9889fe) @@ -24,6 +24,12 @@ require "droonga/message_processing_error" module Droonga class Searcher + class NoQuery < BadRequest + def initialize + super("You must specify one or more query.") + end + end + class MissingSourceParameter < BadRequest def initialize(query, queries) super("The query #{query.inspect} has no source. " + @@ -64,9 +70,8 @@ module Droonga private def process_queries(queries) $log.trace("#{log_tag}: process_queries: start") - unless queries - $log.trace("#{log_tag}: process_queries: done") - return {} + if queries.nil? || queries.empty? + raise NoQuery.new end $log.trace("#{log_tag}: process_queries: sort: start") sorted_queries = QuerySorter.sort(queries) -------------- next part -------------- HTML����������������������������... Download