Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
more auto-commit calls when a search interface is opened, but not when a search is done there to prevent blocking during search-time.
Michael Peter Christena87811bc3841
diff --git a/htroot/HostBrowser.java b/htroot/HostBrowser.javaindex 94c95d6de..c1cdc5fb3 100644--- a/htroot/HostBrowser.java+++ b/htroot/HostBrowser.java@@ -75,12 +75,13 @@ public class HostBrowser {prop.put("result", "You are not allowed to use this page. Please ask an administrator for permission.");return prop;}-++ String path = post == null ? "" : post.get("path", "").trim();+ if (admin && path.length() == 0 && sb.crawler.getActiveSize() > 0) sb.index.fulltext().commit();if (post == null || env == null) {return prop;}- String path = post.get("path", "").trim();int p = path.lastIndexOf('/');if (p < 0 && path.length() > 0) path = path + "/"; else if (p > 7) path = path.substring(0, p + 1); // the search path shall always end with "/"if (path.length() > 0 && (diff --git a/htroot/index.java b/htroot/index.javaindex 79ad68e05..7a1a8c45a 100644--- a/htroot/index.java+++ b/htroot/index.java@@ -62,7 +62,7 @@ public class index {}}- if (authorizedAccess) {+ if (authorizedAccess && sb.crawler.getActiveSize() > 0) {sb.index.fulltext().commit(); // call this only as superuser to prevent that this can be misused for DoS}diff --git a/htroot/yacyinteractive.java b/htroot/yacyinteractive.javaindex 4f9a35355..c513abea5 100644--- a/htroot/yacyinteractive.java+++ b/htroot/yacyinteractive.java@@ -34,7 +34,7 @@ import net.yacy.server.serverSwitch;public class yacyinteractive {- public static serverObjects respond(@SuppressWarnings("unused") final RequestHeader header, serverObjects post, final serverSwitch env) {+ public static serverObjects respond(final RequestHeader header, serverObjects post, final serverSwitch env) {final Switchboard sb = (Switchboard) env;final serverObjects prop = new serverObjects();@@ -47,6 +47,9 @@ public class yacyinteractive {prop.put("promoteSearchPageGreeting.homepage", sb.getConfig(SwitchboardConstants.GREETING_HOMEPAGE, ""));prop.put("promoteSearchPageGreeting.smallImage", sb.getConfig(SwitchboardConstants.GREETING_SMALL_IMAGE, ""));+ final boolean admin = sb.verifyAuthentication(header);+ if (admin && sb.crawler.getActiveSize() > 0) sb.index.fulltext().commit();+final String query = (post == null) ? "" : post.get("query", "");final String startRecord = (post == null) ? "0" : post.get("startRecord", "");final String maximumRecords = (post == null) ? "10" : post.get("maximumRecords", "");diff --git a/htroot/yacysearch.java b/htroot/yacysearch.javaindex 13ee14b9d..7245a57ee 100644--- a/htroot/yacysearch.java+++ b/htroot/yacysearch.java@@ -111,14 +111,13 @@ public class yacysearch {"network.unit.description","") : env.getConfig(SwitchboardConstants.GREETING, "");final String client = header.get(HeaderFramework.CONNECTION_PROP_CLIENTIP); // the search client who initiated the search- if (authenticated) sb.index.fulltext().commit();// get query- final String originalquerystring =- (post == null) ? "" : post.get("query", post.get("search", "")).trim();+ final String originalquerystring = (post == null) ? "" : post.get("query", post.get("search", "")).trim();String querystring = originalquerystring.replace('+', ' ').replace('*', ' ').trim();- CacheStrategy snippetFetchStrategy =- (post == null) ? null : CacheStrategy.parse(post.get("verify", "cacheonly"));+ CacheStrategy snippetFetchStrategy = (post == null) ? null : CacheStrategy.parse(post.get("verify", "cacheonly"));+ if (authenticated && originalquerystring.length() == 0 && sb.crawler.getActiveSize() > 0) sb.index.fulltext().commit();+final servletProperties prop = new servletProperties();prop.put("topmenu", sb.getConfigBool("publicTopmenu", true) ? 1 : 0);diff --git a/source/net/yacy/crawler/CrawlSwitchboard.java b/source/net/yacy/crawler/CrawlSwitchboard.javaindex ae0749238..a5a3fe7fe 100644--- a/source/net/yacy/crawler/CrawlSwitchboard.java+++ b/source/net/yacy/crawler/CrawlSwitchboard.java@@ -183,6 +183,14 @@ public final class CrawlSwitchboard {return new CrawlProfile(m);}+ public int getActiveSize() {+ return this.profilesActiveCrawls.size();+ }++ public int getPassiveSize() {+ return this.profilesPassiveCrawls.size();+ }+public Set<byte[]> getActive() {return this.profilesActiveCrawls.keySet();}