Solr delete not working for some reason

2019-03-08 02:13发布

问题:

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?

回答1:

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>'


回答2:

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!!!



回答3:

Put the commit=true parameter in you GET request:

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



回答4:

Remember to clear the browser cache! I thought I was having the same problem, but it turned out that the browser had just cached the result and was returning the cached page. D'oh!



回答5:

In Lucene wiki :

it will still be found, because index changes are not visible until, and a new searcher is opened. To cause this to happen, send a commit command to Solr (post.jar does this for you by default)

Maybe you can POST a <commit/> message to Solr.



回答6:

http://localhost:8983/solr/update?stream.body=<delete><query>*:*</query></delete>&commit=true


回答7:

Probably you are missing a forward slash (/) after update and before question mark.

Current query:

http://localhost:8983/solr/update?stream.body=<delete><query>*:*</query></delete>&commit=true

Revised query:

http://localhost:8983/solr/update/?stream.body=<delete><query>*:*</query></delete>&commit=true


标签: java search solr