Class: Solr::Field
- Inherits:
-
Object
- Object
- Solr::Field
- Defined in:
- lib/solr/field.rb
Constant Summary collapse
- VALID_PARAMS =
[:boost]
Instance Attribute Summary collapse
-
#boost ⇒ Object
Returns the value of attribute boost.
-
#name ⇒ Object
Returns the value of attribute name.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(params) ⇒ Field
constructor
Accepts an optional
:boost
parameter, used to boost the relevance of a particular field. - #to_xml ⇒ Object
Constructor Details
#initialize(params) ⇒ Field
Accepts an optional :boost
parameter, used to boost the relevance of a particular field.
23 24 25 26 27 28 29 |
# File 'lib/solr/field.rb', line 23 def initialize(params) @boost = params[:boost] name_key = (params.keys - VALID_PARAMS).first @name, @value = name_key.to_s, params[name_key] # Convert any Time values into UTC/XML schema format (which Solr requires). @value = @value.respond_to?(:utc) ? @value.utc.xmlschema : @value.to_s end |
Instance Attribute Details
#boost ⇒ Object
Returns the value of attribute boost.
20 21 22 |
# File 'lib/solr/field.rb', line 20 def boost @boost end |
#name ⇒ Object
Returns the value of attribute name.
18 19 20 |
# File 'lib/solr/field.rb', line 18 def name @name end |
#value ⇒ Object
Returns the value of attribute value.
19 20 21 |
# File 'lib/solr/field.rb', line 19 def value @value end |