class Dilute::Attribute

Attributes

options[R]

Public Class Methods

new(options = {}) click to toggle source
# File lib/dilute/attribute.rb, line 5
def initialize(options = {})
  @options = HashWithIndifferentAccess.new.merge(options)
end

Public Instance Methods

not_indexed() click to toggle source
# File lib/dilute/attribute.rb, line 19
def not_indexed
  index("not_analyzed")
end
to_config() click to toggle source
# File lib/dilute/attribute.rb, line 23
def to_config
  options
end

Private Instance Methods

acceptable_mapping_options() click to toggle source
# File lib/dilute/attribute.rb, line 45
def acceptable_mapping_options
  {
    string: %w(index_name store index term_vector boost null_value omit_norms omit_term_freq_and_positions index_options analyzer index_analyzer search_analyzer include_in_all ignore_above position_offset_gap),
    number: %w(type index_name store index precision_step boost null_value include_in_all ignore_malformed),
    date: %w(index_name format store index precision_step boost null_value include_in_all ignore_malformed),
    boolean: %w(index_name store index boost null_value include_in_all),
    binary: %w(index_name)
  }
end
chain_add(hsh) click to toggle source
# File lib/dilute/attribute.rb, line 29
def chain_add(hsh)
  # self.class.new(options.merge(hsh))
  options.merge!(hsh)
  self
end
type(new_val = nil) click to toggle source
# File lib/dilute/attribute.rb, line 35
def type(new_val = nil)
  new_val ? options[:type] = new_val.to_sym : options[:type].to_sym
end
type_mapping() click to toggle source
# File lib/dilute/attribute.rb, line 39
def type_mapping
  return :number if [:float, :double, :integer, :long, :short, :byte].include?(type)
  type
end