Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Handling total result count 0 when empty response

  • Loading branch information...
commit 551bec74149eb0ac3101429b1acc8834b47445b1 1 parent 6a1cd1d
@gabriel authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/swiftype/result_set.rb
View
4 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
Please sign in to comment.
Something went wrong with that request. Please try again.