diff --git a/defaults/yacy.init b/defaults/yacy.init
index 25769d1a8..97718794b 100644
--- a/defaults/yacy.init
+++ b/defaults/yacy.init
@@ -478,6 +478,7 @@ allowDistributeIndex=true
allowDistributeIndexWhileCrawling=false
allowDistributeIndexWhileIndexing=true
allowReceiveIndex=true
+allowReceiveIndex.search=true
allowUnlimitedReceiveIndexFrom=
indexReceiveBlockBlacklist=true
diff --git a/htroot/ConfigBasic.java b/htroot/ConfigBasic.java
index ef545eb13..8d48d786b 100644
--- a/htroot/ConfigBasic.java
+++ b/htroot/ConfigBasic.java
@@ -180,6 +180,7 @@ public class ConfigBasic {
// switch to p2p mode
sb.setConfig(SwitchboardConstants.INDEX_DIST_ALLOW, true);
sb.setConfig(SwitchboardConstants.INDEX_RECEIVE_ALLOW, true);
+ sb.setConfig(SwitchboardConstants.INDEX_RECEIVE_ALLOW_SEARCH, true);
// set default behavior for search verification
sb.setConfig(SwitchboardConstants.SEARCH_VERIFY, "iffresh"); // nocache,iffresh,ifexist,cacheonly,false
sb.setConfig(SwitchboardConstants.SEARCH_VERIFY_DELETE, "true");
@@ -190,6 +191,7 @@ public class ConfigBasic {
// switch to robinson mode
sb.setConfig(SwitchboardConstants.INDEX_DIST_ALLOW, false);
sb.setConfig(SwitchboardConstants.INDEX_RECEIVE_ALLOW, false);
+ sb.setConfig(SwitchboardConstants.INDEX_RECEIVE_ALLOW_SEARCH, false);
// set default behavior for search verification
sb.setConfig(SwitchboardConstants.SEARCH_VERIFY, "ifexist"); // nocache,iffresh,ifexist,cacheonly,false
sb.setConfig(SwitchboardConstants.SEARCH_VERIFY_DELETE, "false");
@@ -200,6 +202,7 @@ public class ConfigBasic {
// switch to p2p mode: enable ad-hoc networks between intranet users
sb.setConfig(SwitchboardConstants.INDEX_DIST_ALLOW, false);
sb.setConfig(SwitchboardConstants.INDEX_RECEIVE_ALLOW, false);
+ sb.setConfig(SwitchboardConstants.INDEX_RECEIVE_ALLOW_SEARCH, false);
// set default behavior for search verification
sb.setConfig(SwitchboardConstants.SEARCH_VERIFY, "cacheonly"); // nocache,iffresh,ifexist,cacheonly,false
sb.setConfig(SwitchboardConstants.SEARCH_VERIFY_DELETE, "false");
diff --git a/htroot/ConfigNetwork_p.html b/htroot/ConfigNetwork_p.html
index 63551f477..364ea7eb3 100644
--- a/htroot/ConfigNetwork_p.html
+++ b/htroot/ConfigNetwork_p.html
@@ -11,17 +11,18 @@
if(!(dist || recv)) {
//robinson-mode
document.getElementById("ConfigForm").network[1].checked = true;
- }
- else {
+ } else {
//p2p-mode
document.getElementById("ConfigForm").network[0].checked = true;
}
+ document.getElementById("ConfigForm").indexReceiveSearch[recv ? 0 : 1].checked = true;
}
function EnableRobinson() {
if(document.getElementById("ConfigForm").network[1].checked) {
document.getElementById("ConfigForm").indexDistribute.checked = false;
document.getElementById("ConfigForm").indexReceive.checked = false;
+ document.getElementById("ConfigForm").indexReceiveSearch[1].checked = true;
}
}
@@ -29,7 +30,7 @@
if(document.getElementById("ConfigForm").network[0].checked) {
document.getElementById("ConfigForm").indexDistribute.checked = true;
document.getElementById("ConfigForm").indexReceive.checked = true;
- document.getElementById("ConfigForm").crawlResponse.checked = true;
+ document.getElementById("ConfigForm").indexReceiveSearch[0].checked = true;
}
}
//-->
@@ -143,7 +144,15 @@
- .
+ .
+
+ /
+
+ .
diff --git a/htroot/ConfigNetwork_p.java b/htroot/ConfigNetwork_p.java
index 75ae2f39e..cfc66a097 100644
--- a/htroot/ConfigNetwork_p.java
+++ b/htroot/ConfigNetwork_p.java
@@ -89,6 +89,7 @@ public class ConfigNetwork_p
// DHT control
boolean indexDistribute = "on".equals(post.get("indexDistribute", ""));
boolean indexReceive = "on".equals(post.get("indexReceive", ""));
+ boolean indexReceiveSearch = "on".equals(post.get("indexReceiveSearch", ""));
if ( !indexReceive ) {
// remove heuristics
sb.setConfig(SwitchboardConstants.HEURISTIC_SITE, false);
@@ -114,47 +115,21 @@ public class ConfigNetwork_p
}
}
- if ( indexDistribute ) {
- sb.setConfig(SwitchboardConstants.INDEX_DIST_ALLOW, true);
- } else {
- sb.setConfig(SwitchboardConstants.INDEX_DIST_ALLOW, false);
- }
+ sb.setConfig(SwitchboardConstants.INDEX_DIST_ALLOW, indexDistribute);
+ sb.setConfig(SwitchboardConstants.INDEX_DIST_ALLOW_WHILE_CRAWLING, "on".equals(post.get("indexDistributeWhileCrawling", "")));
+ sb.setConfig(SwitchboardConstants.INDEX_DIST_ALLOW_WHILE_INDEXING, "on".equals(post.get("indexDistributeWhileIndexing", "")));
+ sb.peers.mySeed().setFlagAcceptRemoteIndex(indexReceive);
+ sb.setConfig(SwitchboardConstants.INDEX_RECEIVE_ALLOW, indexReceive);
+ sb.setConfig(SwitchboardConstants.INDEX_RECEIVE_ALLOW_SEARCH, indexReceiveSearch);
+ sb.setConfig(SwitchboardConstants.INDEX_RECEIVE_AUTODISABLED, false);
- if ( "on".equals(post.get("indexDistributeWhileCrawling", "")) ) {
- sb.setConfig(SwitchboardConstants.INDEX_DIST_ALLOW_WHILE_CRAWLING, true);
- } else {
- sb.setConfig(SwitchboardConstants.INDEX_DIST_ALLOW_WHILE_CRAWLING, false);
- }
+ sb.setConfig(SwitchboardConstants.INDEX_RECEIVE_BLOCK_BLACKLIST, "on".equals(post.get("indexReceiveBlockBlacklist", "")));
- if ( "on".equals(post.get("indexDistributeWhileIndexing", "")) ) {
- sb.setConfig(SwitchboardConstants.INDEX_DIST_ALLOW_WHILE_INDEXING, true);
- } else {
- sb.setConfig(SwitchboardConstants.INDEX_DIST_ALLOW_WHILE_INDEXING, false);
+ if (post.containsKey("peertags")) {
+ sb.peers.mySeed().setPeerTags(MapTools.string2set(normalizedList(post.get("peertags")), ","));
}
- if ( indexReceive ) {
- sb.setConfig(SwitchboardConstants.INDEX_RECEIVE_ALLOW, true);
- sb.peers.mySeed().setFlagAcceptRemoteIndex(true);
- } else {
- sb.setConfig(SwitchboardConstants.INDEX_RECEIVE_ALLOW, false);
- sb.peers.mySeed().setFlagAcceptRemoteIndex(false);
- sb.setConfig(SwitchboardConstants.INDEX_RECEIVE_AUTODISABLED, false);
- }
-
- if ( "on".equals(post.get("indexReceiveBlockBlacklist", "")) ) {
- sb.setConfig("indexReceiveBlockBlacklist", true);
- } else {
- sb.setConfig("indexReceiveBlockBlacklist", false);
- }
-
- if ( post.containsKey("peertags") ) {
- sb.peers.mySeed().setPeerTags(
- MapTools.string2set(normalizedList(post.get("peertags")), ","));
- }
-
- sb.setConfig("cluster.mode", post.get(
- SwitchboardConstants.CLUSTER_MODE,
- SwitchboardConstants.CLUSTER_MODE_PUBLIC_PEER));
+ sb.setConfig("cluster.mode", post.get(SwitchboardConstants.CLUSTER_MODE, SwitchboardConstants.CLUSTER_MODE_PUBLIC_PEER));
sb.setConfig("cluster.peers.ipport", checkIPPortList(post.get("cluster.peers.ipport", "")));
sb.setConfig(
"cluster.peers.yacydomain",
@@ -176,37 +151,28 @@ public class ConfigNetwork_p
final int RTCppm = (int) (60000L / RTCbusySleep);
prop.put("acceptCrawlLimit", RTCppm);
- final boolean indexDistribute = sb.getConfigBool(SwitchboardConstants.INDEX_DIST_ALLOW, true);
- final boolean indexReceive = sb.getConfigBool(SwitchboardConstants.INDEX_RECEIVE_ALLOW, true);
- prop.put("indexDistributeChecked", (indexDistribute) ? "1" : "0");
- prop.put(
- "indexDistributeWhileCrawling.on",
- (sb.getConfigBool(SwitchboardConstants.INDEX_DIST_ALLOW_WHILE_CRAWLING, true)) ? "1" : "0");
- prop.put(
- "indexDistributeWhileCrawling.off",
- (sb.getConfigBool(SwitchboardConstants.INDEX_DIST_ALLOW_WHILE_CRAWLING, true)) ? "0" : "1");
- prop.put(
- "indexDistributeWhileIndexing.on",
- (sb.getConfigBool(SwitchboardConstants.INDEX_DIST_ALLOW_WHILE_INDEXING, true)) ? "1" : "0");
- prop.put(
- "indexDistributeWhileIndexing.off",
- (sb.getConfigBool(SwitchboardConstants.INDEX_DIST_ALLOW_WHILE_INDEXING, true)) ? "0" : "1");
- prop.put("indexReceiveChecked", (indexReceive) ? "1" : "0");
- prop.put(
- "indexReceiveBlockBlacklistChecked.on",
- (sb.getConfigBool("indexReceiveBlockBlacklist", true)) ? "1" : "0");
- prop.put(
- "indexReceiveBlockBlacklistChecked.off",
- (sb.getConfigBool("indexReceiveBlockBlacklist", true)) ? "0" : "1");
+ prop.put("indexDistributeWhileCrawling.on", sb.getConfigBool(SwitchboardConstants.INDEX_DIST_ALLOW_WHILE_CRAWLING, true));
+ prop.put("indexDistributeWhileCrawling.off", !sb.getConfigBool(SwitchboardConstants.INDEX_DIST_ALLOW_WHILE_CRAWLING, true));
+ prop.put("indexDistributeWhileIndexing.on", sb.getConfigBool(SwitchboardConstants.INDEX_DIST_ALLOW_WHILE_INDEXING, true));
+ prop.put("indexDistributeWhileIndexing.off", !sb.getConfigBool(SwitchboardConstants.INDEX_DIST_ALLOW_WHILE_INDEXING, true));
+ prop.put("indexReceiveBlockBlacklistChecked.on", sb.getConfigBool(SwitchboardConstants.INDEX_RECEIVE_BLOCK_BLACKLIST, true));
+ prop.put("indexReceiveBlockBlacklistChecked.off", !sb.getConfigBool(SwitchboardConstants.INDEX_RECEIVE_BLOCK_BLACKLIST, true));
prop.putHTML("peertags", MapTools.set2string(sb.peers.mySeed().getPeerTags(), ",", false));
+ final boolean indexDistribute = sb.getConfigBool(SwitchboardConstants.INDEX_DIST_ALLOW, true);
+ final boolean indexReceive = sb.getConfigBool(SwitchboardConstants.INDEX_RECEIVE_ALLOW, true);
+ final boolean indexReceiveSearch = sb.getConfigBool(SwitchboardConstants.INDEX_RECEIVE_ALLOW_SEARCH, true);
+ prop.put("indexDistributeChecked", indexDistribute);
+ prop.put("indexReceiveChecked", indexReceive);
+ prop.put("indexReceiveSearchChecked", indexReceiveSearch);
+
// set seed information directly
sb.peers.mySeed().setFlagAcceptRemoteCrawl(sb.getConfigBool("crawlResponse", false));
sb.peers.mySeed().setFlagAcceptRemoteIndex(indexReceive);
// set p2p/robinson mode flags and values
- prop.put("p2p.checked", (indexDistribute || indexReceive) ? "1" : "0");
- prop.put("robinson.checked", (indexDistribute || indexReceive) ? "0" : "1");
+ prop.put("p2p.checked", indexDistribute || indexReceive);
+ prop.put("robinson.checked", !(indexDistribute || indexReceive));
prop.putHTML("cluster.peers.ipport", sb.getConfig("cluster.peers.ipport", ""));
prop.putHTML("cluster.peers.yacydomain", sb.getConfig("cluster.peers.yacydomain", ""));
StringBuilder hashes = new StringBuilder();
@@ -220,15 +186,9 @@ public class ConfigNetwork_p
prop.put("cluster.peers.yacydomain.hashes", hashes.toString());
// set p2p mode flags
- prop.put(
- "privatepeerChecked",
- (SwitchboardConstants.CLUSTER_MODE_PRIVATE_PEER.equals(sb.getConfig(SwitchboardConstants.CLUSTER_MODE, ""))) ? "1" : "0");
- prop.put(
- "publicclusterChecked",
- (SwitchboardConstants.CLUSTER_MODE_PUBLIC_CLUSTER.equals(sb.getConfig(SwitchboardConstants.CLUSTER_MODE, ""))) ? "1" : "0");
- prop.put(
- "publicpeerChecked",
- (SwitchboardConstants.CLUSTER_MODE_PUBLIC_PEER.equals(sb.getConfig(SwitchboardConstants.CLUSTER_MODE, ""))) ? "1" : "0");
+ prop.put("privatepeerChecked", SwitchboardConstants.CLUSTER_MODE_PRIVATE_PEER.equals(sb.getConfig(SwitchboardConstants.CLUSTER_MODE, "")));
+ prop.put("publicclusterChecked", SwitchboardConstants.CLUSTER_MODE_PUBLIC_CLUSTER.equals(sb.getConfig(SwitchboardConstants.CLUSTER_MODE, "")));
+ prop.put("publicpeerChecked", SwitchboardConstants.CLUSTER_MODE_PUBLIC_PEER.equals(sb.getConfig(SwitchboardConstants.CLUSTER_MODE, "")));
// set network configuration
prop.putHTML("network.unit.definition", sb.getConfig("network.unit.definition", ""));
diff --git a/htroot/index.java b/htroot/index.java
index 672a1da43..07edfc37f 100644
--- a/htroot/index.java
+++ b/htroot/index.java
@@ -73,8 +73,7 @@ public class index {
final int type = (post == null) ? 0 : post.getInt("type", 0);
//final boolean indexDistributeGranted = sb.getConfigBool(SwitchboardConstants.INDEX_DIST_ALLOW, true);
- final boolean indexReceiveGranted = sb.getConfigBool(SwitchboardConstants.INDEX_RECEIVE_ALLOW, true) ||
- sb.getConfigBool(SwitchboardConstants.INDEX_RECEIVE_AUTODISABLED, true);
+ final boolean indexReceiveGranted = sb.getConfigBool(SwitchboardConstants.INDEX_RECEIVE_ALLOW_SEARCH, true);
global = global && indexReceiveGranted;
// search domain
diff --git a/htroot/yacy/transferRWI.java b/htroot/yacy/transferRWI.java
index bd6f18e67..03aa000f0 100644
--- a/htroot/yacy/transferRWI.java
+++ b/htroot/yacy/transferRWI.java
@@ -96,7 +96,7 @@ public final class transferRWI {
final int entryc = post.getInt("entryc", 0); // number of entries in indexes
byte[] indexes = post.get("indexes", "").getBytes(); // the indexes, as list of word entries
boolean granted = sb.getConfigBool("allowReceiveIndex", false);
- final boolean blockBlacklist = sb.getConfigBool("indexReceiveBlockBlacklist", false);
+ final boolean blockBlacklist = sb.getConfigBool(SwitchboardConstants.INDEX_RECEIVE_BLOCK_BLACKLIST, false);
final long cachelimit = sb.getConfigLong(SwitchboardConstants.WORDCACHE_MAX_COUNT, 100000);
final Seed otherPeer = sb.peers.get(iam);
final String otherPeerName = iam + ":" + ((otherPeer == null) ? "NULL" : (otherPeer.getName() + "/" + otherPeer.getVersion()));
diff --git a/htroot/yacy/transferURL.java b/htroot/yacy/transferURL.java
index f28fe9137..746d42c3d 100644
--- a/htroot/yacy/transferURL.java
+++ b/htroot/yacy/transferURL.java
@@ -46,6 +46,7 @@ import net.yacy.peers.Protocol;
import net.yacy.peers.Seed;
import net.yacy.repository.Blacklist.BlacklistType;
import net.yacy.search.Switchboard;
+import net.yacy.search.SwitchboardConstants;
import net.yacy.server.serverCore;
import net.yacy.server.serverObjects;
import net.yacy.server.serverSwitch;
@@ -69,7 +70,7 @@ public final class transferURL {
// final String key = post.get("key", ""); // transmission key
final int urlc = post.getInt("urlc", 0); // number of transported urls
final boolean granted = sb.getConfigBool("allowReceiveIndex", false);
- final boolean blockBlacklist = sb.getConfigBool("indexReceiveBlockBlacklist", false);
+ final boolean blockBlacklist = sb.getConfigBool(SwitchboardConstants.INDEX_RECEIVE_BLOCK_BLACKLIST, false);
// response values
String result = "";
diff --git a/htroot/yacysearch.java b/htroot/yacysearch.java
index b79c8061b..9f2ba85e6 100644
--- a/htroot/yacysearch.java
+++ b/htroot/yacysearch.java
@@ -153,10 +153,7 @@ public class yacysearch {
prop.put("rssYacyImageURL", "http://" + hostName + "/env/grafics/yacy.gif");
prop.put("thisaddress", hostName);
final boolean clustersearch = sb.isRobinsonMode() && sb.getConfig(SwitchboardConstants.CLUSTER_MODE, "").equals(SwitchboardConstants.CLUSTER_MODE_PUBLIC_CLUSTER);
- final boolean indexReceiveGranted =
- sb.getConfigBool(SwitchboardConstants.INDEX_RECEIVE_ALLOW, true)
- || sb.getConfigBool(SwitchboardConstants.INDEX_RECEIVE_AUTODISABLED, true)
- || clustersearch;
+ final boolean indexReceiveGranted = sb.getConfigBool(SwitchboardConstants.INDEX_RECEIVE_ALLOW_SEARCH, true) || clustersearch;
boolean p2pmode = sb.peers != null && sb.peers.sizeConnected() > 0 && indexReceiveGranted;
boolean global = post == null || (post.get("resource", "local").equals("global") && p2pmode);
boolean stealthmode = p2pmode && !global;
diff --git a/htroot/yacysearchitem.java b/htroot/yacysearchitem.java
index 570dc5d2a..ffbf6a1ef 100644
--- a/htroot/yacysearchitem.java
+++ b/htroot/yacysearchitem.java
@@ -260,10 +260,7 @@ public class yacysearchitem {
prop.put("content_loc_lon", result.lon());
}
final boolean clustersearch = sb.isRobinsonMode() && sb.getConfig(SwitchboardConstants.CLUSTER_MODE, "").equals(SwitchboardConstants.CLUSTER_MODE_PUBLIC_CLUSTER);
- final boolean indexReceiveGranted =
- sb.getConfigBool(SwitchboardConstants.INDEX_RECEIVE_ALLOW, true)
- || sb.getConfigBool(SwitchboardConstants.INDEX_RECEIVE_AUTODISABLED, true)
- || clustersearch;
+ final boolean indexReceiveGranted = sb.getConfigBool(SwitchboardConstants.INDEX_RECEIVE_ALLOW_SEARCH, true) || clustersearch;
boolean p2pmode = sb.peers != null && sb.peers.sizeConnected() > 0 && indexReceiveGranted;
boolean stealthmode = p2pmode && theSearch.query.isLocal();
if ((sb.getConfigBool(SwitchboardConstants.HEURISTIC_SEARCHRESULTS, false) ||
diff --git a/source/net/yacy/search/SwitchboardConstants.java b/source/net/yacy/search/SwitchboardConstants.java
index d6dfd24c8..9660cab17 100644
--- a/source/net/yacy/search/SwitchboardConstants.java
+++ b/source/net/yacy/search/SwitchboardConstants.java
@@ -243,6 +243,9 @@ public final class SwitchboardConstants {
*/
public static final String INDEX_DIST_ALLOW = "allowDistributeIndex";
public static final String INDEX_RECEIVE_ALLOW = "allowReceiveIndex";
+ public static final String INDEX_RECEIVE_ALLOW_SEARCH = "allowReceiveIndex.search";
+ public static final String INDEX_RECEIVE_BLOCK_BLACKLIST = "indexReceiveBlockBlacklist";
+
/**
* public static final String INDEX_DIST_ALLOW_WHILE_CRAWLING = "allowDistributeIndexWhileCrawling"
* Name of the setting whether Index Distribution shall be allowed while crawling is in progress, i.e.
diff --git a/source/net/yacy/search/query/SearchEvent.java b/source/net/yacy/search/query/SearchEvent.java
index 8b5f1777e..310fc9072 100644
--- a/source/net/yacy/search/query/SearchEvent.java
+++ b/source/net/yacy/search/query/SearchEvent.java
@@ -245,7 +245,7 @@ public final class SearchEvent {
this.IAmaxcounthash = null;
this.IAneardhthash = null;
this.localSearchThread = null;
- this.remote = (peers != null && peers.sizeConnected() > 0) && (this.query.domType == QueryParams.Searchdom.CLUSTER || (this.query.domType == QueryParams.Searchdom.GLOBAL && Switchboard.getSwitchboard().getConfigBool(SwitchboardConstants.INDEX_RECEIVE_ALLOW, false)));
+ this.remote = (peers != null && peers.sizeConnected() > 0) && (this.query.domType == QueryParams.Searchdom.CLUSTER || (this.query.domType == QueryParams.Searchdom.GLOBAL && Switchboard.getSwitchboard().getConfigBool(SwitchboardConstants.INDEX_RECEIVE_ALLOW_SEARCH, false)));
this.local_rwi_available = new AtomicInteger(0); // the number of results in the local peer after filtering
this.local_rwi_stored = new AtomicInteger(0);
this.local_solr_available = new AtomicInteger(0);
@@ -343,7 +343,7 @@ public final class SearchEvent {
} else {
this.primarySearchThreadsL = null;
this.nodeSearchThreads = null;
- this.pollImmediately = !query.getSegment().connectedRWI() || !Switchboard.getSwitchboard().getConfigBool(SwitchboardConstants.INDEX_RECEIVE_ALLOW, false);
+ this.pollImmediately = !query.getSegment().connectedRWI() || !Switchboard.getSwitchboard().getConfigBool(SwitchboardConstants.INDEX_RECEIVE_ALLOW_SEARCH, false);
if ( generateAbstracts ) {
// we need the results now
try {
diff --git a/source/net/yacy/server/serverObjects.java b/source/net/yacy/server/serverObjects.java
index 62310a801..3937303f0 100644
--- a/source/net/yacy/server/serverObjects.java
+++ b/source/net/yacy/server/serverObjects.java
@@ -204,6 +204,10 @@ public class serverObjects implements Serializable, Cloneable {
map.getMap().put(key, aa);
return;
}
+
+ public void put(final String key, final boolean value) {
+ put(key, value ? "1" : "0");
+ }
public void put(final String key, final String value) {
if (key == null) {