Example #1
0
function delete_docs($dbpath, $identifiers)
{
    // Open the database we're going to be deleting from.
    $db = new XapianWritableDatabase($dbpath, Xapian::DB_OPEN);
    foreach ($identifiers as $identifier) {
        $idterm = 'Q' . $identifier;
        $db->delete_document($idterm);
    }
}
Example #2
0
 public function removeFilesFromIndex($paths)
 {
     foreach ($paths as $key => $path) {
         $paths[$key] = trim($path);
     }
     $database = new XapianWritableDatabase(self::$_database_path, Xapian::DB_CREATE_OR_OPEN);
     $limit = $database->get_value_freq('file');
     $iterator = $database->valuestream_begin('file');
     $count = 1;
     while ($limit > $count++) {
         $iterator->next();
         if (in_array($iterator->get_value(), $paths)) {
             $database->delete_document($iterator->get_docid());
         }
     }
 }