Example #1
0
 /**
  * Delete all bundles from index
  */
 public function deleteBundlesIndexes(Bundle $bundle = null)
 {
     $delete = $this->solarium->createUpdate();
     $delete->addDeleteQuery(null !== $bundle ? $bundle->getFullName() : '*:*');
     $delete->addCommit();
     $this->solarium->update($delete);
 }
Example #2
0
 /** Delete record by ID
  * 
  * @param $id
  */
 public function delete($id)
 {
     $solr = new Solarium_Client(array('adapteroptions' => array('host' => '127.0.0.1', 'port' => 8983, 'path' => '/solr/', 'core' => 'beowulf')));
     $update = $solr->createUpdate();
     $update->addDeleteById('findIdentifier-' . $id);
     $update->addCommit();
     $result = $solr->update($update);
 }
<?php

require 'init.php';
htmlHeader();
// create a client instance
$client = new Solarium_Client($config);
// get an update query instance
$update = $client->createUpdate();
// add the delete query and a commit command to the update query
$update->addDeleteQuery('name:testdoc*');
$update->addCommit();
// this executes the query and returns the result
$result = $client->update($update);
echo '<b>Update query executed<b><br/>';
echo 'Query status: ' . $result->getStatus() . '<br/>';
echo 'Query time: ' . $result->getQueryTime();
htmlFooter();