lib/rsolr-ext/response.rb in rsolr-ext-0.11.2 vs lib/rsolr-ext/response.rb in rsolr-ext-0.12.0

- old
+ new

@@ -5,30 +5,36 @@ autoload :Spelling, 'rsolr-ext/response/spelling' class Base < Mash attr :original_hash + attr_reader :request_path, :request_params - def initialize hash + def initialize hash, handler, request_params super hash @original_hash = hash + @request_path, @request_params = request_path, request_params extend Response# if self['response'] extend Docs# if self['response'] and self['response']['docs'] extend Facets# if self['facet_counts'] extend Spelling# if self['spellcheck'] end def header self['responseHeader'] end + def rows + params[:rows].to_i + end + def params - header['params'] + (header and header['params']) ? header['params'] : request_params end def ok? - header['status'] == 0 + (header and header['status']) ? header['status'] == 0 : nil end def method_missing *args, &blk self.original_hash.send *args, &blk end @@ -41,10 +47,18 @@ self[:response] end # short cut to response['numFound'] def total - response[:numFound] + response[:numFound].to_s.to_i + end + + def total + response[:numFound].to_s.to_i + end + + def start + response[:start].to_s.to_i end end end \ No newline at end of file