I have a Solr 4 index that I want to delete all its documents.
Attempt #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
Result #1:
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">0</int>
</lst>
</response>
Under the Solr Admin > collection 1
, I still see Num Docs:829060
! I suppose this means the delete query did not work.
I also see results when going to
http://www.domain.com:8080/solr/collection1/select?q=*%3A*&wt=xml
Attempt #2 Using Solarium PHP library
// 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();
Output #2:
Update query executed
Query status: 0
Query time: 3
I still see Num Docs:829060
! This did not work as well.
Any ideas how to solve the problem?
UPDATE
I manually deleted the index folder /collection1/data
, did a DIH full-import and still cant delete the documents in the new index. Any suggestions?
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>