lib/ddr/index/response.rb in ddr-models-2.4.12 vs lib/ddr/index/response.rb in ddr-models-2.4.13
- old
+ new
@@ -1,13 +1,30 @@
+require "delegate"
+
module Ddr::Index
+ #
+ # Wraps an index query response
+ #
class Response < SimpleDelegator
def docs
- self["response"]["docs"]
+ response["docs"]
end
def num_found
- self["response"]["numFound"].to_i
+ response["numFound"].to_i
+ end
+
+ def facet_counts
+ self["facet_counts"] || {}
+ end
+
+ def facet_fields
+ facet_counts["facet_fields"] || {}
+ end
+
+ def response
+ self["response"]
end
end
end