Class: LucidWorks::Field

Inherits:
Base
  • Object
show all
Includes:
FieldCommons
Defined in:
lib/lucid_works/field.rb

Constant Summary

Constants included from Utils::BoolConverter

Utils::BoolConverter::FALSE_VALUES, Utils::BoolConverter::TRUE_VALUES

Class Attribute Summary collapse

Attributes inherited from Base

#attributes, #id, #parent, #persisted, #raw_response, #response_data

Class Method Summary collapse

Instance Method Summary collapse

Methods included from FieldCommons

#convert_indexing_options_to_term_freq_and_pos, #indexing_options, #indexing_options=, #t_field_type

Methods inherited from Base

all, #collection_url, create, #destroy, extract_parent_from_options, find, first, human_attribute_value, #human_attribute_value, #inspect, last, #member_url, #persisted?, #read_attribute_for_validation, #save, schema, singleton_name, to_select

Methods included from SimpleNaming

#model_name

Methods included from Utils::BoolConverter

#to_bool

Constructor Details

#initialize(options) ⇒ Field

Returns a new instance of Field.



55
56
57
# File 'lib/lucid_works/field.rb', line 55

def initialize(options)
  super(options.reverse_merge(:short_field_boost => 'high'))
end

Class Attribute Details

.include_dynamicObject

Returns the value of attribute include_dynamic.



9
10
11
# File 'lib/lucid_works/field.rb', line 9

def include_dynamic
  @include_dynamic
end

Class Method Details

.collection_url(parent) ⇒ Object



11
12
13
# File 'lib/lucid_works/field.rb', line 11

def collection_url(parent)
  include_dynamic ? "#{super}?include_dynamic=true" : super
end

.member_url(parent, id = nil) ⇒ Object



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

def member_url(parent, id = nil)
  include_dynamic ? "#{super}?include_dynamic=true" : super
end

Instance Method Details

#dynamically_generatedObject Also known as: dynamically_generated?



59
60
61
# File 'lib/lucid_works/field.rb', line 59

def dynamically_generated
  !dynamic_base.blank?
end

#update_attributes(attrs) ⇒ Object



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/lucid_works/field.rb', line 64

def update_attributes(attrs)
  attrs = attrs.with_indifferent_access
  if [false, '0'].include?(attrs[:stored]) 
    attrs[:include_in_results] ||= false
    attrs[:highlight] ||= false
  end
  if [false, '0'].include?(attrs[:indexed])
    attrs[:facet] ||= false
    attrs[:synonym_expansion] ||= false
    attrs[:short_field_boost] ||= 'high'
    attrs[:search_by_default] ||= false
    attrs[:use_in_find_similar] ||= false
    attrs[:query_time_stopword_handling] ||= false
  end
  super(attrs)
end