Class: Couchbase::Cluster::SearchRowLocations
- Inherits:
-
Object
- Object
- Couchbase::Cluster::SearchRowLocations
- Defined in:
- lib/couchbase/search_options.rb,
/Users/sergey.auseyau/code/couchbase-ruby-client/lib/couchbase/search_options.rb more...
Instance Method Summary collapse
-
#fields ⇒ Array<String>
Lists the fields in this location.
-
#get_all ⇒ Array<SearchRowLocation>
Lists all locations (any field, any term).
-
#get_for_field(name) ⇒ Array<SearchRowLocation>
Lists all locations for a given field (any term).
-
#get_for_field_and_term(name, term) ⇒ Array<SearchRowLocation>
Lists all locations for a given field and term.
-
#initialize(locations) ⇒ SearchRowLocations
constructor
A new instance of SearchRowLocations.
-
#terms ⇒ Array<String>
Lists all terms in this locations, considering all fields.
-
#terms_for_field(name) ⇒ Array<String>
Lists the terms for a given field.
Constructor Details
#initialize(locations) ⇒ SearchRowLocations
Returns a new instance of SearchRowLocations.
1279 1280 1281 1282 |
# File 'lib/couchbase/search_options.rb', line 1279 def initialize(locations) super() @locations = locations end |
Instance Method Details
#fields ⇒ Array<String>
Lists the fields in this location
1260 1261 1262 |
# File 'lib/couchbase/search_options.rb', line 1260 def fields @locations.map(&:field).uniq end |
#get_all ⇒ Array<SearchRowLocation>
Lists all locations (any field, any term)
1239 1240 1241 |
# File 'lib/couchbase/search_options.rb', line 1239 def get_all @locations end |
#get_for_field(name) ⇒ Array<SearchRowLocation>
Lists all locations for a given field (any term)
1246 1247 1248 |
# File 'lib/couchbase/search_options.rb', line 1246 def get_for_field(name) @locations.select { |location| location.field == name } end |
#get_for_field_and_term(name, term) ⇒ Array<SearchRowLocation>
Lists all locations for a given field and term
1253 1254 1255 |
# File 'lib/couchbase/search_options.rb', line 1253 def get_for_field_and_term(name, term) @locations.select { |location| location.field == name && location.term == term } end |
#terms ⇒ Array<String>
Lists all terms in this locations, considering all fields
1267 1268 1269 |
# File 'lib/couchbase/search_options.rb', line 1267 def terms @locations.map(&:term).uniq end |
#terms_for_field(name) ⇒ Array<String>
Lists the terms for a given field
1274 1275 1276 |
# File 'lib/couchbase/search_options.rb', line 1274 def terms_for_field(name) get_for_field(name).map(&:term).uniq end |