1) Increasing the SolrServer's soTimeOut and ConnectionTimeOut to 10000 ms to fix the SocketTimeOutException : Read timed out.

2) logging the UpdateResponse object's information for debugging purposes in SolrIndexer.
This commit is contained in:
deepakkoni 2011-06-01 18:16:50 +00:00
parent 76d0932c58
commit 717275bc38
2 changed files with 13 additions and 8 deletions

View file

@ -13,13 +13,13 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.solr.client.solrj.SolrServer;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.common.SolrDocument;
import org.apache.solr.client.solrj.response.UpdateResponse;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.common.SolrException;
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.search.IndexingException;
import edu.cornell.mannlib.vitro.webapp.search.docbuilder.Obj2DocIface;
import edu.cornell.mannlib.vitro.webapp.search.solr.IndividualToSolrDocument;
import edu.cornell.mannlib.vitro.webapp.search.indexing.IndexerIface;
public class SolrIndexer implements IndexerIface {
@ -60,7 +60,9 @@ public class SolrIndexer implements IndexerIface {
//sending each doc individually is inefficient
Collection<SolrInputDocument> docs = new ArrayList<SolrInputDocument>();
docs.add( solrDoc );
server.add( docs );
UpdateResponse res = server.add( docs );
log.debug("response after adding docs to server: "+ res);
// if( !newDoc ){
// server.add( docs );
@ -132,9 +134,12 @@ public class SolrIndexer implements IndexerIface {
@Override
public synchronized void endIndexing() {
try {
server.commit();
} catch (Exception e) {
UpdateResponse res = server.commit();
log.debug("Response after committing to server: "+ res );
} catch (SolrServerException e) {
log.error("Could not commit to solr server", e);
} catch(IOException e){
log.error("Could not commit to solr server", e);
}finally{
CalculateParameters.betaMap.clear();
CalculateParameters.betaMap = null;

View file

@ -57,8 +57,8 @@ public class SolrSetup implements javax.servlet.ServletContextListener{
}
CommonsHttpSolrServer server;
server = new CommonsHttpSolrServer( solrServerUrl );
server.setSoTimeout(1000); // socket read timeout
server.setConnectionTimeout(100);
server.setSoTimeout(10000); // socket read timeout
server.setConnectionTimeout(10000);
server.setDefaultMaxConnectionsPerHost(100);
server.setMaxTotalConnections(100);
server.setMaxRetries(1);