YUKI Hiroshi
null+****@clear*****
Mon Apr 28 19:04:48 JST 2014
YUKI Hiroshi 2014-04-28 19:04:48 +0900 (Mon, 28 Apr 2014) New Revision: d0ff25e0c4d426ae7819e8392e64a8869bad8943 https://github.com/droonga/droonga-engine/commit/d0ff25e0c4d426ae7819e8392e64a8869bad8943 Message: groonga: Convert "sortby" option Modified files: lib/droonga/plugins/groonga/select.rb Modified: lib/droonga/plugins/groonga/select.rb (+19 -2) =================================================================== --- lib/droonga/plugins/groonga/select.rb 2014-04-28 18:59:17 +0900 (29d5644) +++ lib/droonga/plugins/groonga/select.rb 2014-04-28 19:04:48 +0900 (80618bb) @@ -31,6 +31,20 @@ module Droonga offset = (select_request["offset"] || "0").to_i limit = (select_request["limit"] || "10").to_i + output_offset = offset + output_limit = limit + + sort_by = nil + sort_keys = (select_request["sortby"] || "").split(",") + unless sort_keys.empty? + sort_by = { + "keys" => sort_keys, + "offset" => offset, + "limit" => limit, + } + output_offset = 0 + end + search_request = { "queries" => { @result_name => { @@ -44,12 +58,15 @@ module Droonga "records", ], "attributes" => attributes, - "offset" => offset, - "limit" => limit, + "offset" => output_offset, + "limit" => output_limit, }, } } } + if sort_by + search_request["queries"][@result_name]["sortBy"] = sort_by + end condition = convert_condition(select_request) if condition -------------- next part -------------- HTML����������������������������...Download