I am new to solr. I have developed a an website which uses solr for indexing. I want to handle the timeouts that can occur during solr read and write index.Please guide me on how can i handle these exceptions. I am us开发者_JAVA百科ing solrj as solr client and my website and solr server are running on the tomcat.
Thnak you!
Commit and Optimize are operations to make updates available to searchers. They are intended to be run after updates, not before queries.
Furthermore, they are expensive operations, which is why you're getting sporadical timeouts. Unless you have some special requirements, I recommend setting the <autoCommit/>
option in your solrconfig.xml. As the name says, it will automatically issue the commit depending on configurable criteria like maximum number of uncommitted documents or maximum time after adding documents.
Optimize is even more expensive than Commit, it basically rewrites the index. The frequency of an Optimize depends on how often you Commit changes and how many changes there are per commit.
See also:
- SOLR commit and optimize questions
- http://wiki.apache.org/solr/SolrPerformanceFactors#Updates_and_Commit_Frequency_Tradeoffs
- http://wiki.apache.org/solr/SolrConfigXml#Update_Handler_Section
精彩评论