class MarkLogic::DatabaseSettings::RangeElementIndex

Attributes

collation[RW]
facet[RW]
invalid_values[RW]
localname[RW]
namespace_uri[RW]
range_value_positions[RW]
scalar_type[RW]

Public Class Methods

from_json(json) click to toggle source
# File lib/marklogic/database_settings/range_element_index.rb, line 60
def self.from_json(json)
  index = allocate
  index.from_json(json)
  index
end
new(name, options = {}) click to toggle source
# File lib/marklogic/database_settings/range_element_index.rb, line 7
def initialize(name, options = {})
  @scalar_type = options[:type] || 'string'
  @localname = name.to_s
  @namespace_uri = options[:namespace] || ""
  @collation = options[:collation] || (@scalar_type == 'string' ? MarkLogic::DEFAULT_COLLATION : "")
  @range_value_positions = options[:range_value_positions] || false
  @invalid_values = options[:invalid_values] || MarkLogic::REJECT
  @facet = options[:facet] || false
end

Public Instance Methods

<=>(other) click to toggle source
# File lib/marklogic/database_settings/range_element_index.rb, line 21
def <=>(other)
  localname <=> other.localname
end
==(other) click to toggle source
# File lib/marklogic/database_settings/range_element_index.rb, line 25
def ==(other)
  self.class == other.class and
  scalar_type == other.scalar_type and
  localname = other.localname and
  namespace_uri = other.namespace_uri and
  collation == other.collation and
  range_value_positions == other.range_value_positions and
  invalid_values == other.invalid_values
end
append_to_db(database) click to toggle source
# File lib/marklogic/database_settings/range_element_index.rb, line 39
def append_to_db(database)
  database.add_index("range-element-index", self)
end
from_json(json) click to toggle source
# File lib/marklogic/database_settings/range_element_index.rb, line 66
def from_json(json)
  @scalar_type = json['scalar-type']
  @namespace_uri = json['namespace-uri']
  @localname = json['localname']
  @collation = json['collation']
  @range_value_positions = json['range-value-positions']
  @invalid_values = json['invalid-values']
  @facet = false
end
key() click to toggle source
# File lib/marklogic/database_settings/range_element_index.rb, line 17
def key
  %Q{#{self.class.to_s}-#{@localname}}
end
to_json(options = nil) click to toggle source
# File lib/marklogic/database_settings/range_element_index.rb, line 43
def to_json(options = nil)
  {
    "scalar-type" => @scalar_type,
    "namespace-uri" => @namespace_uri,
    "localname" => @localname,
    "collation" => @collation,
    "range-value-positions" => @range_value_positions,
    "invalid-values" => @invalid_values
  }
end
to_ref() click to toggle source
# File lib/marklogic/database_settings/range_element_index.rb, line 54
def to_ref
  options = [%Q{"type=#{@scalar_type}"}]
  options << %Q{"collation=#{@collation}"} if @scalar_type == "string"
  %Q{cts:json-property-reference("#{@localname}", (#{options.join(',')}))}
end
type() click to toggle source
# File lib/marklogic/database_settings/range_element_index.rb, line 35
def type
  "range-element-index"
end