Method: Google::Cloud::Datastore::Entity#exclude_from_indexes!
- Defined in:
- lib/google/cloud/datastore/entity.rb
#exclude_from_indexes!(name, flag = nil) {|value| ... } ⇒ Object
Sets whether a property should be excluded from the Datastore indexes. Setting ‘true` will exclude the property from the indexes. Setting `false` will include the property on any applicable indexes. The default value is `false`. This is another way of saying that values are indexed by default.
If the property is multi-valued, each value in the list can be managed separately for exclusion from indexing. When you call this method for a multi-valued property, you can pass either a single boolean argument to be applied to all of the values, or an array that contains the boolean argument for each corresponding value in the property. For example, if a multi-valued property contains ‘[“a”, “b”]`, and only the value `“b”` should be indexed (meaning that `“a”`’ should be excluded), you should pass the array: ‘[true, false]`.
331 332 333 334 335 336 337 338 339 |
# File 'lib/google/cloud/datastore/entity.rb', line 331 def exclude_from_indexes! name, flag = nil, &block name = name.to_s flag = block if block_given? if flag.nil? @_exclude_indexes.delete name else @_exclude_indexes[name] = flag end end |