From 0d58fea2105f05ab27262ef0ee4279ab36fbccc6 Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Sat, 12 May 2012 10:39:01 +0200 Subject: [PATCH] made multiple connector default --- htroot/IndexFederated_p.java | 4 ++-- .../cora/services/federated/solr/SolrShardingConnector.java | 6 ++++-- source/net/yacy/search/Switchboard.java | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/htroot/IndexFederated_p.java b/htroot/IndexFederated_p.java index ce0f8a33b..d0c56afe1 100644 --- a/htroot/IndexFederated_p.java +++ b/htroot/IndexFederated_p.java @@ -39,8 +39,8 @@ import net.yacy.cora.storage.ConfigurationSet; import net.yacy.kelondro.logging.Log; import net.yacy.search.Switchboard; import net.yacy.search.index.Segments; -import net.yacy.search.index.SolrField; import net.yacy.search.index.SolrConfiguration; +import net.yacy.search.index.SolrField; import de.anomic.server.serverObjects; import de.anomic.server.serverSwitch; @@ -93,7 +93,7 @@ public class IndexFederated_p { // switch on final boolean usesolr = sb.getConfigBool("federated.service.solr.indexing.enabled", false) & solrurls.length() > 0; try { - sb.indexSegments.segment(Segments.Process.LOCALCRAWLING).connectSolr((usesolr) ? new SolrShardingConnector(solrurls, SolrShardingSelection.Method.MODULO_HOST_MD5, 10000) : null); + sb.indexSegments.segment(Segments.Process.LOCALCRAWLING).connectSolr((usesolr) ? new SolrShardingConnector(solrurls, SolrShardingSelection.Method.MODULO_HOST_MD5, 10000, true) : null); } catch (final IOException e) { Log.logException(e); sb.indexSegments.segment(Segments.Process.LOCALCRAWLING).connectSolr(null); diff --git a/source/net/yacy/cora/services/federated/solr/SolrShardingConnector.java b/source/net/yacy/cora/services/federated/solr/SolrShardingConnector.java index c5536e531..df4f82f1c 100644 --- a/source/net/yacy/cora/services/federated/solr/SolrShardingConnector.java +++ b/source/net/yacy/cora/services/federated/solr/SolrShardingConnector.java @@ -44,12 +44,14 @@ public class SolrShardingConnector implements SolrConnector { private final SolrShardingSelection sharding; private final String[] urls; - public SolrShardingConnector(final String urlList, final SolrShardingSelection.Method method, final long timeout) throws IOException { + public SolrShardingConnector(final String urlList, final SolrShardingSelection.Method method, final long timeout, boolean multipleConnections) throws IOException { urlList.replace(' ', ','); this.urls = urlList.split(","); this.connectors = new ArrayList(); + SolrConnector s; for (final String u: this.urls) { - this.connectors.add(new SolrRetryConnector(new SolrSingleConnector(u.trim()), timeout)); + s = multipleConnections ? new SolrMultipleConnector(u.trim(), 2) : new SolrSingleConnector(u.trim()); + this.connectors.add(new SolrRetryConnector(s, timeout)); } this.sharding = new SolrShardingSelection(method, this.urls.length); } diff --git a/source/net/yacy/search/Switchboard.java b/source/net/yacy/search/Switchboard.java index b3b52a934..9dfeead92 100644 --- a/source/net/yacy/search/Switchboard.java +++ b/source/net/yacy/search/Switchboard.java @@ -656,7 +656,7 @@ public final class Switchboard extends serverSwitch (usesolr) ? new SolrShardingConnector( solrurls, SolrShardingSelection.Method.MODULO_HOST_MD5, - 10000) : null); + 10000, true) : null); } catch ( final IOException e ) { Log.logException(e); this.indexSegments.segment(Segments.Process.LOCALCRAWLING).connectSolr(null);