mirror of
https://github.com/Codappix/search_core.git
synced 2024-11-22 14:56: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)
|
public function indexDocument($identifier)
|
||||||
{
|
{
|
||||||
$this->logger->info('Start indexing single record.', [$identifier]);
|
$this->logger->info('Start indexing single record.', [$identifier]);
|
||||||
$this->connection->addDocument($this->tcaTableService->getTableName(), $this->getRecord($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');
|
$this->logger->info('Finish indexing');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,6 +132,7 @@ class TcaIndexer implements IndexerInterface
|
||||||
/**
|
/**
|
||||||
* @param int $identifier
|
* @param int $identifier
|
||||||
* @return array
|
* @return array
|
||||||
|
* @throws NoRecordFoundException If record could not be found.
|
||||||
*/
|
*/
|
||||||
protected function getRecord($identifier)
|
protected function getRecord($identifier)
|
||||||
{
|
{
|
||||||
|
@ -137,6 +142,13 @@ class TcaIndexer implements IndexerInterface
|
||||||
$this->tcaTableService->getWhereClause()
|
$this->tcaTableService->getWhereClause()
|
||||||
. ' AND ' . $this->tcaTableService->getTableName() . '.uid = ' . (int) $identifier
|
. ' 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);
|
$this->tcaTableService->prepareRecord($record);
|
||||||
|
|
||||||
return $record;
|
return $record;
|
||||||
|
|
Loading…
Reference in a new issue