<commit_before>module NewsSearch
  extend ActiveSupport::Concern

  module ClassMethods

    def index_mappings
      {
          news: {
              _parent: { type: 'parent_project' },
              _routing: { required: true, path: 'route_key' },
              properties: news_mappings_hash
          }
      }
    end

    def news_mappings_hash
      {
          id: { type: 'integer' },
          project_id: { type: 'integer', index: 'not_analyzed' },
          title: { type: 'string' },
          summary: { type: 'string' },
          description: { type: 'string' },
          author: { type: 'string' },
          created_on: { type: 'date' },
          comments_count: { type: 'integer', index: 'not_analyzed' },
          route_key: { type: 'string', not_analyzed: true }
      }.merge(additional_index_mappings)<commit_msg>mapping acts_as_event fields for news<commit_after>module NewsSearch
  extend ActiveSupport::Concern

  module ClassMethods

    def index_mappings
      {
          news: {
              _parent: { type: 'parent_project' },
              _routing: { required: true, path: 'route_key' },
              properties: news_mappings_hash
          }
      }
    end

    def news_mappings_hash
      {
          id: { type: 'integer' },
          project_id: { type: 'integer', index: 'not_analyzed' },

          # acts_as_event fields
          created_on: { type: 'date', index_name: 'datetime' },
          title: { type: 'string' },
          description: { type: 'string' },
          author: { type: 'string' },
          url: { type: 'string' },
          type: { type: 'string', index: 'not_analyzed' },

          summary: { type: 'string' },
          created_on: { type: 'date' },
          comments_count: { type: 'integer', index: 'not_analyzed' },
          route_key: { type: 'string', not_analyzed: true }
      }.merge(additional_index_mappings)
{'fraction_non_alphanumeric': 0.1253291205897841, 'fraction_numerical': 0.0, 'mean_word_length': 2.04, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2942561', 'n_tokens_mistral': 568, 'n_tokens_neox': 554, 'n_words': 130}