I am adding documents to a Solr 4.3 core using SolrJ API , I noticed that I have the autocommit set to 15 seconds in the stock solrconfig that I am using as below.
<autoCommit>
<maxTime>${solr.autoCommit.maxTime:15000}</maxTime>
<openSearcher>false</openSearcher>
</autoCommit>
My undestanding is that since the auto commit is set to true it means that the Solr instance would be auto commiting anyhow every 15 seconds, so I would not need to commit explicity using the SolrJ API as in below everytime I add a document to Solr , is my understanding correct ?
httpSolrServer.add(doc1);
httpSolrServer.commit();// Is this still needed ?
Thanks in advance!
If you have auto-commit defined, you don't need an explicit commit.
However, in your definition above, you have openSearcher set to false for the (hard) commit. Which means, Solr will commit but will not show the changes.
In the example configuration it works because there is also autoSoftCommit commit with openSearcher set to true (or true by default). That will make changes actually show but without doing expensive hard commit.
Together those two sections work well with you seeing the results fast and then periodically also saving everything to disk. But make sure you have both sections or you reopen the searcher in the one above. Doing only one out of two will cause the results to never show unless you also do explicit commit somewhere else.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With