<commit_before><?php

namespace Application\Bundle\FrontBundle\SphinxSearch;

use Doctrine\ORM\EntityManager;

class SphinxFields
{

    private $indexFields = array();
    private $record = null;

    /**
     * 
     * @param EntityManager $entityManager
     * @param int $recordId
     * @return type
     */
    public function prepareFields(EntityManager $entityManager, $recordId, $recordTypeId)
    {

        if ($recordTypeId == 1) {
            $this->record = $entityManager->getRepository('ApplicationFrontBundle:AudioRecords')->findOneBy(array('id' => $recordId));
            $this->prepareAudioFields();
        } elseif ($recordTypeId == 2) {
            $this->record = $entityManager->getRepository('ApplicationFrontBundle:FilmRecords')->findOneBy(array('id' => $recordId));
            $this->prepareFilmFields();
        } else {
            $this->record = $entityManager->getRepository('ApplicationFrontBundle:VideoRecords')->findOneBy(array('id' => $recordId));
            $this->prepareVideoFields();
        }
//echo '<pre>';print_r($this->record);exit;
        $this->indexFields['id'] = $this->record->getRecord()->getId();
        $this->indexFields['s_title'] = ($this->record->getRecord()->getRecord()->getTitle()) ? $this->record->getRecord()->getTitle() : "";
        $this->indexFields['title'] = ($this->record->getRecord()->getTitle()) ? $this->record->getRecord()->getTitle() : "";
        $this->indexFields['s_description'] = ($this->record->getRecord()->getDescription()) ? $this->record->getRecord()->getDescription() : "";<commit_msg>inset records in shpinx while adding new records<commit_after><?php

namespace Application\Bundle\FrontBundle\SphinxSearch;

use Doctrine\ORM\EntityManager;

class SphinxFields
{

    private $indexFields = array();
    private $record = null;

    /**
     * 
     * @param EntityManager $entityManager
     * @param int $recordId
     * @return type
     */
    public function prepareFields(EntityManager $entityManager, $recordId, $recordTypeId)
    {

        if ($recordTypeId == 1) {
            $this->record = $entityManager->getRepository('ApplicationFrontBundle:AudioRecords')->findOneBy(array('id' => $recordId));
            $this->prepareAudioFields();
        } elseif ($recordTypeId == 2) {
            $this->record = $entityManager->getRepository('ApplicationFrontBundle:FilmRecords')->findOneBy(array('id' => $recordId));
            $this->prepareFilmFields();
        } else {
            $this->record = $entityManager->getRepository('ApplicationFrontBundle:VideoRecords')->findOneBy(array('id' => $recordId));
            $this->prepareVideoFields();
        }
echo '<pre>';print_r($this->record);exit;
        $this->indexFields['id'] = $this->record->getRecord()->getId();
        $this->indexFields['s_title'] = ($this->record->getRecord()->getRecord()->getTitle()) ? $this->record->getRecord()->getTitle() : "";
        $this->indexFields['title'] = ($this->record->getRecord()->getTitle()) ? $this->record->getRecord()->getTitle() : "";
        $this->indexFields['s_description'] = ($this->record->getRecord()->getDescription()) ? $this->record->getRecord()->getDescription() : "";
{'fraction_non_alphanumeric': 0.18638217759648573, 'fraction_numerical': 0.0012550988390335738, 'mean_word_length': 3.7724550898203595, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 89, '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': '677991', 'n_tokens_mistral': 890, 'n_tokens_neox': 878, 'n_words': 125}