mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-10 03:23:19 +00:00
Fix subdef path indexing
This commit is contained in:
@@ -16,6 +16,7 @@ use Alchemy\Phrasea\Core\Event\Collection\CollectionEvents;
|
||||
use Alchemy\Phrasea\Core\Event\Record\RecordDeletedEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Record\RecordEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Record\RecordEvents;
|
||||
use Alchemy\Phrasea\Core\Event\Record\RecordSubDefinitionCreatedEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Record\Structure\RecordStructureEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Record\Structure\RecordStructureEvents;
|
||||
use Alchemy\Phrasea\SearchEngine\Elastic\Indexer\RecordQueuer;
|
||||
@@ -67,6 +68,9 @@ class IndexerSubscriber implements EventSubscriberInterface
|
||||
|
||||
public function onRecordChange(RecordEvent $event)
|
||||
{
|
||||
if ($event instanceof RecordSubDefinitionCreatedEvent && $event->getSubDefinitionName() !== 'thumbnail') {
|
||||
return;
|
||||
}
|
||||
$record = $event->getRecord();
|
||||
$this->indexer->indexRecord($record);
|
||||
}
|
||||
|
@@ -75,6 +75,7 @@ class SubdefsJob extends AbstractJob
|
||||
$rs = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
$i = 0;
|
||||
foreach ($rs as $row) {
|
||||
if (!$this->isStarted()) {
|
||||
break;
|
||||
@@ -106,7 +107,14 @@ class SubdefsJob extends AbstractJob
|
||||
$stmt->closeCursor();
|
||||
|
||||
unset($record);
|
||||
$i++;
|
||||
|
||||
if ($i % 5 === 0) {
|
||||
$app['elasticsearch.indexer']->flushQueue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$app['elasticsearch.indexer']->flushQueue();
|
||||
}
|
||||
}
|
||||
|
@@ -29,7 +29,6 @@ use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use MediaVorus\MediaVorus;
|
||||
use Rhumsaa\Uuid\Uuid;
|
||||
use Alchemy\Phrasea\Status\StatusStructure;
|
||||
use Alchemy\Phrasea\Model\RecordInterface;
|
||||
use Symfony\Component\HttpFoundation\File\File as SymfoFile;
|
||||
use Alchemy\Phrasea\Core\PhraseaTokens;
|
||||
|
Reference in New Issue
Block a user