spice 0.8.0 → 1.0.0.pre

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,23 +0,0 @@
1
- module Spice
2
- class Search < Spice::Chef
3
- def self.search(index, options={})
4
- options = {:q => options} if options.is_a? String
5
- options.symbolize_keys!
6
-
7
- options[:q] ||= '*:*'
8
- options[:sort] ||= "X_CHEF_id_CHEF_X asc"
9
- options[:start] ||= 0
10
- options[:rows] ||= 1000
11
-
12
- # clean up options hash
13
- options.delete_if{|k,v| !%w(q sort start rows).include?(k.to_s)}
14
-
15
- params = options.collect{ |k, v| "#{k}=#{CGI::escape(v.to_s)}"}.join("&")
16
- connection.get("/search/#{CGI::escape(index.to_s)}?#{params}")
17
- end
18
-
19
- def self.method_missing(*args, &block)
20
- self.search(*args, &block)
21
- end
22
- end
23
- end