I am using the solrClient.add(SolrInputDocument doc)
method to add documents, one by one, to my solr
.
after this i explicitly call solrClient.commit()
Is it required? , I have seen some add
methods, which specify a delay
for commit
.
What does this mean, does the simple add
method does not commit, or if it does, after how long?
In Solr we have mainly two different types of commit:
Text above is quoted from this source, where you can find additional infos.
When you add a document, that won't be committed until one of the commits above will happen. You can check in solrconfig.xml what's the default for your commit options. Normally I would expect you to tune up the hard and soft commit times according your application needs and not to call an explicit commit from your code, unless you need the entry to be written on disk straightaway.
To be more specific, if you change your solrconfig.xml in order to include soft and hardcommit settings in the following way:
Solr will run automatically a softCommit every 30 seconds that will make your docs visible to Search and a hard commit every 10 minutes. So, whatever you added with SolrJ using:
will be soft committed after 30 seconds and hard committed after 10 minutes without any need for solrClient.commit() call.