patches to ensure that solr connectors are active ony if they have a

solr object assigned and vice versa
pull/1/head
orbiter 13 years ago
parent 5a3c829872
commit 05a3ffd03a

@ -61,7 +61,6 @@ import net.yacy.peers.Seed;
import net.yacy.peers.dht.PeerSelection; import net.yacy.peers.dht.PeerSelection;
import net.yacy.repository.Blacklist.BlacklistType; import net.yacy.repository.Blacklist.BlacklistType;
import net.yacy.search.Switchboard; import net.yacy.search.Switchboard;
import net.yacy.search.SwitchboardConstants;
import net.yacy.search.index.Segment; import net.yacy.search.index.Segment;
import net.yacy.search.query.QueryParams; import net.yacy.search.query.QueryParams;
import net.yacy.search.query.RWIProcess; import net.yacy.search.query.RWIProcess;
@ -92,8 +91,7 @@ public class IndexControlRWIs_p {
prop.put("keyhash", ""); prop.put("keyhash", "");
prop.put("result", ""); prop.put("result", "");
prop.put("cleanup", post == null || post.containsKey("maxReferencesLimit") ? 1 : 0); prop.put("cleanup", post == null || post.containsKey("maxReferencesLimit") ? 1 : 0);
prop.put("cleanup_solr", sb.index.getRemoteSolr() == null prop.put("cleanup_solr", sb.index.getRemoteSolr() == null ? 0 : 1);
|| !sb.getConfigBool(SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_ENABLED, false) ? 0 : 1);
// switch off all optional forms/lists // switch off all optional forms/lists
prop.put("searchresult", 0); prop.put("searchresult", 0);
@ -158,8 +156,7 @@ public class IndexControlRWIs_p {
if ( post.get("deleteIndex", "").equals("on") ) { if ( post.get("deleteIndex", "").equals("on") ) {
segment.clear(); segment.clear();
} }
if ( post.get("deleteSolr", "").equals("on") if ( post.get("deleteSolr", "").equals("on") && sb.index.getRemoteSolr() != null) {
&& sb.getConfigBool(SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_ENABLED, false) ) {
try { try {
sb.index.getRemoteSolr().clear(); sb.index.getRemoteSolr().clear();
} catch ( final Exception e ) { } catch ( final Exception e ) {

@ -113,11 +113,11 @@ public class IndexFederated_p {
solr.setCommitWithinMs(commitWithinMs); solr.setCommitWithinMs(commitWithinMs);
sb.index.connectRemoteSolr(solr); sb.index.connectRemoteSolr(solr);
} else { } else {
sb.index.connectRemoteSolr(null); sb.index.disconnectRemoteSolr();
} }
} catch (final IOException e) { } catch (final IOException e) {
Log.logException(e); Log.logException(e);
sb.index.connectRemoteSolr(null); sb.index.disconnectRemoteSolr();
} }
} }

@ -2408,8 +2408,8 @@ public final class Switchboard extends serverSwitch
return new indexingQueueEntry(in.queueEntry, in.documents, null); return new indexingQueueEntry(in.queueEntry, in.documents, null);
} }
boolean localSolr = this.index.getLocalSolr() != null && getConfig(SwitchboardConstants.FEDERATED_SERVICE_YACY_INDEXING_ENGINE, "classic").equals("solr"); boolean localSolr = this.index.getLocalSolr() != null;
boolean remoteSolr = this.index.getRemoteSolr() != null && getConfigBool(SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_ENABLED, false); boolean remoteSolr = this.index.getRemoteSolr() != null;
if (localSolr || remoteSolr) { if (localSolr || remoteSolr) {
// send the documents to solr // send the documents to solr
for ( final Document doc : in.documents ) { for ( final Document doc : in.documents ) {

Loading…
Cancel
Save