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
pull/1/head
orbiter 20 years ago
parent 8290969150
commit 86f2aa8478

@ -359,7 +359,8 @@ public final class httpHeader extends TreeMap implements Map {
public long age() { public long age() {
Date lm = lastModified(); 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() { public long contentLength() {

@ -110,7 +110,7 @@ public class plasmaSnippetCache {
return retrieveFromCache(yacySearch.set2string(queryhashes), plasmaURL.urlHash(url)) != null; 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" // heise = "0OQUNU3JSs05"
if (queryhashes.size() == 0) { if (queryhashes.size() == 0) {
//System.out.println("found no queryhashes for url retrieve " + url); //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 // 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); //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 == 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 // finally store this snippet in our own cache
storeToCache(wordhashes, urlhash, line); storeToCache(wordhashes, urlhash, line);

@ -1200,7 +1200,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
} }
public void run() { public void run() {
log.logDebug("snippetFetcher: try to get URL " + url); 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) if (snippet.line == null)
log.logDebug("snippetFetcher: cannot get URL " + url + ". error(" + snippet.source + "): " + snippet.error); log.logDebug("snippetFetcher: cannot get URL " + url + ". error(" + snippet.source + "): " + snippet.error);
else else
@ -1315,7 +1315,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
//addScoreForked(ref, gs, descr.split(" ")); //addScoreForked(ref, gs, descr.split(" "));
//addScoreForked(ref, gs, urlstring.split("/")); //addScoreForked(ref, gs, urlstring.split("/"));
if (urlstring.matches(urlmask)) { //.* is default 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) { if (snippet.source == plasmaSnippetCache.ERROR_NO_MATCH) {
// suppress line: there is no match in that resource // suppress line: there is no match in that resource
} else { } else {
@ -1401,7 +1401,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
plasmaSnippetCache.result snippet; plasmaSnippetCache.result snippet;
while ((acc.hasMoreElements()) && (i < count)) { while ((acc.hasMoreElements()) && (i < count)) {
urlentry = acc.nextElement(); 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) { if (snippet.source == plasmaSnippetCache.ERROR_NO_MATCH) {
// suppress line: there is no match in that resource // suppress line: there is no match in that resource
} else { } else {

@ -667,8 +667,8 @@ public final class yacy {
// application wrapper // application wrapper
public static void main(String args[]) { public static void main(String args[]) {
String applicationRoot = System.getProperty("user.dir"); String applicationRoot = System.getProperty("user.dir");
System.out.println("args.length=" + args.length); //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.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")))) { if ((args.length >= 1) && ((args[0].equals("-startup")) || (args[0].equals("-start")))) {
// normal start-up of yacy // normal start-up of yacy
if (args.length == 2) applicationRoot= args[1]; if (args.length == 2) applicationRoot= args[1];

Loading…
Cancel
Save