Class: TagFieldType

Inherits:
Cortex::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



10
11
12
# File 'app/models/tag_field_type.rb', line 10

def data=(data_hash)
  @tag_list = tag_list_to_a data_hash['tag_list']
end

#elasticsearch_mappingObject



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

def elasticsearch_mapping
  { name: mapping_field_name, analyzer: :keyword }
end

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



14
15
16
17
18
# File 'app/models/tag_field_type.rb', line 14

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