check if index exists before indexing a new document

This commit is contained in:
steinm 2012-12-14 08:05:29 +00:00
parent 11499ca484
commit 2b4a96e8f5

View File

@ -60,7 +60,7 @@ if (!$document->remove()) {
require_once('LetoDMS/Lucene.php');
$index = LetoDMS_Lucene_Indexer::open($settings->_luceneDir);
if($hits = $index->find('document_id:'.$documentid)) {
if($index && $hits = $index->find('document_id:'.$documentid)) {
$hit = $hits[0];
$index->delete($hit->id);
$index->commit();