Sha256: e88a9661a21b3487bb1b711a050d2e68c9d5b3ab89717f1b944924ea25b3121a

Contents?: true

Size: 542 Bytes

Versions: 5

Compression:

Stored size: 542 Bytes

Contents

class ContentItemFieldType < FieldType
  attr_accessor :content_item_id

  def data=(data_hash)
    @content_item_id = data_hash.deep_symbolize_keys[:content_item_id]
  end

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

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

  private

  def mapping_field_name
    "#{field_name.parameterize(separator: '_')}_content_item"
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cortex-plugins-core-2.0.1 app/models/content_item_field_type.rb
cortex-plugins-core-1.1.1 app/models/content_item_field_type.rb
cortex-plugins-core-1.1.0 app/models/content_item_field_type.rb
cortex-plugins-core-1.0.0 app/models/content_item_field_type.rb
cortex-plugins-core-0.12.4 app/models/content_item_field_type.rb