Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
force a commit in advance of a search for the administrator to get most recent results even if commit time is high and an indexing is ongoing.
Michael Peter Christen8e1248ffe30a
diff --git a/htroot/index.java b/htroot/index.javaindex e75e16711..79ad68e05 100644--- a/htroot/index.java+++ b/htroot/index.java@@ -62,6 +62,10 @@ public class index {}}+ if (authorizedAccess) {+ sb.index.fulltext().commit(); // call this only as superuser to prevent that this can be misused for DoS+ }+boolean global = (post == null) ? true : post.get("resource", "global").equals("global");final boolean focus = (post == null) ? true : post.get("focus", "1").equals("1");diff --git a/htroot/yacysearch.java b/htroot/yacysearch.javaindex 1900cb866..13ee14b9d 100644--- a/htroot/yacysearch.java+++ b/htroot/yacysearch.java@@ -111,7 +111,8 @@ 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 queryfinal String originalquerystring =(post == null) ? "" : post.get("query", post.get("search", "")).trim();diff --git a/source/net/yacy/cora/federate/solr/connector/MirrorSolrConnector.java b/source/net/yacy/cora/federate/solr/connector/MirrorSolrConnector.javaindex e11c665bd..cece1360e 100644--- a/source/net/yacy/cora/federate/solr/connector/MirrorSolrConnector.java+++ b/source/net/yacy/cora/federate/solr/connector/MirrorSolrConnector.java@@ -33,7 +33,6 @@ import net.yacy.cora.storage.ARC;import net.yacy.cora.storage.ConcurrentARC;import net.yacy.kelondro.util.MemoryControl;-import org.apache.solr.client.solrj.SolrServerException;import org.apache.solr.client.solrj.response.QueryResponse;import org.apache.solr.client.solrj.util.ClientUtils;import org.apache.solr.common.SolrDocument;diff --git a/source/net/yacy/search/index/Fulltext.java b/source/net/yacy/search/index/Fulltext.javaindex d76693789..87f8d8c1e 100644--- a/source/net/yacy/search/index/Fulltext.java+++ b/source/net/yacy/search/index/Fulltext.java@@ -69,6 +69,8 @@ import org.apache.solr.common.SolrInputDocument;public final class Fulltext implements Iterable<byte[]> {+ private static final long forcedCommitTimeout = 3000; // wait this time until a next forced commit is executed+// class objectsprivate final File location;private Index urlIndexFile;@@ -77,6 +79,7 @@ public final class Fulltext implements Iterable<byte[]> {private ArrayList<HostStat> statsDump;private final MirrorSolrConnector solr;private final SolrConfiguration solrScheme;+ private long forcedCommitTime;protected Fulltext(final File path, final SolrConfiguration solrScheme) {this.location = path;@@ -86,6 +89,7 @@ public final class Fulltext implements Iterable<byte[]> {this.statsDump = null;this.solr = new MirrorSolrConnector(1000, 1000, 100);this.solrScheme = solrScheme;+ this.forcedCommitTime = 0;}protected void connectUrlDb(final String tablename, final boolean useTailCache, final boolean exceed134217727) {@@ -191,7 +195,10 @@ public final class Fulltext implements Iterable<byte[]> {}public void commit() {+ if (this.forcedCommitTime + forcedCommitTimeout < System.currentTimeMillis()) return;+ this.forcedCommitTime = Long.MAX_VALUE - forcedCommitTimeout; // set the time high to prevent that other processes get to this point meanwhilethis.solr.commit();+ this.forcedCommitTime = System.currentTimeMillis(); // set the exact time}/**