Class: TagFieldType
- Inherits:
-
Cortex::FieldType
- Object
- Cortex::FieldType
- TagFieldType
- Defined in:
- app/models/tag_field_type.rb
Instance Attribute Summary collapse
-
#tag_list ⇒ Object
Returns the value of attribute tag_list.
Instance Method Summary collapse
- #data=(data_hash) ⇒ Object
- #elasticsearch_mapping ⇒ Object
- #field_item_as_indexed_json_for_field_type(field_item, options = {}) ⇒ Object
Instance Attribute Details
#tag_list ⇒ Object
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_mapping ⇒ Object
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, = {}) json = {} json[mapping_field_name] = tag_list_to_a field_item.data['tag_list'] json end |