Skip to content

Commit

Permalink
fixed seed-load date bug (evaluating server date for age computation)
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@354 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
orbiter committed Jun 30, 2005
1 parent 8290969 commit 86f2aa8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion source/de/anomic/http/httpHeader.java
Expand Up @@ -359,7 +359,8 @@ public Date ifModifiedSince() {

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() {
Expand Down
6 changes: 3 additions & 3 deletions source/de/anomic/plasma/plasmaSnippetCache.java
Expand Up @@ -110,7 +110,7 @@ public boolean existsInCache(URL url, Set queryhashes) {
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);
Expand Down Expand Up @@ -155,10 +155,10 @@ public result retrieve(URL url, Set queryhashes, boolean fetchOnline) {
}

// 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);
Expand Down
6 changes: 3 additions & 3 deletions source/de/anomic/plasma/plasmaSwitchboard.java
Expand Up @@ -1200,7 +1200,7 @@ public snippetFetcher(URL url, Set queryhashes) {
}
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
Expand Down Expand Up @@ -1315,7 +1315,7 @@ public serverObjects searchFromLocal(Set querywords, String order1, String order
//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 {
Expand Down Expand Up @@ -1401,7 +1401,7 @@ public serverObjects searchFromRemote(Set hashes, int count, boolean global, lon
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 {
Expand Down
4 changes: 2 additions & 2 deletions source/yacy.java
Expand Up @@ -667,8 +667,8 @@ private static void deleteStopwords(String homePath) {
// 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];
Expand Down

0 comments on commit 86f2aa8

Please sign in to comment.