index document even if hook preIndexDocument is not set

This commit is contained in:
Uwe Steinmann 2019-04-17 08:28:46 +02:00
parent e1bd6605aa
commit 43c15ff399

View File

@ -803,15 +803,16 @@ switch($command) {
$idoc = new $indexconf['IndexedDocument']($dms, $document, isset($settings->_converters['fulltext']) ? $settings->_converters['fulltext'] : null, false, $settings->_cmdTimeout);
$error = $idoc->getErrorMsg();
if(!$error) {
$ires = null;
if(isset($GLOBALS['SEEDDMS_HOOKS']['indexDocument'])) {
foreach($GLOBALS['SEEDDMS_HOOKS']['indexDocument'] as $hookObj) {
if (method_exists($hookObj, 'preIndexDocument')) {
if(false !== ($ires = $hookObj->preIndexDocument(null, $document, $idoc))) {
$ires = $index->addDocument($idoc);
}
$ires = $hookObj->preIndexDocument(null, $document, $idoc);
}
}
}
if(false !== $ires)
$ires = $index->addDocument($idoc);
header('Content-Type: application/json');
if(false === $ires) {
echo json_encode(array('success'=>false, 'message'=>getMLText('error_document_indexed'), 'data'=>$document->getID()));