Class: MarkLogic::DatabaseSettings::RangePathIndex

Inherits:
Object
  • Object
show all
Defined in:
lib/marklogic/database_settings/range_path_index.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path_expression, options = {}) ⇒ RangePathIndex

Returns a new instance of RangePathIndex.


7
8
9
10
11
12
13
14
# File 'lib/marklogic/database_settings/range_path_index.rb', line 7

def initialize(path_expression, options = {})
  @scalar_type = options[:type] || MarkLogic::STRING
  @collation = options[:collation] || DEFAULT_COLLATION
  @path_expression = path_expression
  @range_value_positions = options[:range_value_positions] || false
  @invalid_values = options[:invalid_values] || MarkLogic::REJECT
  @facet = options[:facet] || false
end

Instance Attribute Details

#collationObject

Returns the value of attribute collation


5
6
7
# File 'lib/marklogic/database_settings/range_path_index.rb', line 5

def collation
  @collation
end

#facetObject

Returns the value of attribute facet


5
6
7
# File 'lib/marklogic/database_settings/range_path_index.rb', line 5

def facet
  @facet
end

#path_expressionObject

Returns the value of attribute path_expression


5
6
7
# File 'lib/marklogic/database_settings/range_path_index.rb', line 5

def path_expression
  @path_expression
end

#scalar_typeObject

Returns the value of attribute scalar_type


5
6
7
# File 'lib/marklogic/database_settings/range_path_index.rb', line 5

def scalar_type
  @scalar_type
end

Instance Method Details

#append_to_db(database) ⇒ Object


20
21
22
# File 'lib/marklogic/database_settings/range_path_index.rb', line 20

def append_to_db(database)
  database.add_index("range-path-index", self)
end

#keyObject


16
17
18
# File 'lib/marklogic/database_settings/range_path_index.rb', line 16

def key
  %Q{#{self.class.to_s}-#{@localname}}
end

#to_json(options = nil) ⇒ Object


24
25
26
27
28
29
30
31
32
33
34
# File 'lib/marklogic/database_settings/range_path_index.rb', line 24

def to_json(options = nil)
  {
    "range-path-index" => {
      "scalar-type" => @scalar_type,
      "collation" => @collation,
      "path-expression" => @path_expression,
      "range-value-positions" => @range_value_positions,
      "invalid-values" => @invalid_values
    }
  }
end