public function addDocument($arrdoc, $use_autocommit = 0)
 {
     //--
     $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 (!is_array($arrdoc)) {
         Smart::log_warning('Solr ERROR # addDocument # ' . 'Document is not Array');
         return -100;
     }
     //end if
     //--
     if (Smart::array_size($arrdoc) <= 0) {
         Smart::log_warning('Solr ERROR # addDocument # ' . 'Document Array is empty !');
         return -101;
     }
     //end if
     //--
     $doc = new SolrInputDocument();
     //--
     foreach ($arrdoc as $key => $val) {
         //--
         if (is_array($val)) {
             foreach ($val as $k => $v) {
                 $doc->addField((string) $key, (string) $v);
             }
             //end foreach
         } else {
             $doc->addField((string) $key, (string) $val);
         }
         //end if
         //--
     }
     //end foreach
     //--
     try {
         //--
         if ((int) $use_autocommit > 0) {
             $updateResponse = $this->instance->addDocument($doc, true, (int) $use_autocommit);
         } else {
             $updateResponse = $this->instance->addDocument($doc, true, 0);
             $this->instance->commit();
             // save
         }
         //end if else
         //--
     } catch (Exception $e) {
         //--
         Smart::log_warning('Solr ERROR # addDocument # EXCEPTION: ' . $e->getMessage() . "\n" . print_r($arrdoc, 1));
         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' => 'ADD-UPDATE-QUERY', 'command' => $arrdoc, '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 # addDocument # Invalid Status (' . $response['responseHeader']->status . ') : ' . print_r($arrdoc, 1));
                         return -206;
                     }
                     //end if else
                 } else {
                     Smart::log_warning('Solr ERROR # addDocument # Invalid responseHeader / Not instanceof SolrObject: ' . print_r($arrdoc, 1));
                     return -205;
                 }
                 //end if else
             } else {
                 Smart::log_warning('Solr ERROR # addDocument # Invalid responseHeader / Invalid Object: ' . print_r($arrdoc, 1));
                 return -204;
             }
             //end if else
         } else {
             Smart::log_warning('Solr ERROR # addDocument # Invalid Answer / Not instanceof SolrObject: ' . print_r($arrdoc, 1));
             return -203;
         }
         //end if else
     } else {
         Smart::log_warning('Solr ERROR # addDocument # Not Object: ' . print_r($arrdoc, 1));
         return -202;
     }
     //end if else
     //--
     return 0;
     // OK
     //--
 }