check if adding to document to index succeeded

This commit is contained in:
Uwe Steinmann 2023-04-15 13:24:12 +02:00
parent 140b6de1a6
commit 5a7f8655d8

View File

@ -85,9 +85,13 @@ function tree($dms, $fulltextservice, $folder, $indent='', $numdocs) { /* {{{ */
}
}
}
$index->addDocument($idoc);
echo $prefix.$themes->green(" (Folder added)").PHP_EOL;
$stats['folder']['add']++;
if($index->addDocument($idoc)) {
echo $prefix.$themes->green(" (Folder added)").PHP_EOL;
$stats['folder']['add']++;
} else {
$stats['folder']['error']++;
echo $prefix.$themes->error(" (Failed)").PHP_EOL;
}
} catch(Exception $e) {
$stats['folder']['error']++;
echo $prefix.$themes->error(" (Timeout)").PHP_EOL;
@ -113,9 +117,13 @@ function tree($dms, $fulltextservice, $folder, $indent='', $numdocs) { /* {{{ */
}
}
}
$index->addDocument($idoc);
echo $prefix.$themes->green(" (Folder updated)").PHP_EOL;
$stats['folder']['update']++;
if($index->addDocument($idoc)) {
echo $prefix.$themes->green(" (Folder updated)").PHP_EOL;
$stats['folder']['update']++;
} else {
$stats['folder']['error']++;
echo $prefix.$themes->error(" (Failed)").PHP_EOL;
}
} catch(Exception $e) {
$stats['folder']['error']++;
echo $prefix.$themes->error(" (Timeout)").PHP_EOL;
@ -141,9 +149,13 @@ function tree($dms, $fulltextservice, $folder, $indent='', $numdocs) { /* {{{ */
}
}
}
$index->addDocument($idoc);
echo $prefix.$themes->green(" (Document added)").PHP_EOL;
$stats['document']['add']++;
if($index->addDocument($idoc)) {
echo $prefix.$themes->green(" (Document added)").PHP_EOL;
$stats['document']['add']++;
} else {
$stats['document']['error']++;
echo $prefix.$themes->error(" (Failed)").PHP_EOL;
}
} catch(Exception $e) {
$stats['document']['error']++;
echo $prefix.$themes->error(" (Timeout)").PHP_EOL;
@ -170,9 +182,13 @@ function tree($dms, $fulltextservice, $folder, $indent='', $numdocs) { /* {{{ */
}
}
}
$index->addDocument($idoc);
echo $prefix.$themes->green(" (Document updated)").PHP_EOL;
$stats['document']['update']++;
if($index->addDocument($idoc)) {
echo $prefix.$themes->green(" (Document updated)").PHP_EOL;
$stats['document']['update']++;
} else {
$stats['document']['error']++;
echo $prefix.$themes->error(" (Failed)").PHP_EOL;
}
} catch(Exception $e) {
$stats['document']['error']++;
echo $prefix.$themes->error(" (Timeout)").PHP_EOL;