From 86f2aa84788a48e0ad6990634386b167c4f1e14a Mon Sep 17 00:00:00 2001 From: orbiter Date: Thu, 30 Jun 2005 23:19:08 +0000 Subject: [PATCH] fixed seed-load date bug (evaluating server date for age computation) git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@354 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/de/anomic/http/httpHeader.java | 3 ++- source/de/anomic/plasma/plasmaSnippetCache.java | 6 +++--- source/de/anomic/plasma/plasmaSwitchboard.java | 6 +++--- source/yacy.java | 4 ++-- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/source/de/anomic/http/httpHeader.java b/source/de/anomic/http/httpHeader.java index f1c57a1d9..35008bb09 100644 --- a/source/de/anomic/http/httpHeader.java +++ b/source/de/anomic/http/httpHeader.java @@ -359,7 +359,8 @@ public final class httpHeader extends TreeMap implements Map { public long age() { Date lm = lastModified(); - if (lm == null) return Long.MAX_VALUE; else return (new Date()).getTime() - lm.getTime(); + Date sd = date(); + if (lm == null) return Long.MAX_VALUE; else return ((sd == null) ? new Date() : sd).getTime() - lm.getTime(); } public long contentLength() { diff --git a/source/de/anomic/plasma/plasmaSnippetCache.java b/source/de/anomic/plasma/plasmaSnippetCache.java index a51e6594a..2d0435311 100644 --- a/source/de/anomic/plasma/plasmaSnippetCache.java +++ b/source/de/anomic/plasma/plasmaSnippetCache.java @@ -110,7 +110,7 @@ public class plasmaSnippetCache { return retrieveFromCache(yacySearch.set2string(queryhashes), plasmaURL.urlHash(url)) != null; } - public result retrieve(URL url, Set queryhashes, boolean fetchOnline) { + public result retrieve(URL url, Set queryhashes, boolean fetchOnline, int snippetMaxLength) { // heise = "0OQUNU3JSs05" if (queryhashes.size() == 0) { //System.out.println("found no queryhashes for url retrieve " + url); @@ -155,10 +155,10 @@ public class plasmaSnippetCache { } // we have found a parseable non-empty file: use the lines - line = computeSnippet(sentences, queryhashes, 8 + 6 * queryhashes.size(), 120); + line = computeSnippet(sentences, queryhashes, 8 + 6 * queryhashes.size(), snippetMaxLength); //System.out.println("loaded snippet for url " + url + ": " + line); if (line == null) return new result(null, ERROR_NO_MATCH, "no matching snippet found"); - if (line.length() > 120) line = line.substring(0, 120); + if (line.length() > snippetMaxLength) line = line.substring(0, snippetMaxLength); // finally store this snippet in our own cache storeToCache(wordhashes, urlhash, line); diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.java index df6179a28..70938e6bc 100644 --- a/source/de/anomic/plasma/plasmaSwitchboard.java +++ b/source/de/anomic/plasma/plasmaSwitchboard.java @@ -1200,7 +1200,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser } public void run() { log.logDebug("snippetFetcher: try to get URL " + url); - plasmaSnippetCache.result snippet = snippetCache.retrieve(url, queryhashes, true); + plasmaSnippetCache.result snippet = snippetCache.retrieve(url, queryhashes, true, 260); if (snippet.line == null) log.logDebug("snippetFetcher: cannot get URL " + url + ". error(" + snippet.source + "): " + snippet.error); else @@ -1315,7 +1315,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser //addScoreForked(ref, gs, descr.split(" ")); //addScoreForked(ref, gs, urlstring.split("/")); if (urlstring.matches(urlmask)) { //.* is default - snippet = snippetCache.retrieve(url, queryhashes, false); + snippet = snippetCache.retrieve(url, queryhashes, false, 260); if (snippet.source == plasmaSnippetCache.ERROR_NO_MATCH) { // suppress line: there is no match in that resource } else { @@ -1401,7 +1401,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser plasmaSnippetCache.result snippet; while ((acc.hasMoreElements()) && (i < count)) { urlentry = acc.nextElement(); - snippet = snippetCache.retrieve(urlentry.url(), hashes, false); + snippet = snippetCache.retrieve(urlentry.url(), hashes, false, 260); if (snippet.source == plasmaSnippetCache.ERROR_NO_MATCH) { // suppress line: there is no match in that resource } else { diff --git a/source/yacy.java b/source/yacy.java index 2f48d1015..7511f5e17 100644 --- a/source/yacy.java +++ b/source/yacy.java @@ -667,8 +667,8 @@ public final class yacy { // application wrapper public static void main(String args[]) { String applicationRoot = System.getProperty("user.dir"); - System.out.println("args.length=" + args.length); - System.out.print("args=["); for (int i = 0; i < args.length; i++) System.out.print(args[i] + ", "); System.out.println("]"); + //System.out.println("args.length=" + args.length); + //System.out.print("args=["); for (int i = 0; i < args.length; i++) System.out.print(args[i] + ", "); System.out.println("]"); if ((args.length >= 1) && ((args[0].equals("-startup")) || (args[0].equals("-start")))) { // normal start-up of yacy if (args.length == 2) applicationRoot= args[1];