Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
added time-out option parameter to call hierarchy
orbiterdbc2e039bb0f
diff --git a/htroot/xml/snippet.java b/htroot/xml/snippet.javaindex d206d1328..421e76ad2 100644--- a/htroot/xml/snippet.java+++ b/htroot/xml/snippet.java@@ -39,7 +39,7 @@ public class snippet {// do the searchSet queryHashes = plasmaSearchQuery.words2hashes(query);- plasmaSnippetCache.Snippet snippet = switchboard.snippetCache.retrieveSnippet(url, queryHashes, true, 260);+ plasmaSnippetCache.Snippet snippet = switchboard.snippetCache.retrieveSnippet(url, queryHashes, true, 260, 10000);prop.put("status",snippet.getSource());if (snippet.getSource() < 11) {//prop.put("text", (snippet.exists()) ? snippet.getLineMarked(queryHashes) : "unknown");diff --git a/htroot/yacy/search.java b/htroot/yacy/search.javaindex e5d9469aa..0ff673dfa 100644--- a/htroot/yacy/search.java+++ b/htroot/yacy/search.java@@ -202,7 +202,7 @@ public final class search {while ((acc.hasMoreElements()) && (i < squery.wantedResults)) {urlentry = acc.nextElement();if (includesnippet) {- snippet = sb.snippetCache.retrieveSnippet(urlentry.url(), squery.queryHashes, false, 260);+ snippet = sb.snippetCache.retrieveSnippet(urlentry.url(), squery.queryHashes, false, 260, 1000);} else {snippet = null;}diff --git a/source/de/anomic/plasma/plasmaSnippetCache.java b/source/de/anomic/plasma/plasmaSnippetCache.javaindex c0ad8218a..fc057ecde 100644--- a/source/de/anomic/plasma/plasmaSnippetCache.java+++ b/source/de/anomic/plasma/plasmaSnippetCache.java@@ -166,7 +166,7 @@ public class plasmaSnippetCache {return retrieveFromCache(hashes, indexURL.urlHash(url)) != null;}- public Snippet retrieveSnippet(URL url, Set queryhashes, boolean fetchOnline, int snippetMaxLength) {+ public Snippet retrieveSnippet(URL url, Set queryhashes, boolean fetchOnline, int snippetMaxLength, int timeout) {// heise = "0OQUNU3JSs05"if (queryhashes.size() == 0) {//System.out.println("found no queryhashes for URL retrieve " + url);@@ -196,7 +196,7 @@ public class plasmaSnippetCache {// if not found try to download itif ((resource == null) && (fetchOnline)) {// download resource using the crawler- plasmaHTCache.Entry entry = loadResourceFromWeb(url, 5000);+ plasmaHTCache.Entry entry = loadResourceFromWeb(url, timeout);// getting resource metadata (e.g. the http headers for http resources)if (entry != null) docInfo = entry.getDocumentInfo();@@ -552,7 +552,7 @@ public class plasmaSnippetCache {urlstring = urlentry.url().toNormalform();if ((urlstring.matches(urlmask)) &&(!(existsInCache(urlentry.url(), queryhashes)))) {- new Fetcher(urlentry.url(), queryhashes).start();+ new Fetcher(urlentry.url(), queryhashes, (int) maxTime).start();i++;}}@@ -561,14 +561,16 @@ public class plasmaSnippetCache {public class Fetcher extends Thread {URL url;Set queryhashes;- public Fetcher(URL url, Set queryhashes) {+ int timeout;+ public Fetcher(URL url, Set queryhashes, int timeout) {if (url.getHost().endsWith(".yacyh")) return;this.url = url;this.queryhashes = queryhashes;+ this.timeout = timeout;}public void run() {log.logFine("snippetFetcher: try to get URL " + url);- plasmaSnippetCache.Snippet snippet = retrieveSnippet(url, queryhashes, true, 260);+ plasmaSnippetCache.Snippet snippet = retrieveSnippet(url, queryhashes, true, 260, timeout);if (snippet.line == null)log.logFine("snippetFetcher: cannot get URL " + url + ". error(" + snippet.source + "): " + snippet.error);elsediff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.javaindex 8b33ed27a..939e2e21f 100644--- a/source/de/anomic/plasma/plasmaSwitchboard.java+++ b/source/de/anomic/plasma/plasmaSwitchboard.java@@ -2078,7 +2078,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements serURL wordURL;if (urlstring.matches(query.urlMask)) { //.* is defaultif (includeSnippets) {- snippet = snippetCache.retrieveSnippet(url, query.queryHashes, false, 260);+ snippet = snippetCache.retrieveSnippet(url, query.queryHashes, false, 260, 1000);} else {snippet = null;}