diff --git a/Classes/Command/IndexCommand.php b/Classes/Command/IndexCommand.php index 42449a7..6302693 100644 --- a/Classes/Command/IndexCommand.php +++ b/Classes/Command/IndexCommand.php @@ -4,6 +4,7 @@ use Elastic\Elasticsearch\Client; use Illuminate\Support\Collection; +use Illuminate\Support\Str; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -787,16 +788,30 @@ protected function fetchObjects(): void if ($name == 'published_item') { $qb->where( - $eb->notLike('mvdb_id', $qb->createNamedParameter('AA%')) + $eb->notLike('mvdb_id', $qb->createNamedParameter('AA%')), + $eb->eq('final', 2) ); } $data = $qb->execute()->fetchAll(); + if ($name == 'person') { + $data = Collection::wrap($data)-> + map(function ($person) { return self::removeSortingSymbols($person); }); + } $this->dataObjects[$name] = $data; } } + protected static function removeSortingSymbols(array $person): array + { + $name = Str::of($person['name'])-> + replace('˜', '')-> + replace('œ', ''); + $person['name'] = $name; + return $person; + } + /** * Executes an indexing sequence * @@ -861,7 +876,9 @@ protected function index(array $config, array $bufferedObject = null): array foreach($mmObjects as $object) { $subKey = $object[$subKeyField]; $superKey = $object[$superKeyField]; - $indexedObjects[$superKey][] = isset($subDataObjects[$subKey][0]) ? $subDataObjects[$subKey][0] : null; + if (isset($subDataObjects[$subKey][0])) { + $indexedObjects[$superKey][] = $subDataObjects[$subKey][0]; + } } } else { $subDataObjects = $bufferedObject ?? $this->dataObjects[$config['subObject']]; diff --git a/composer.json b/composer.json index da2a87f..77e77f1 100755 --- a/composer.json +++ b/composer.json @@ -14,7 +14,8 @@ "elasticsearch/elasticsearch": "^8", "slub/dm-ont": "@dev", "fluidtypo3/vhs": "^6", - "illuminate/collections": "^8" + "illuminate/collections": "^8", + "illuminate/support": "^8" }, "config": { "allow-plugins": {