public function testCleanAndCommit()
 {
     $testTitle = "Ipsum Lorem Vehicula";
     $nodeSource = Kernel::getService('em')->getRepository('GeneratedNodeSources\\NSPage')->findOneBy(array('title' => $testTitle));
     if (null !== $nodeSource) {
         try {
             $solrDoc = new SolariumNodeSource($nodeSource, Kernel::getService('solr'));
             $solrDoc->cleanAndCommit();
             $this->assertFalse($solrDoc->getDocumentFromIndex());
         } catch (SolrServerNotAvailableException $e) {
         } catch (HttpException $e) {
             return;
         }
     }
 }
Exemplo n.º 2
0
 /**
  * Update or create solr documents for each Node sources.
  *
  * @param  FilterNodesSourcesEvent $event
  */
 public function onSolariumNodeUpdate(FilterNodeEvent $event)
 {
     if (null !== $this->solr) {
         foreach ($event->getNode()->getNodeSources() as $nodeSource) {
             $solrSource = new SolariumNodeSource($nodeSource, $this->solr);
             $solrSource->getDocumentFromIndex();
             $solrSource->updateAndCommit();
         }
     }
 }