Class: SimpleSolrClient::Schema::DynamicField

Inherits:
Field show all
Defined in:
lib/simple_solr_client/schema/dynamic_field.rb

Constant Summary

Constants inherited from Field_or_Type

Field_or_Type::BOOL_ATTR_MAP, Field_or_Type::TEXT_ATTR_MAP

Instance Attribute Summary

Attributes inherited from Field

#matcher, #type, #type_name

Attributes inherited from Field_or_Type

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

Instance Method Summary collapse

Methods inherited from Field

#name=, #resolve_type

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) ⇒ DynamicField

Returns a new instance of DynamicField.



5
6
7
8
# File 'lib/simple_solr_client/schema/dynamic_field.rb', line 5

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

Instance Method Details

#dynamic_name(s) ⇒ Object

What name will we get from a matching thing?



15
16
17
18
19
20
# File 'lib/simple_solr_client/schema/dynamic_field.rb', line 15

def dynamic_name(s)
  m = @matcher.match(s)
  if m
    m[1] << m[2]
  end
end

#xml_node(doc) ⇒ Object



10
11
12
# File 'lib/simple_solr_client/schema/dynamic_field.rb', line 10

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