Class: SimpleSolrClient::Schema::Field

Inherits:
Field_or_Type show all
Includes:
Matcher
Defined in:
lib/simple_solr/schema/field.rb

Direct Known Subclasses

DynamicField

Constant Summary

Constants inherited from Field_or_Type

SimpleSolrClient::Schema::Field_or_Type::BOOL_ATTR_MAP, SimpleSolrClient::Schema::Field_or_Type::TEXT_ATTR_MAP

Instance Attribute Summary collapse

Attributes inherited from Field_or_Type

#indexed, #multi, #name, #position_increment_gap, #precision_step, #sort_missing_last, #stored

Instance Method Summary collapse

Methods included from Matcher

#derive_matcher, #matches

Methods inherited from Field_or_Type

#==, #[], #[]=, new_from_solr_hash, #to_h, #to_xml_node

Constructor Details

#initialize(*args) ⇒ Field

Returns a new instance of Field.



10
11
12
13
# File 'lib/simple_solr/schema/field.rb', line 10

def initialize(*args)
  super
  @dynamic = false
end

Instance Attribute Details

#matcherObject (readonly)

Returns the value of attribute matcher.



7
8
9
# File 'lib/simple_solr/schema/field.rb', line 7

def matcher
  @matcher
end

#typeObject

Returns the value of attribute type.



6
7
8
# File 'lib/simple_solr/schema/field.rb', line 6

def type
  @type
end

#type_nameObject

Returns the value of attribute type_name.



6
7
8
# File 'lib/simple_solr/schema/field.rb', line 6

def type_name
  @type_name
end

Instance Method Details

#name=(n) ⇒ Object

When we reset the name, make sure to re-derive the matcher object



29
30
31
32
# File 'lib/simple_solr/schema/field.rb', line 29

def name=(n)
  @name    = n
  @matcher = derive_matcher(n)
end

#resolve_type(schema) ⇒ Object

We can only resolve the actual type in the presence of a particular schema



21
22
23
24
# File 'lib/simple_solr/schema/field.rb', line 21

def resolve_type(schema)
  self.type = schema.field_type(self.type_name)
  self
end

#xml_node(doc) ⇒ Object



15
16
17
# File 'lib/simple_solr/schema/field.rb', line 15

def xml_node(doc)
  Nokogiri::XML::Element.new('field', doc)
end