/** * Get the date/time of the most recent time this record was indexed. * * @param string $core Solr core holding this record. * @param string $id Record ID within specified core. * @param string $date Date record was last modified. * * @return string Latest index date/time. * @access public */ public static function getLastIndexed($core, $id, $date) { include_once 'services/MyResearch/lib/Change_tracker.php'; $date = strtotime($date); $tracker = new Change_tracker(); $tracker->index($core, $id, $date); $iso8601 = 'Y-m-d\\TH:i:s\\Z'; return date($iso8601, strtotime($tracker->last_indexed)); }
/** * Get an object to list deleted records in the specified range. * * @param int $from Start date. * @param int $until End date. * * @return object Change_tracker object. * @access protected */ protected function listRecordsGetDeleted($from, $until) { $tracker = new Change_tracker(); $tracker->core = $this->core; $tracker->whereAdd("\"deleted\" >= '" . date('Y-m-d H:i:s', $from) . "'"); $tracker->whereAdd("\"deleted\" <= '" . date('Y-m-d H:i:s', $until) . "'"); $tracker->orderBy('deleted'); return $tracker; }
/** * Delete Record from Database * * @param string $idList Array of IDs for record to delete * * @return boolean * @access public */ public function deleteRecords($idList) { if ($this->debug) { echo "<pre>Delete Record List</pre>\n"; } // Build the delete XML $body = '<delete>'; foreach ($idList as $id) { $body .= '<id>' . htmlspecialchars($id) . '</id>'; } $body .= '</delete>'; // Attempt to post the XML: $result = $this->_update($body); if (PEAR::isError($result)) { PEAR::raiseError($result); } // Record the deletions in our change tracker database: foreach ($idList as $id) { $tracker = new Change_tracker(); $tracker->markDeleted($this->core, $id); } return $result; }