<commit_before>module ActiveWorker
  module Behavior
    module HasRootObject

      def self.included(base)
        base.before_save :set_root_object
        base.belongs_to :root_object, :polymorphic => true
      end

      def root_owner
        nil
      end

      def get_root_object_id
        return root_object_id if root_object_id
        set_root_object
        root_object_id
      end

      def set_root_object
        return unless root_owner
        self.root_object_id = root_owner.get_root_object_id
        self.root_object_type = root_owner.root_object_type
        true
      end

    end
  end
end<commit_msg>[ryan, tim] added index to events<commit_after>module ActiveWorker
  module Behavior
    module HasRootObject

      def self.included(base)
        base.before_save :set_root_object
        base.belongs_to :root_object, :polymorphic => true
        base.index(:root_object_id => -1)
      end

      def root_owner
        nil
      end

      def get_root_object_id
        return root_object_id if root_object_id
        set_root_object
        root_object_id
      end

      def set_root_object
        return unless root_owner
        self.root_object_id = root_owner.get_root_object_id
        self.root_object_type = root_owner.root_object_type
        true
      end

    end
  end
end
{'fraction_non_alphanumeric': 0.03770739064856712, 'fraction_numerical': 0.0007541478129713424, 'mean_word_length': 2.2287104622871046, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '4545980', 'n_tokens_mistral': 415, 'n_tokens_neox': 396, 'n_words': 90}