private function doRebuildFromRows($searchTable, $table, $pid, $rows)
 {
     $i = 0;
     $expected = $rows->numRows();
     if ($expected == 0) {
         return $this->skippedTables[$table] = 'Empty table.';
     }
     foreach ($rows as $row) {
         $i++;
         $sid = $row->s_id;
         $pid = !isset($row->p_id) ? $pid : $row->p_id;
         // Uri or blob?
         if (isset($row->o_serialized)) {
             $indexableText = $row->o_blob === null ? $row->o_serialized : $row->o_blob;
         } else {
             $indexableText = $row->o_blob === null ? $row->o_hash : $row->o_blob;
         }
         if ($searchTable->isExemptedPropertyById($pid)) {
             continue;
         }
         $this->reportMessage("\r" . sprintf("%-35s%s", "- {$table}", sprintf("%4.0f%% (%s/%s)", $i / $expected * 100, $i, $expected)));
         $text = $this->searchTableUpdater->read($sid, $pid);
         // Unkown, so let's create the row
         if ($text === false) {
             $this->searchTableUpdater->insert($sid, $pid);
         }
         $this->searchTableUpdater->update($sid, $pid, trim($text) . ' ' . trim($indexableText));
     }
     $this->reportMessage("\n");
 }
 private function doUpdateOnInserts($inserts)
 {
     foreach ($inserts as $key => $value) {
         list($sid, $pid) = explode(':', $key, 2);
         if ($value === '') {
             continue;
         }
         $text = $this->searchTableUpdater->read($sid, $pid);
         if ($text === false) {
             $this->searchTableUpdater->insert($sid, $pid);
         }
         //wfDebugLog( 'smw', "Insert update on $sid with $pid " );
         $this->searchTableUpdater->update($sid, $pid, $text . ' ' . $value);
     }
 }
 public function testFlushTable()
 {
     $this->connection->expects($this->once())->method('delete')->with($this->anything(), $this->equalTo('*'));
     $instance = new SearchTableUpdater($this->connection, $this->searchTable, $this->textSanitizer);
     $instance->flushTable();
 }