From 61995d508e72836330d8e53facb6659a8bae3656 Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Wed, 7 Nov 2012 17:27:50 +0100 Subject: [PATCH] do the commit anyway before calling a search interface --- htroot/HostBrowser.java | 2 +- htroot/index.java | 2 +- htroot/yacyinteractive.java | 4 +++- htroot/yacysearch.java | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/htroot/HostBrowser.java b/htroot/HostBrowser.java index 537a22c48..7968d6a3e 100644 --- a/htroot/HostBrowser.java +++ b/htroot/HostBrowser.java @@ -84,7 +84,7 @@ public class HostBrowser { } String path = post == null ? "" : post.get("path", "").trim(); - if (admin && path.length() == 0 && sb.crawler.getActiveSize() > 0) sb.index.fulltext().commit(); + if (admin && path.length() == 0) sb.index.fulltext().commit(); if (post == null || env == null) { return prop; } diff --git a/htroot/index.java b/htroot/index.java index 7a1a8c45a..79ad68e05 100644 --- a/htroot/index.java +++ b/htroot/index.java @@ -62,7 +62,7 @@ public class index { } } - if (authorizedAccess && sb.crawler.getActiveSize() > 0) { + if (authorizedAccess) { 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.java index c513abea5..27b794fd8 100644 --- a/htroot/yacyinteractive.java +++ b/htroot/yacyinteractive.java @@ -48,7 +48,9 @@ public class yacyinteractive { 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(); + if (admin) { + sb.index.fulltext().commit(); + } final String query = (post == null) ? "" : post.get("query", ""); final String startRecord = (post == null) ? "0" : post.get("startRecord", ""); diff --git a/htroot/yacysearch.java b/htroot/yacysearch.java index 31fa9545a..7dc4a8b3f 100644 --- a/htroot/yacysearch.java +++ b/htroot/yacysearch.java @@ -116,7 +116,7 @@ public class yacysearch { 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")); - if (authenticated && originalquerystring.length() == 0 && sb.crawler.getActiveSize() > 0) sb.index.fulltext().commit(); + if (authenticated && originalquerystring.length() == 0) sb.index.fulltext().commit(); final servletProperties prop = new servletProperties(); prop.put("topmenu", sb.getConfigBool("publicTopmenu", true) ? 1 : 0);