<commit_before><?php
namespace Witti\Phonarc\Message;
use Doctrine\ORM\Mapping\ClassMetadata;
use Witti\Phonarc\Context\PhonarcContext;

class Message {
  protected $id;
  protected $date_sent;
  protected $thread_md5;
  protected $subject;
  protected $from_email;
  protected $from_name;
  protected $thread_id;
  protected $parent_id;
  protected $body;
  protected $headers;

  public static function loadMetadata(ClassMetadata $metadata) {
    // Get the current context.
    $context = PhonarcContext::factory(PhonarcContext::CURRENT_CONTEXT);
    if (!isset($context)) {
      throw new \ErrorException("Phonarc requires a valid context prior to loading metadata.");
    }

    // Determine the prefix for the table.
    $prefix = $context->getConf('doctrine.prefix');

    // Build the metadata.
    $metadata->mapField(array(
      'id' => true,
      'fieldName' => 'id',
      'type' => 'integer'
    ));
    $metadata->mapField(array(
      'fieldName' => 'date_sent',
      'type' => 'datetime'
    ));
    $metadata->mapField(array(
      'fieldName' => 'thread_md5',
      'length' => 32,
    ));
    $metadata->mapField(array(
      'fieldName' => 'subject',
      'length' => 255,
    ));
    $metadata->mapField(array(
      'fieldName' => 'from_email',
      'length' => 255,
    ));
    $metadata->mapField(array(
      'fieldName' => 'from_name',
      'length' => 255,
    ));
    $metadata->mapField(array(
      'fieldName' => 'thread_id',
      'type' => 'integer'
    ));
    $metadata->mapField(array(
      'fieldName' => 'parent_id',
      'type' => 'integer'
    ));
    $metadata->mapField(array(
      'fieldName' => 'body',
      'type' => 'text'
    ));
    $metadata->mapField(array(
      'fieldName' => 'headers',
      'type' => 'object'
    ));
    $metadata->setPrimaryTable(array(
      'name' => $prefix . 'message',
      'indexes' => array(
        'subject' => array(
          'columns' => array(
            'subject',
          ),
        ),
        'date_sent' => array(
          'columns' => array(
            'date_sent',
          ),
        ),
        'thread_md5' => array(
          'columns' => array(
            'thread_md5',
          ),
        ),
      ),
      'uniqueConstraints' => array(),
    ));
  }

}<commit_msg>Store mhonarc-centric message and thread ids.<commit_after><?php
namespace Witti\Phonarc\Message;
use Doctrine\ORM\Mapping\ClassMetadata;
use Witti\Phonarc\Context\PhonarcContext;

class Message {
  protected $id;
  protected $date_sent;
  protected $mhonarc_thread;
  protected $mhonarc_message;
  protected $subject;
  protected $from_email;
  protected $from_name;
  protected $thread_id;
  protected $parent_id;
  protected $body;
  protected $headers;

  public static function loadMetadata(ClassMetadata $metadata) {
    // Get the current context.
    $context = PhonarcContext::factory(PhonarcContext::CURRENT_CONTEXT);
    if (!isset($context)) {
      throw new \ErrorException("Phonarc requires a valid context prior to loading metadata.");
    }

    // Determine the prefix for the table.
    $prefix = $context->getConf('doctrine.prefix');

    // Build the metadata.
    $metadata->mapField(array(
      'id' => true,
      'fieldName' => 'id',
      'type' => 'integer'
    ));
    $metadata->mapField(array(
      'fieldName' => 'date_sent',
      'type' => 'datetime'
    ));
    $metadata->mapField(array(
      'fieldName' => 'mhonarc_thread',
      'length' => 32,
    ));
    $metadata->mapField(array(
      'fieldName' => 'mhonarc_message',
      'length' => 16,
    ));
    $metadata->mapField(array(
      'fieldName' => 'subject',
      'length' => 255,
    ));
    $metadata->mapField(array(
      'fieldName' => 'from_email',
      'length' => 255,
    ));
    $metadata->mapField(array(
      'fieldName' => 'from_name',
      'length' => 255,
    ));
    $metadata->mapField(array(
      'fieldName' => 'thread_id',
      'type' => 'integer'
    ));
    $metadata->mapField(array(
      'fieldName' => 'parent_id',
      'type' => 'integer'
    ));
    $metadata->mapField(array(
      'fieldName' => 'body',
      'type' => 'text'
    ));
    $metadata->mapField(array(
      'fieldName' => 'headers',
      'type' => 'object'
    ));
    $metadata->setPrimaryTable(array(
      'name' => $prefix . 'message',
      'indexes' => array(
        'subject' => array(
          'columns' => array(
            'subject',
          ),
        ),
        'date_sent' => array(
          'columns' => array(
            'date_sent',
          ),
        ),
        'mhonarc_thread' => array(
          'columns' => array(
            'mhonarc_thread',
          ),
        ),
      ),
      'uniqueConstraints' => array(),
    ));
  }

}
{'fraction_non_alphanumeric': 0.16522655426765015, 'fraction_numerical': 0.005900948366701791, 'mean_word_length': 2.407035175879397, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 90, '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': '4788278', 'n_tokens_mistral': 1526, 'n_tokens_neox': 1495, 'n_words': 290}