Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Solr delete not working for some reason

Tags:

java

search

solr

Just trying to delete all the documents, and did this:

http://localhost:8983/solr/update?stream.body=%3Cdelete%3E%3Cquery%3E*:*%3C/query%3E%3C/delete%3E 

then committed:

http://localhost:8983/solr/update?stream.body=%3Ccommit/%3E 

I get the response:

<lst name="responseHeader"> <int name="status">0</int> <int name="QTime">17</int> </lst> </response> 

But when I search I still get results back.

What did I do wrong?

like image 701
Blankman Avatar asked Mar 01 '10 19:03

Blankman


People also ask

How do I delete files from Solr?

Deleting the Document To delete documents from the index of Apache Solr, we need to specify the ID's of the documents to be deleted between the <delete></delete> tags. Here, this XML code is used to delete the documents with ID's 003 and 005. Save this code in a file with the name delete. xml.

What is the use of Solr?

Solr is a search server built on top of Apache Lucene, an open source, Java-based, information retrieval library. It is designed to drive powerful document retrieval applications - wherever you need to serve data to users based on their queries, Solr can work for you.


2 Answers

Not sure if it matters but you might encode the : too

http://localhost:8983/solr/update?stream.body=%3Cdelete%3E%3Cquery%3E*%3A*%3C%2Fquery%3E%3C%2Fdelete%3E 

Another thing to try is to use the POST method (the preferred way to call update):

curl http://localhost:8983/solr/update?commit=true -H "Content-Type: text/xml" --data-binary '<delete><query>*:*</query></delete>' 
like image 86
mlathe Avatar answered Sep 22 '22 12:09

mlathe


I got stung with this one recently as well. Just remember that if you have updateLog is configured in solrconfig.xml, but there is no version field in the schema.xml

see https://issues.apache.org/jira/browse/SOLR-3432

I Spent a good hour on this one!!!

like image 21
Rob Avatar answered Sep 25 '22 12:09

Rob