On 5/29/2014 4:18 AM, M, Arjun (NSN - IN/Bangalore) wrote: > Thanks for your valuable inputs... Find below my code and config in > solrconfig.xml. Index update is successful but I am not able to see any data > from solr admin console. What could be the issue? Any help here is highly > appreciated. > > I can see the data in the solr admin gui after tomcat restart(solr is > running in tomcat in my case) > > private void addToSolr(List<SolrInputDocument> c) throws SolrServerException, > IOException { > if (!c.isEmpty()) { > try { > > > solr.add(c); > logger.info("Commit size after Add=" + c.size()); > > } finally { > //renew lock > } > } > } > > autoCommit config in solrconfig.xml > ===================================== > > <autoCommit> > <maxTime>${solr.autoCommit.maxTime:15000}</maxTime> > <maxDocs>10000</maxDocs> > <openSearcher>false</openSearcher> > </autoCommit> > > <autoSoftCommit> > <maxTime>${solr.autoSoftCommit.maxTime:-1}</maxTime> > </autoSoftCommit>
The code snippet does not include a commit. I am not really clear on what using a value of -1 would do on maxTime here. I suspect that it efectively disables autoSoftCommit. If that's the case, then there is nothing at all in your code or your config that will open a new searcher -- that option is set to false in your autoCommit. If you want Solr to automatically do commits to make documents visible, I think you should configure a maxTime value for autoSoftCommit, and make it as long as you can possibly stand to not have new documents available. Then you won't have to worry about commits in your code at all. > Few more questions.. > > 2) If I use solrServer.add(<Doc list>,<commitwithin>), should I do > solrServer.commit() also No. The commitWithin would do a soft commit for you once that much time has elapsed since indexing started (or the last commit with openSearcher=true), so you would not need to do a commit(). My opinion is that you should not combine manual commits with autoSoftCommit. Depending on exactly what your needs are, you might want to use commitWithin, and have autoSoftCommit as a last guarantee against errors in your indexing process. Thanks, Shawn