У меня есть индекс Solr 4, и я хочу удалить все его документы.
Попытка №1:
http://www.domain.com:8080/solr/collection1/update?stream.body=%3Cdelete%3E%3Cquery%3E*:*%3C/query%3E%3C/delete%3E
http://www.domain.com:8080/solr/collection1/update?stream.body=%3Ccommit/%3E
Результат №1:
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">0</int>
</lst>
</response>
Под Solr Admin > collection 1
я все еще вижу Num Docs:829060
! Я полагаю, это означает, что запрос на удаление не сработал.
Я также вижу результаты, когда иду в
http://www.domain.com:8080/solr/collection1/select?q=*%3A*&wt=xml
Попытка №2 Использование PHP-библиотеки Solarium
// Create a client instance
$config = array(
'endpoint' => array(
'localhost' => array(
'host' => '127.0.0.1',
'port' => 8080,
'path' => '/solr/',
)
)
);
$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('*:*');
$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();
Вывод №2:
Update query executed
Query status: 0
Query time: 3
Я все еще вижу Num Docs:829060
! Это тоже не сработало.
Любые идеи, как решить проблему?
ОБНОВИТЬ
Я вручную удалил индексную папку /collection1/data
, сделал полный импорт DIH и все еще не могу удалить документы в новом индексе. Какие-либо предложения?
solrconfig.xml
<requestHandler name="/update" class="solr.UpdateRequestHandler">
<!-- See below for information on defining
updateRequestProcessorChains that can be used by name
on each Update Request
-->
<!--
<lst name="defaults">
<str name="update.chain">dedupe</str>
</lst>
-->
</requestHandler>