Deleting documents by query and commiting in Lucene index taking long time using SolrJ

47 views Asked by At

To delete documents from lucene index, we are using solrJ 5.5.4 library where we are calling deleteByQuery() and commit() method to perform our operation. The overall operation of deleting documents from lucene is taking around 2-3 sec which should be executed within 500 ms.

Mentioning the code snippet:

HttpSolrClient solrClient = null;
solrClient = this.getHttpSolrClient(indexDir);
solrClient.deleteByQuery(query);
solrClient.commit();

Checked the Solr logs and observed that majority time is being taken to execute the query by solrclient and to commit the operation by update handler. We are only calling Api of solrJ to delete the forms by query as mentioned in snippet. The internal implementation of it is taking time.

Solr logs for reference:

INFO  [org.apache.solr.update.processor.LogUpdateProcessor] (http-10.50.32.46-8080-67) {deleteByQuery=doc_id: (11664770 OR 11664768 OR 11664766 OR 11664765)} 0 265
INFO  [org.apache.solr.core.SolrCore] (http-10.50.32.46-8080-67) [project_2155538] webapp=/solr path=/update params={wt=javabin&version=2} status=0 QTime=265 

2023-08-24 12:22:28,875 INFO  [org.apache.solr.update.UpdateHandler] (http-10.50.32.46-8080-67) start commit(optimize=false,waitFlush=false,waitSearcher=true,expungeDeletes=false)
2023-08-24 12:22:31,258 INFO  [org.apache.solr.update.UpdateHandler] (http-10.50.32.46-8080-67) end_commit_flush

Can the issue be related to the query passed, For eg. is the query format correct or is it the internal mechanism of solrJ for executing and commiting the query for a particular field fast and for a particular field slow? i.e for doc_id it might be executing and commiting the operation slow and for other field, the operation might be fast? Also can the issue be related to solr configuration?

0

There are 0 answers