Пример #1
0
 /**
  * 
  */
 protected function remove_absent_documents()
 {
     $absent_document_count = 0;
     /** @var nc_db $db */
     $db = nc_Core::get_object()->db;
     $query = "SELECT `Document_ID` FROM `Search_Document` WHERE `ToDelete` = 1 LIMIT 10000";
     while ($absent_documents = $db->get_results($query, ARRAY_A)) {
         foreach ($absent_documents as $row) {
             $doc = new nc_search_document();
             $doc->set_id($row['Document_ID']);
             $this->index->remove_document($doc);
         }
         $absent_document_count += count($absent_documents);
         // this operation might be slow, so save the task to prevent it from being marked as 'hung up'
         $this->task->save();
     }
     return $absent_document_count;
 }