/** * Constructor. Prepares solr connection. * * @param url * the connection url to the solr server */ public static SolrServer newRemoteInstance(URL url) { try { CommonsHttpSolrServer server = new CommonsHttpSolrServer(url); server.setSoTimeout(5000); server.setConnectionTimeout(5000); server.setDefaultMaxConnectionsPerHost(100); server.setMaxTotalConnections(100); server.setFollowRedirects(false); // defaults to false server.setAllowCompression(true); server.setMaxRetries(1); // defaults to 0. > 1 not recommended. server.setParser(new XMLResponseParser()); // binary parser is used by default return server; } catch (Exception e) { throw new RuntimeException(e); } }