diff --git a/op/op.Ajax.php b/op/op.Ajax.php index 24cfccf3b..b9092b8c0 100644 --- a/op/op.Ajax.php +++ b/op/op.Ajax.php @@ -800,9 +800,12 @@ switch($command) { } } } - $index->addDocument($idoc); header('Content-Type: application/json'); - echo json_encode(array('success'=>true, 'message'=>getMLText('splash_document_indexed'), 'data'=>$document->getID())); + if(false === $index->addDocument($idoc)) { + echo json_encode(array('success'=>false, 'message'=>getMLText('error_document_indexed'), 'data'=>$document->getID())); + } else { + echo json_encode(array('success'=>true, 'message'=>getMLText('splash_document_indexed'), 'data'=>$document->getID(), 'cmd'=>$idoc->getCmd())); + } } else { header('Content-Type: application/json'); echo json_encode(array('success'=>false, 'message'=>$error, 'data'=>$document->getID(), 'mimetype'=>$idoc->getMimeType(), 'cmd'=>$idoc->getCmd())); diff --git a/views/bootstrap/class.Indexer.php b/views/bootstrap/class.Indexer.php index de392db62..31a2a62da 100644 --- a/views/bootstrap/class.Indexer.php +++ b/views/bootstrap/class.Indexer.php @@ -77,7 +77,10 @@ function check_queue() { success: function(data) { // console.log('success ' + data.data); if(data.success) { - $('#status_'+data.data).html(''); + if(data.cmd) + $('#status_'+data.data).html(''); + else + $('#status_'+data.data).html(''); } else { $('#status_'+data.data).html(''); noty({