<commit_before><?php
/**
 * Phlexible
 *
 * PHP Version 5
 *
 * @category    Makeweb
 * @package     Makeweb_IndexerElements
 * @copyright   2010 brainbits GmbH (http://www.brainbits.net)
 */

/**
 * Elements Indexer Component
 *
 * @category    Makeweb
 * @package     Makeweb_IndexerElements
 * @author      <NAME> <<EMAIL>>
 * @copyright   2010 brainbits GmbH (http://www.brainbits.net)
 */
class Makeweb_IndexerElements_Component extends MWF_Component_Abstract
{
    /**
     * Constructor
     * Initialses the Component values
     */
    public function __construct()
    {
        $this->setVersion('0.7.1');
        $this->setId('indexerelements');
        $this->setFile(__FILE__);
        $this->setPackage('makeweb');
    }

    public function initContainer(MWF_Container_ContainerBuilder $container)
    {
        $container->addComponents(
            array(
                'indexerElementsIndexer' => array(
                    'class' => 'Makeweb_IndexerElements_Indexer',
                    'arguments' => array(
                        'dispatcher',
                        'indexerDocumentFactory',
                        'siterootManager',
                        'elementsTreeManager',
                        'elementsManager',
                        'elementsVersionManager',
                        'elementsContextmanager',
                        ':frontend.request.handler'
                    ),
                    'scope' => 'singleton',
                ),
                'indexerElementsTools' => array(
                    'class' => 'Makeweb_IndexerElements_Tools',
                    'arguments' => array(
                        'queueManager',
                        'indexerTools',
                        'indexerElementsIndexer',
                    ),
                    'scope' => 'singleton',
                ),
                'indexerElementsQueryEid' => array(
                    'class'     => 'Makeweb_IndexerElements_Query_Eid',
                    'arguments' => array('indexerQueryParser'),
                    'scope'     => 'prototype',
                ),
                // listener
                'indexerElementsListenerCreateDocument' => array(
                    'tag' => array(
                        'name' => 'event.listener',
                        'event' => MWF_Core_Indexer_Event::CREATE_DOCUMENT,
                        'callback' => array('Makeweb_IndexerElements_Callback', 'onCreateDocument'),
                    ),
                ),
                'indexerElementsListenerPublishNode' => array(
                    'tag' => array(
                        'name' => 'event.listener',
                        'event' => Makeweb_Elements_Event::PUBLISH_NODE,
                        'callback' => array('Makeweb_IndexerElements_Callback', 'onPublishNode'),
                    ),
                ),
                'indexerElementsListenerUpdateNode' => array(
                    'tag' => array(
                        'name' => 'event.listener',
                        'event' => Makeweb_Elements_Event::UPDATE_NODE,
                        'callback' => array('Makeweb_IndexerElements_Callback', 'onUpdateNode'),
                    ),
                ),
                'indexerElementsListenerMoveNode' => array(
                    'tag' => array(
                        'name' => 'event.listener',
                        'event' => Makeweb_Elements_Event::MOVE_NODE,
                        'callback' => array('Makeweb_IndexerElements_Callback', 'onMoveNode'),
                    ),
                ),
                'indexerElementsListenerSetNodeOffline' => array(
                    'tag' => array(
                        'name' => 'event.listener',
                        'event' => Makeweb_Elements_Event::SET_NODE_OFFLINE,
                        'callback' => array('Makeweb_IndexerElements_Callback', 'onMoveNode'),
                    ),
                ),
                'indexerElementsListenerDeleteNode' => array(
                    'tag' => array(
                        'name' => 'event.listener',
                        'event' => Makeweb_Elements_Event::DELETE_NODE,
                        'callback' => array('Makeweb_IndexerElements_Callback', 'onDeleteNode'),
                    ),
                ),
            )
        );
    }

    public function getIndexerSearches()
    {
        return array('indexer-elements-query-eid' => 'indexerElementsQueryEid');
    }

    public function getIndexers()
    {
        return array('elements' => 'indexerElementsIndexer');
    }

    public function getSiterootProperties()
    {
        // @TODO: implement skip/boost for unique IDs

        return array(
            'indexer.elements.enabled',
            'indexer.elements.skip.restricted',
            'indexer.elements.skip.elementtypeids',
            'indexer.elements.skip.tids',
            'indexer.elements.boost.elementtypeids',
            'indexer.elements.boost.tids',
        );
    }
}
<commit_msg>component fix<commit_after><?php
/**
 * Phlexible
 *
 * PHP Version 5
 *
 * @category    Makeweb
 * @package     Makeweb_IndexerElements
 * @copyright   2010 brainbits GmbH (http://www.brainbits.net)
 */

/**
 * Elements Indexer Component
 *
 * @category    Makeweb
 * @package     Makeweb_IndexerElements
 * @author      <NAME> <<EMAIL>>
 * @copyright   2010 brainbits GmbH (http://www.brainbits.net)
 */
class Makeweb_IndexerElements_Component extends MWF_Component_Abstract
{
    /**
     * Constructor
     * Initialses the Component values
     */
    public function __construct()
    {
        $this
            ->setVersion('0.7.1')
            ->setId('indexerelements')
            ->setFile(__FILE__)
            ->setPackage('makeweb');
    }

    public function initContainer(MWF_Container_ContainerBuilder $container)
    {
        $container->addComponents(
            array(
                'indexerElementsIndexer' => array(
                    'class' => 'Makeweb_IndexerElements_Indexer',
                    'arguments' => array(
                        'dispatcher',
                        'indexerDocumentFactory',
                        'siterootManager',
                        'elementsTreeManager',
                        'elementsManager',
                        'elementsVersionManager',
                        'elementsContextmanager',
                        ':frontend.request.handler'
                    ),
                    'scope' => 'singleton',
                    'tag'   => 'indexer.indexer',
                ),
                'indexerElementsTools' => array(
                    'class' => 'Makeweb_IndexerElements_Tools',
                    'arguments' => array(
                        'queueManager',
                        'indexerTools',
                        'indexerElementsIndexer',
                    ),
                    'scope' => 'singleton',
                ),
                'indexerElementsQueryEid' => array(
                    'class'     => 'Makeweb_IndexerElements_Query_Eid',
                    'arguments' => array('indexerQueryParser'),
                    'scope'     => 'prototype',
                    'tag'       => 'indexer.search',
                ),
                // listener
                'indexerElementsListenerCreateDocument' => array(
                    'tag' => array(
                        'name' => 'event.listener',
                        'event' => MWF_Core_Indexer_Event::CREATE_DOCUMENT,
                        'callback' => array('Makeweb_IndexerElements_Callback', 'onCreateDocument'),
                    ),
                ),
                'indexerElementsListenerPublishNode' => array(
                    'tag' => array(
                        'name' => 'event.listener',
                        'event' => Makeweb_Elements_Event::PUBLISH_NODE,
                        'callback' => array('Makeweb_IndexerElements_Callback', 'onPublishNode'),
                    ),
                ),
                'indexerElementsListenerUpdateNode' => array(
                    'tag' => array(
                        'name' => 'event.listener',
                        'event' => Makeweb_Elements_Event::UPDATE_NODE,
                        'callback' => array('Makeweb_IndexerElements_Callback', 'onUpdateNode'),
                    ),
                ),
                'indexerElementsListenerMoveNode' => array(
                    'tag' => array(
                        'name' => 'event.listener',
                        'event' => Makeweb_Elements_Event::MOVE_NODE,
                        'callback' => array('Makeweb_IndexerElements_Callback', 'onMoveNode'),
                    ),
                ),
                'indexerElementsListenerSetNodeOffline' => array(
                    'tag' => array(
                        'name' => 'event.listener',
                        'event' => Makeweb_Elements_Event::SET_NODE_OFFLINE,
                        'callback' => array('Makeweb_IndexerElements_Callback', 'onMoveNode'),
                    ),
                ),
                'indexerElementsListenerDeleteNode' => array(
                    'tag' => array(
                        'name' => 'event.listener',
                        'event' => Makeweb_Elements_Event::DELETE_NODE,
                        'callback' => array('Makeweb_IndexerElements_Callback', 'onDeleteNode'),
                    ),
                ),
            )
        );
    }

    public function getSiterootProperties()
    {
        // @TODO: implement skip/boost for unique IDs

        return array(
            'indexer.elements.enabled',
            'indexer.elements.skip.restricted',
            'indexer.elements.skip.elementtypeids',
            'indexer.elements.skip.tids',
            'indexer.elements.boost.elementtypeids',
            'indexer.elements.boost.tids',
        );
    }
}

{'fraction_non_alphanumeric': 0.11029559621958576, 'fraction_numerical': 0.0024130303639654134, 'mean_word_length': 1.3459905660377358, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 107, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '1298160', 'n_tokens_mistral': 2499, 'n_tokens_neox': 2311, 'n_words': 358}