2.2.2-delete-by-query.php 565 B

1234567891011121314151617181920212223
  1. <?php
  2. require(__DIR__.'/init.php');
  3. htmlHeader();
  4. // create a client instance
  5. $client = new Solarium\Client($config);
  6. // get an update query instance
  7. $update = $client->createUpdate();
  8. // add the delete query and a commit command to the update query
  9. $update->addDeleteQuery('name:testdoc*');
  10. $update->addCommit();
  11. // this executes the query and returns the result
  12. $result = $client->update($update);
  13. echo '<b>Update query executed</b><br/>';
  14. echo 'Query status: ' . $result->getStatus(). '<br/>';
  15. echo 'Query time: ' . $result->getQueryTime();
  16. htmlFooter();