public function deleteDocument($id) { //-- $connect = $this->solr_connect(); //-- if ((string) SMART_FRAMEWORK_DEBUG_MODE == 'yes') { //-- SmartFrameworkRegistry::setDebugMsg('db', 'solr|total-queries', 1, '+'); //-- $time_start = microtime(true); //-- } //end if //-- if ((string) $id == '') { Smart::log_warning('Solr ERROR # deleteDocument # ' . 'Document ID is Empty'); return -100; } //end if //-- try { //-- $updateResponse = $this->instance->deleteById((string) $id); $this->instance->commit(); // save //-- } catch (Exception $e) { //-- Smart::log_warning('Solr ERROR # deleteDocument # EXCEPTION: ' . $e->getMessage() . "\n" . 'ID=' . $id); return -201; //-- } //end try catch //-- $response = $updateResponse->getResponse(); // get answer message //print_r($response); //-- if ((string) SMART_FRAMEWORK_DEBUG_MODE == 'yes') { //-- $time_end = (double) (microtime(true) - (double) $time_start); //-- SmartFrameworkRegistry::setDebugMsg('db', 'solr|total-time', $time_end, '+'); //-- SmartFrameworkRegistry::setDebugMsg('db', 'solr|log', ['type' => 'nosql', 'data' => 'DELETE-QUERY', 'command' => array('ID' => (string) $id), 'time' => Smart::format_number_dec($time_end, 9, '.', '')]); //-- } //end if //-- if (is_object($response)) { if ($response instanceof SolrObject) { if (is_object($response['responseHeader'])) { if ($response['responseHeader'] instanceof SolrObject) { if ($response['responseHeader']->status === 0) { // OK } else { Smart::log_warning('Solr ERROR # deleteDocument # Invalid Status (' . $response['responseHeader']->status . ') : ' . 'ID=' . $id); return -206; } //end if else } else { Smart::log_warning('Solr ERROR # deleteDocument # Invalid responseHeader / Not instanceof SolrObject: ' . 'ID=' . $id); return -205; } //end if else } else { Smart::log_warning('Solr ERROR # deleteDocument # Invalid responseHeader / Invalid Object: ' . 'ID=' . $id); return -204; } //end if else } else { Smart::log_warning('Solr ERROR # deleteDocument # Invalid Answer / Not instanceof SolrObject: ' . 'ID=' . $id); return -203; } //end if else } else { Smart::log_warning('Solr ERROR # deleteDocument # Not Object: ' . 'ID=' . $id); return -202; } //end if else //-- return 0; // OK //-- }