(PECL solr >= 0.9.2)
SolrClient::deleteByQuery — 删除与给定查询匹配的所有文档
query
查询
成功时返回一个 SolrUpdateResponse,失败时抛出异常。
示例 #1 SolrQuery::deleteByQuery() 示例
<?php
$options = array
(
'hostname' => SOLR_SERVER_HOSTNAME,
'login' => SOLR_SERVER_USERNAME,
'password' => SOLR_SERVER_PASSWORD,
'port' => SOLR_SERVER_PORT,
);
$client = new SolrClient($options);
// 这将擦除整个索引
$client->deleteByQuery("*:*");
$client->commit();
?>