diff options
author | Noah Kantrowitz <noah@coderanger.net> | 2017-03-20 15:56:01 -0700 |
---|---|---|
committer | Noah Kantrowitz <noah@coderanger.net> | 2017-03-20 15:56:01 -0700 |
commit | d648136085c4061eaefa04ad823c49a14282a749 (patch) | |
tree | e517a8435e25767790c6b84e05c8afd9cf136d96 /lib/chef/search | |
parent | 472f0145f7a6b5044ef74ac153abe95cf54a8f9d (diff) | |
download | chef-d648136085c4061eaefa04ad823c49a14282a749.tar.gz |
Remove support for the sort option to searches.
Signed-off-by: Noah Kantrowitz <noah@coderanger.net>
Diffstat (limited to 'lib/chef/search')
-rw-r--r-- | lib/chef/search/query.rb | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/chef/search/query.rb b/lib/chef/search/query.rb index fb77238ced..7357dbf6be 100644 --- a/lib/chef/search/query.rb +++ b/lib/chef/search/query.rb @@ -106,10 +106,12 @@ class Chef return args.first if args.first.is_a?(Hash) args_h = Hash.new - args_h[:sort] = args[0] if args[0] - args_h[:start] = args[1] if args[1] - args_h[:rows] = args[2] - args_h[:filter_result] = args[3] + # If we have 4 arguments, the first is the now-removed sort option, so + # just ignore it. + args.pop(0) if args.length == 4 + args_h[:start] = args[0] if args[0] + args_h[:rows] = args[1] + args_h[:filter_result] = args[2] args_h end @@ -119,16 +121,15 @@ class Chef s && Addressable::URI.encode_component(s.to_s, QUERY_PARAM_VALUE) end - def create_query_string(type, query, rows, start, sort) + def create_query_string(type, query, rows, start) qstr = "search/#{type}?q=#{escape_value(query)}" - qstr += "&sort=#{escape_value(sort)}" if sort qstr += "&start=#{escape_value(start)}" if start qstr += "&rows=#{escape_value(rows)}" if rows qstr end - def call_rest_service(type, query: "*:*", rows: nil, start: 0, sort: "X_CHEF_id_CHEF_X asc", filter_result: nil) - query_string = create_query_string(type, query, rows, start, sort) + def call_rest_service(type, query: "*:*", rows: nil, start: 0, filter_result: nil) + query_string = create_query_string(type, query, rows, start) if filter_result response = rest.post(query_string, filter_result) |