lib/couchbase/scope.rb in couchbase-3.2.0 vs lib/couchbase/scope.rb in couchbase-3.3.0
- old
+ new
@@ -24,11 +24,11 @@
alias inspect to_s
# @param [Couchbase::Backend] backend
# @param [String] bucket_name name of the bucket
- # @param [String, :_default] scope_name name of the scope
+ # @param [String] scope_name name of the scope
def initialize(backend, bucket_name, scope_name)
@backend = backend
@bucket_name = bucket_name
@name = scope_name
end
@@ -79,11 +79,11 @@
metrics.warning_count = resp[:meta][:metrics][:warning_count]
end
end
res[:warnings] = resp[:warnings].map { |warn| Cluster::QueryWarning.new(warn[:code], warn[:message]) } if resp[:warnings]
end
- res.instance_variable_set("@rows", resp[:rows])
+ res.instance_variable_set(:@rows, resp[:rows])
end
end
# Performs an analytics query
#
@@ -119,11 +119,11 @@
metrics.processed_objects = resp[:meta][:metrics][:processed_objects]
end
end
res[:warnings] = resp[:warnings].map { |warn| Cluster::AnalyticsWarning.new(warn[:code], warn[:message]) } if resp[:warnings]
end
- res.instance_variable_set("@rows", resp[:rows])
+ res.instance_variable_set(:@rows, resp[:rows])
end
end
# Performs a Full Text Search (FTS) query
#
@@ -159,22 +159,24 @@
row.transcoder = options.transcoder
row.index = r[:index]
row.id = r[:id]
row.score = r[:score]
row.fragments = r[:fragments]
- row.locations = SearchRowLocations.new(
- r[:locations].map do |loc|
- SearchRowLocation.new do |location|
- location.field = loc[:field]
- location.term = loc[:term]
- location.position = loc[:position]
- location.start_offset = loc[:start_offset]
- location.end_offset = loc[:end_offset]
- location.array_positions = loc[:array_positions]
+ unless r[:locations].empty?
+ row.locations = SearchRowLocations.new(
+ r[:locations].map do |loc|
+ SearchRowLocation.new do |location|
+ location.field = loc[:field]
+ location.term = loc[:term]
+ location.position = loc[:position]
+ location.start_offset = loc[:start_offset]
+ location.end_offset = loc[:end_offset]
+ location.array_positions = loc[:array_positions]
+ end
end
- end
- )
- row.instance_variable_set("@fields", r[:fields])
+ )
+ end
+ row.instance_variable_set(:@fields, r[:fields])
row.explanation = JSON.parse(r[:explanation]) if r[:explanation]
end
end
if resp[:facets]
res.facets = resp[:facets].each_with_object({}) do |(k, v), o|