Deleting index from Solr using solrj as a client

azhar_salati picture azhar_salati · Apr 17, 2010 · Viewed 11.2k times · Source

I am using solrj as client for indexing documents on the solr server.

I am having problem while deleting the indexes by 'id' from the solr server. I am using following code to delete the indexes:

server.deleteById("id:20");
server.commit(true,true);

After this when i again search for the documents, the search result contains the above document also. Dont know what is going wrong with this code. Please help me out with issue.

Thanks!

Answer

itsadok picture itsadok · May 2, 2010

When you call deleteById, just use the id, without query syntax:

server.deleteById("20");
server.commit();