Class: TagFieldType

Inherits:
FieldType
  • Object
show all
Defined in:
app/models/tag_field_type.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#tag_listObject

Returns the value of attribute tag_list.



2
3
4
# File 'app/models/tag_field_type.rb', line 2

def tag_list
  @tag_list
end

Instance Method Details

#data=(data_hash) ⇒ Object



6
7
8
9
# File 'app/models/tag_field_type.rb', line 6

def data=(data_hash)
  @tag_list = data_hash.deep_symbolize_keys[:tag_list]
  @tag_list.nil? ? nil : (@tag_list = @tag_list.split(","))
end

#field_item_as_indexed_json_for_field_type(field_item, options = {}) ⇒ Object



11
12
13
14
15
# File 'app/models/tag_field_type.rb', line 11

def field_item_as_indexed_json_for_field_type(field_item, options = {})
  json = {}
  json[mapping_field_name] = field_item.data['tag_list']
  json
end

#mappingObject



17
18
19
# File 'app/models/tag_field_type.rb', line 17

def mapping
  {name: mapping_field_name, type: :string, analyzer: :snowball}
end