Class: TextFieldType
- Inherits:
-
Cortex::FieldType
- Object
- Cortex::FieldType
- TextFieldType
- Defined in:
- app/models/text_field_type.rb
Constant Summary collapse
- PRIMARY_DATA_KEY =
'text'.freeze
Instance Attribute Summary collapse
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
- #data=(data_hash) ⇒ Object
- #elasticsearch_mapping ⇒ Object
- #field_item_as_indexed_json_for_field_type(field_item, options = {}) ⇒ Object
- #graphql_type ⇒ Object
- #graphql_value ⇒ Object
Instance Attribute Details
#text ⇒ Object
Returns the value of attribute text.
4 5 6 |
# File 'app/models/text_field_type.rb', line 4 def text @text end |
Instance Method Details
#data=(data_hash) ⇒ Object
23 24 25 |
# File 'app/models/text_field_type.rb', line 23 def data=(data_hash) @text = data_hash[PRIMARY_DATA_KEY] end |
#elasticsearch_mapping ⇒ Object
11 12 13 |
# File 'app/models/text_field_type.rb', line 11 def elasticsearch_mapping { name: mapping_field_name, type: :string, analyzer: :snowball } end |
#field_item_as_indexed_json_for_field_type(field_item, options = {}) ⇒ Object
27 28 29 30 31 |
# File 'app/models/text_field_type.rb', line 27 def field_item_as_indexed_json_for_field_type(field_item, = {}) json = {} json[mapping_field_name] = field_item.data[PRIMARY_DATA_KEY] json end |
#graphql_type ⇒ Object
19 20 21 |
# File 'app/models/text_field_type.rb', line 19 def graphql_type types.String end |
#graphql_value ⇒ Object
15 16 17 |
# File 'app/models/text_field_type.rb', line 15 def graphql_value text end |