src/Search/Framework/Collector.php
public function queueCollection(CollectionAbstract $collection)
    {
        $log = $this->getLogger();
        $context = array('collection' => $collection->getId());
        $log->info('Begin fetching items that are scheduled for indexing', $context);

        $event = new CollectionEvent($this, $collection);
        $this->dispatchEvent(SearchEvents::COLLECTION_PRE_QUEUE, $event, $context);

        // The producer fetches the items scheduled for indexing from the
        // collection and publishes them to the indexing queue.
        $producer = new QueueProducer($this, $collection);
        foreach ($producer as $message) {
            // @todo Have this return a boolean suceess flag and modify the log
            // message accordingly?
            $message->publish();

            $context['item'] = $message->getBody();
            $log->debug('Published item scheduled for indexing to queue', $context);
        }

        unset($context['item']); // The item is no longer in context.
        $this->dispatchEvent(SearchEvents::COLLECTION_POST_QUEUE, $event, $context);

        // Get and log the number of items queued for this collection.
        $num_queued = count($producer);
        $context['queued'] = $num_queued;
        $log->info('Finished fetching and queueing items that are scheduled for indexing', $context);

        return $num_queued;
    }
public function queueCollection(CollectionAbstract $collection)
    {
        $log = $this->getLogger();
        $context = array('collection' => $collection->getId());
        $log->info('Begin fetching items that are scheduled for indexing', $context);

        $event = new CollectionEvent($this, $collection);
        $this->dispatchEvent(SearchEvents::COLLECTION_PRE_QUEUE, $event, $context);

        // The producer fetches the items scheduled for indexing from the
        // collection and publishes them to the indexing queue.
        $producer = new QueueProducer($this, $collection);
        foreach ($producer as $message) {
            // @todo Have this return a boolean suceess flag and modify the log
            // message accordingly?
            $message->publish();

            $context['item'] = $message->getBody();
            $log->debug('Published item scheduled for indexing to queue', $context);
        }

        unset($context['item']); // The item is no longer in context.
        $this->dispatchEvent(SearchEvents::COLLECTION_POST_QUEUE, $event, $context);

        // Get and log the number of items queued for this collection.
        $num_queued = count($producer);
        $context['queued'] = $num_queued;
        $log->info('Finished fetching and queueing items that are scheduled for indexing', $context);

        return $num_queued;
    }
public function queueCollection ( CollectionAbstract $ collection ) { $ log = $ this -> getLogger ( ) ; $ context = array ( 'collection' => $ collection -> getId ( ) ) ; $ log -> info ( 'Begin fetching items that are scheduled for indexing' , $ context ) ; $ event = new CollectionEvent ( $ this , $ collection ) ; $ this -> dispatchEvent ( SearchEvents :: COLLECTION_PRE_QUEUE , $ event , $ context ) ; // The producer fetches the items scheduled for indexing from the // collection and publishes them to the indexing queue. $ producer = new QueueProducer ( $ this , $ collection ) ; foreach ( $ producer as $ message ) { // @todo Have this return a boolean suceess flag and modify the log // message accordingly? $ message -> publish ( ) ; $ context [ 'item' ] = $ message -> getBody ( ) ; $ log -> debug ( 'Published item scheduled for indexing to queue' , $ context ) ; } unset ( $ context [ 'item' ] ) ; // The item is no longer in context. $ this -> dispatchEvent ( SearchEvents :: COLLECTION_POST_QUEUE , $ event , $ context ) ; // Get and log the number of items queued for this collection. $ num_queued = count ( $ producer ) ; $ context [ 'queued' ] = $ num_queued ; $ log -> info ( 'Finished fetching and queueing items that are scheduled for indexing' , $ context ) ; return $ num_queued ; }
Queues the items scheduled for indexing for the collection.

@param CollectionAbstract $collection
The collection that fetches the items scheduled for indexing.

@return int
The number of items sent to the queue.
Queues the items scheduled for indexing for the collection .