mirror of
https://github.com/Codappix/search_core.git
synced 2024-11-22 15:16:12 +01:00
BUGFIX: Handle non available records during indexing
* E.g. a hidden record is edited.
This commit is contained in:
parent
1878209b51
commit
d358714d0d
1 changed files with 13 additions and 1 deletions
|
@ -82,7 +82,11 @@ class TcaIndexer implements IndexerInterface
|
|||
public function indexDocument($identifier)
|
||||
{
|
||||
$this->logger->info('Start indexing single record.', [$identifier]);
|
||||
try {
|
||||
$this->connection->addDocument($this->tcaTableService->getTableName(), $this->getRecord($identifier));
|
||||
} catch (NoRecordFoundException $e) {
|
||||
$this->logger->info('Could not index document.', [$e->getMessage()]);
|
||||
}
|
||||
$this->logger->info('Finish indexing');
|
||||
}
|
||||
|
||||
|
@ -128,6 +132,7 @@ class TcaIndexer implements IndexerInterface
|
|||
/**
|
||||
* @param int $identifier
|
||||
* @return array
|
||||
* @throws NoRecordFoundException If record could not be found.
|
||||
*/
|
||||
protected function getRecord($identifier)
|
||||
{
|
||||
|
@ -137,6 +142,13 @@ class TcaIndexer implements IndexerInterface
|
|||
$this->tcaTableService->getWhereClause()
|
||||
. ' AND ' . $this->tcaTableService->getTableName() . '.uid = ' . (int) $identifier
|
||||
);
|
||||
|
||||
if ($record === false) {
|
||||
throw new NoRecordFoundException(
|
||||
'Record could not be fetched from database: "' . $identifier . '". Perhaps record is not active.',
|
||||
1484225364
|
||||
);
|
||||
}
|
||||
$this->tcaTableService->prepareRecord($record);
|
||||
|
||||
return $record;
|
||||
|
|
Loading…
Reference in a new issue