Permalink
Browse files

Handling total result count 0 when empty response

  • Loading branch information...
1 parent 6a1cd1d commit 551bec74149eb0ac3101429b1acc8834b47445b1 @gabriel committed Nov 29, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/swiftype/result_set.rb
@@ -1,7 +1,7 @@
module Swiftype
class ResultSet
attr_accessor :records, :info
-
+
def initialize(results)
@records = {}
results['records'].each do |document_type, documents|
@@ -35,7 +35,7 @@ def num_pages(document_type=nil)
end
def total_result_count(document_type)
- info[document_type]['total_result_count']
+ info[document_type] ? info[document_type]['total_result_count'] : 0
end
def query

0 comments on commit 551bec7

Please sign in to comment.