Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

added creation of global ranking files and changed url normal form usage

orbiterd2731418bf61
diff --git a/build.properties b/build.properties
index 118f6041e..c881df280 100644
--- a/build.properties
+++ b/build.properties
@@ -3,7 +3,7 @@ javacSource=1.4
javacTarget=1.4
# Release Configuration
-releaseVersion=0.412
+releaseVersion=0.413
releaseFile=yacy_dev_v${releaseVersion}_${DSTAMP}_${releaseNr}.tar.gz
#releaseFile=yacy_v${releaseVersion}_${DSTAMP}_${releaseNr}.tar.gz
releaseDir=yacy_dev_v${releaseVersion}_${DSTAMP}_${releaseNr}
diff --git a/htroot/IndexCreate_p.java b/htroot/IndexCreate_p.java
index 312fc07d3..a8143a686 100644
--- a/htroot/IndexCreate_p.java
+++ b/htroot/IndexCreate_p.java
@@ -130,7 +130,7 @@ public class IndexCreate_p {
if (!(crawlingStart.startsWith("http"))) crawlingStart = "http://" + crawlingStart;
// normalizing URL
- crawlingStart = plasmaParser.urlNormalform(crawlingStart);
+ crawlingStart = htmlFilterContentScraper.urlNormalform(null, crawlingStart);
// check if url is proper
URL crawlingStartURL = null;
@@ -230,7 +230,7 @@ public class IndexCreate_p {
nexturlstring = nexturlstring.trim();
// normalizing URL
- nexturlstring = plasmaParser.urlNormalform(nexturlstring);
+ nexturlstring = htmlFilterContentScraper.urlNormalform(null, nexturlstring);
// generating an url object
URL nexturlURL = null;
diff --git a/htroot/htdocsdefault/dir.java b/htroot/htdocsdefault/dir.java
index 28676ae69..986ec781f 100644
--- a/htroot/htdocsdefault/dir.java
+++ b/htroot/htdocsdefault/dir.java
@@ -461,11 +461,11 @@ public class dir {
"AAAAAAAAAAAA", /*referrer*/
0, /*copycount*/
false, /*localneed*/
- Integer.parseInt(condenser.getAnalysis().getProperty("INFORMATION_VALUE","0"), 16),
+ condenser.RESULT_INFORMATION_VALUE,
"**", /*language*/
plasmaWordIndexEntry.DT_SHARE, /*doctype*/
phrase.length(), /*size*/
- (int) Long.parseLong(condenser.getAnalysis().getProperty("NUMB_WORDS","0"), 16),
+ condenser.RESULT_NUMB_WORDS,
5 /*process case*/
);
diff --git a/htroot/yacy/crawlOrder.java b/htroot/yacy/crawlOrder.java
index 63a76beb0..34f6d5a03 100644
--- a/htroot/yacy/crawlOrder.java
+++ b/htroot/yacy/crawlOrder.java
@@ -47,6 +47,7 @@
import java.util.ArrayList;
import java.util.Date;
+import de.anomic.htmlFilter.htmlFilterContentScraper;
import de.anomic.http.httpHeader;
import de.anomic.plasma.plasmaCrawlLURL;
import de.anomic.plasma.plasmaParser;
@@ -171,11 +172,11 @@ public final class crawlOrder {
// old method: only one url
// normalizing URL
- String newURL = plasmaParser.urlNormalform((String)urlv.get(0));
+ String newURL = htmlFilterContentScraper.urlNormalform(null, (String)urlv.get(0));
if (!newURL.equals(urlv.get(0))) {
env.getLog().logWarning("crawlOrder: Received not normalized URL " + urlv.get(0));
}
- String refURL = plasmaParser.urlNormalform((String) refv.get(0));
+ String refURL = htmlFilterContentScraper.urlNormalform(null, (String) refv.get(0));
if ((refURL != null) && (!refURL.equals(refv.get(0)))) {
env.getLog().logWarning("crawlOrder: Received not normalized Referer URL " + refv.get(0) + " of URL " + urlv.get(0));
}
diff --git a/source/de/anomic/htmlFilter/htmlFilterContentScraper.java b/source/de/anomic/htmlFilter/htmlFilterContentScraper.java
index 612711807..9de8c2218 100644
--- a/source/de/anomic/htmlFilter/htmlFilterContentScraper.java
+++ b/source/de/anomic/htmlFilter/htmlFilterContentScraper.java
@@ -104,11 +104,8 @@ public class htmlFilterContentScraper extends htmlFilterAbstractScraper implemen
text.append(super.stripAll(new serverByteBuffer(newtext, newtext.length + 1)).trim()).append(32);
}
- public static String urlNormalform(URL url) {
- if (url == null) return null;
- return urlNormalform(url.toString());
- }
-/*
+
+ /*
public static String urlNormalform(String us) {
if (us == null) { return null; }
if (us.length() == 0) { return null; }
@@ -149,39 +146,42 @@ public class htmlFilterContentScraper extends htmlFilterAbstractScraper implemen
serverLog.logFine("htmlFilter", "urlNormalform: OUT=" + us);
return us;
}
- */
-
- public static String urlNormalform(String us) {
+ */
+
+ public static String urlNormalform(URL url) {
+ boolean defaultPort = false;
+ serverLog.logFinest("htmlFilter", "urlNormalform: '" + url.toString() + "'");
+ if (url.getProtocol().equals("http")) {
+ if (url.getPort() < 0 || url.getPort() == 80) { defaultPort = true; }
+ } else if (url.getProtocol().equals("ftp")) {
+ if (url.getPort() < 0 || url.getPort() == 21) { defaultPort = true; }
+ } else if (url.getProtocol().equals("https")) {
+ if (url.getPort() < 0 || url.getPort() == 443) { defaultPort = true; }
+ }
+ String path = url.getFile();
+ if ((path.length() == 0) || (path.charAt(0) != '/')) path = "/" + path;
+ // (this is different from previous normal forms where a '/' must not appear in root paths; here it must appear. Makes everything easier.)
+ int cpos = path.indexOf("#");
+ if (cpos >= 0) path = path.substring(0, cpos);
+ if (defaultPort) {
+ return url.getProtocol() + "://" + url.getHost() + path;
+ } else {
+ return url.getProtocol() + "://" + url.getHost() + ":" + url.getPort() + path;
+ }
+ }
+
+ public static String urlNormalform(URL baseURL, String us) {
if (us == null) { return null; }
if (us.length() == 0) { return null; }
- serverLog.logFinest("htmlFilter", "urlNormalform: '" + us + "'");
try {
- final URL url = new URL(us);
- boolean defaultPort = false;
- if (url.getProtocol().equals("http")) {
- if (url.getPort() < 0 || url.getPort() == 80) { defaultPort = true; }
- } else if (url.getProtocol().equals("ftp")) {
- if (url.getPort() < 0 || url.getPort() == 21) { defaultPort = true; }
- } else if (url.getProtocol().equals("https")) {
- if (url.getPort() < 0 || url.getPort() == 443) { defaultPort = true; }
- }
- if (defaultPort) {
- if (url.getFile().equals("/")) {
- return url.getProtocol() + "://" + url.getHost();
- } else {
- return url.getProtocol() + "://" + url.getHost() + url.getFile();
- }
- } else {
- if (url.getFile().equals("/")) {
- return url.getProtocol() + "://" + url.getHost() + ":" + url.getPort();
- } else {
- return url.getProtocol() + "://" + url.getHost() + ":" + url.getPort() + url.getFile();
- }
- }
+ if (baseURL == null)
+ return urlNormalform(new URL(us));
+ else
+ return urlNormalform(new URL(baseURL, us));
} catch (MalformedURLException e) {
serverLog.logSevere("urlNormalform", e.toString());
+ return null;
}
- return null;
}
private String absolutePath(String relativePath) {
diff --git a/source/de/anomic/plasma/plasmaCondenser.java b/source/de/anomic/plasma/plasmaCondenser.java
index b89cccd54..14d96dd28 100644
--- a/source/de/anomic/plasma/plasmaCondenser.java
+++ b/source/de/anomic/plasma/plasmaCondenser.java
@@ -70,12 +70,24 @@ public final class plasmaCondenser {
private final static int numlength = 5;
- private Properties analysis;
+ //private Properties analysis;
private TreeMap words; // a string (the words) to (statProp) - relation
private HashMap sentences;
private int wordminsize;
private int wordcut;
+ public int RESULT_NUMB_TEXT_BYTES = -1;
+ public int RESULT_NUMB_WORDS = -1;
+ public int RESULT_DIFF_WORDS = -1;
+ public int RESULT_SIMI_WORDS = -1;
+ public int RESULT_WORD_ENTROPHY = -1;
+ public int RESULT_NUMB_SENTENCES = -1;
+ public int RESULT_DIFF_SENTENCES = -1;
+ public int RESULT_SIMI_SENTENCES = -1;
+ public int RESULT_AVERAGE_WORD_OCC = -1;
+ public int RESULT_INFORMATION_VALUE = -1;
+
+
public plasmaCondenser(InputStream text) throws IOException {
this(text, 3, 2);
}
@@ -83,15 +95,11 @@ public final class plasmaCondenser {
public plasmaCondenser(InputStream text, int wordminsize, int wordcut) throws IOException {
this.wordminsize = wordminsize;
this.wordcut = wordcut;
- analysis = new Properties();
+ //analysis = new Properties();
words = new TreeMap();
sentences = new HashMap();
createCondensement(text);
}
-
- public Properties getAnalysis() {
- return analysis;
- }
public int excludeWords(TreeSet stopwords) {
// subtracts the given stopwords from the word list
@@ -303,30 +311,20 @@ public final class plasmaCondenser {
}
}
- //-------------------
-
- // what do we have here:
- // sentences
- // words
-
- // we now have the sentence structure and word list
- // create properties with this information
-
- analysis.setProperty("NUMB_TEXT_BYTES", Long.toHexString(wordenum.count()));
- analysis.setProperty("NUMB_WORDS", Long.toHexString(allwordcounter));
- analysis.setProperty("DIFF_WORDS", Long.toHexString(wordHandleCount));
- analysis.setProperty("SIMI_WORDS", Long.toHexString(words.size()));
- analysis.setProperty("WORD_ENTROPHY", Long.toHexString((allwordcounter == 0) ? 0 : (255 * words.size() / allwordcounter)));
- analysis.setProperty("NUMB_SENTENCES", Long.toHexString(allsentencecounter));
- analysis.setProperty("DIFF_SENTENCES", Long.toHexString(sentenceHandleCount));
- analysis.setProperty("SIMI_SENTENCES", Long.toHexString(sentences.size()));
- analysis.setProperty("AVERAGE_WORD_OCC", Long.toHexString((words.size() == 0) ? 0 : (allwordcounter / words.size())));
- analysis.setProperty("INFORMATION_VALUE", Long.toHexString((allwordcounter == 0) ? 0 : (wordenum.count() * words.size() / allwordcounter / 16)));
-
- // string, characterisation of text content (a guess)
-
+ // store result
+ this.RESULT_NUMB_TEXT_BYTES = wordenum.count();
+ this.RESULT_NUMB_WORDS = allwordcounter;
+ this.RESULT_DIFF_WORDS = wordHandleCount;
+ this.RESULT_SIMI_WORDS = words.size();
+ this.RESULT_WORD_ENTROPHY = (allwordcounter == 0) ? 0 : (255 * words.size() / allwordcounter);
+ this.RESULT_NUMB_SENTENCES = allsentencecounter;
+ this.RESULT_DIFF_SENTENCES = sentenceHandleCount;
+ this.RESULT_SIMI_SENTENCES = sentences.size();
+ this.RESULT_AVERAGE_WORD_OCC = (words.size() == 0) ? 0 : (allwordcounter / words.size());
+ this.RESULT_INFORMATION_VALUE = (allwordcounter == 0) ? 0 : (wordenum.count() * words.size() / allwordcounter / 16);
}
+
public void print() {
String[] s = sentences();
@@ -670,7 +668,7 @@ public final class plasmaCondenser {
// output result
pc.writeMapToFile(new File(args[2]));
pc.print();
- System.out.println("ANALYSIS:" + pc.getAnalysis().toString());
+ //System.out.println("ANALYSIS:" + pc.getAnalysis().toString());
} catch (IOException e) {
System.out.println("Problem with input file: " + e.getMessage());
}
diff --git a/source/de/anomic/plasma/plasmaCrawlNURL.java b/source/de/anomic/plasma/plasmaCrawlNURL.java
index 4f5a837fa..a6dc8f7bd 100644
--- a/source/de/anomic/plasma/plasmaCrawlNURL.java
+++ b/source/de/anomic/plasma/plasmaCrawlNURL.java
@@ -471,6 +471,7 @@ public class plasmaCrawlNURL extends plasmaURL {
urlHashCache.put(entry);
} catch (IOException e) {
serverLog.logSevere("PLASMA", "INTERNAL ERROR AT plasmaNURL:store:" + e.toString() + ", resetting NURL-DB");
+ e.printStackTrace();
try {
resetHashCache();
} catch (IOException ee) {
@@ -479,6 +480,7 @@ public class plasmaCrawlNURL extends plasmaURL {
}
} catch (kelondroException e) {
serverLog.logSevere("PLASMA", "plasmaCrawlNURL.store failed: " + e.toString() + ", resetting NURL-DB");
+ e.printStackTrace();
try {
resetHashCache();
} catch (IOException ee) {
diff --git a/source/de/anomic/plasma/plasmaCrawlWorker.java b/source/de/anomic/plasma/plasmaCrawlWorker.java
index e5886574c..14670d236 100644
--- a/source/de/anomic/plasma/plasmaCrawlWorker.java
+++ b/source/de/anomic/plasma/plasmaCrawlWorker.java
@@ -53,6 +53,7 @@ import java.net.SocketException;
import java.net.URL;
import java.net.UnknownHostException;
import java.util.Date;
+import de.anomic.htmlFilter.htmlFilterContentScraper;
import de.anomic.http.httpHeader;
import de.anomic.http.httpRemoteProxyConfig;
import de.anomic.http.httpc;
@@ -407,10 +408,10 @@ public final class plasmaCrawlWorker extends Thread {
redirectionUrlString = redirectionUrlString.trim();
// normalizing URL
- redirectionUrlString = plasmaParser.urlNormalform(redirectionUrlString);
+ redirectionUrlString = htmlFilterContentScraper.urlNormalform(url, redirectionUrlString);
// generating the new URL object
- URL redirectionUrl = new URL(url, redirectionUrlString);
+ URL redirectionUrl = new URL(redirectionUrlString);
// returning the used httpc
httpc.returnInstance(remote);
diff --git a/source/de/anomic/plasma/plasmaParser.java b/source/de/anomic/plasma/plasmaParser.java
index 4d35d85ae..563d666d3 100644
--- a/source/de/anomic/plasma/plasmaParser.java
+++ b/source/de/anomic/plasma/plasmaParser.java
@@ -592,7 +592,7 @@ public final class plasmaParser {
public plasmaParserDocument transformScraper(URL location, String mimeType, htmlFilterContentScraper scraper) {
try {
- plasmaParserDocument ppd = new plasmaParserDocument(new URL(urlNormalform(location)),
+ plasmaParserDocument ppd = new plasmaParserDocument(new URL(htmlFilterContentScraper.urlNormalform(location)),
mimeType, null, null, scraper.getHeadline(),
null, null,
scraper.getText(), scraper.getAnchors(), scraper.getImages());
@@ -643,6 +643,7 @@ public final class plasmaParser {
}
+ /*
public static String urlNormalform(URL url) {
if (url == null) return null;
return urlNormalform(url.toString());
@@ -651,6 +652,7 @@ public final class plasmaParser {
public static String urlNormalform(String us) {
return htmlFilterContentScraper.urlNormalform(us);
}
+ */
static Map allReflinks(Map links) {
// we find all links that are part of a reference inside a url
diff --git a/source/de/anomic/plasma/plasmaParserDocument.java b/source/de/anomic/plasma/plasmaParserDocument.java
index dab1accf3..fe7a3a27a 100644
--- a/source/de/anomic/plasma/plasmaParserDocument.java
+++ b/source/de/anomic/plasma/plasmaParserDocument.java
@@ -42,6 +42,8 @@
package de.anomic.plasma;
+import de.anomic.htmlFilter.htmlFilterContentScraper;
+
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.net.URL;
@@ -91,7 +93,7 @@ public class plasmaParserDocument {
private String absolutePath(String relativePath) {
try {
- return plasmaParser.urlNormalform(new URL(location, relativePath));
+ return htmlFilterContentScraper.urlNormalform(location, relativePath);
} catch (Exception e) {
return "";
}
@@ -191,7 +193,7 @@ public class plasmaParserDocument {
} else {
ext = url.substring(extpos).toLowerCase();
}
- normal = plasmaParser.urlNormalform(url);
+ normal = htmlFilterContentScraper.urlNormalform(null, url);
if (normal != null) {
if (plasmaParser.mediaExtContains(ext.substring(1))) {
// this is not an normal anchor, its a media link
@@ -209,7 +211,7 @@ public class plasmaParserDocument {
while (i.hasNext()) {
entry = (Map.Entry) i.next();
url = (String) entry.getKey();
- normal = plasmaParser.urlNormalform(url);
+ normal = htmlFilterContentScraper.urlNormalform(null, url);
if (normal != null) medialinks.put(normal, entry.getValue()); // avoid NullPointerException
}
expandHyperlinks();
diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.java
index 79bdcae36..80fff9481 100644
--- a/source/de/anomic/plasma/plasmaSwitchboard.java
+++ b/source/de/anomic/plasma/plasmaSwitchboard.java
@@ -130,10 +130,12 @@ import de.anomic.kelondro.kelondroTables;
import de.anomic.server.serverAbstractSwitch;
import de.anomic.server.serverCodings;
import de.anomic.server.serverCore;
+import de.anomic.server.serverDate;
import de.anomic.server.serverInstantThread;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSemaphore;
import de.anomic.server.serverSwitch;
+import de.anomic.server.serverFileUtils;
import de.anomic.server.logging.serverLog;
import de.anomic.tools.bitfield;
import de.anomic.tools.crypt;
@@ -148,7 +150,9 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
public static int crawlSlots = 10;
public static int indexingSlots = 100;
public static int stackCrawlSlots = 10000;
-
+ public static int maxCRLDump = 300000;
+ public static int maxCRGDump = 100000;
+
// couloured list management
public static TreeSet blueList = null;
public static TreeSet stopwords = null;
@@ -158,13 +162,14 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
public File htCachePath;
private File plasmaPath;
public File listsPath;
+ public File htDocsPath;
+ public File rankingPath;
public plasmaURLPool urlPool;
public plasmaWordIndex wordIndex;
public plasmaHTCache cacheManager;
public plasmaSnippetCache snippetCache;
public plasmaCrawlLoader cacheLoader;
public plasmaSwitchboardQueue sbQueue;
- //public plasmaStackCrawlThread sbStackCrawlThread;
public plasmaCrawlStacker sbStackCrawlThread;
public messageBoard messageDB;
public wikiBoard wikiDB;
@@ -176,11 +181,12 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
public HashMap outgoingCookies, incomingCookies;
public kelondroTables facilityDB;
public plasmaParser parser;
- public plasmaWordIndexClassicCacheMigration classicCache;
public long proxyLastAccess;
public yacyCore yc;
public HashMap indexingTasksInProcess;
public userDB userDB;
+ //public StringBuffer crl; // local citation references
+ public StringBuffer crg; // global citation references
/*
* Remote Proxy configuration
@@ -215,10 +221,14 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
setLog(new serverLog("PLASMA"));
// load values from configs
- this.plasmaPath = new File(rootPath, getConfig("dbPath", "PLASMADB"));
+ this.plasmaPath = new File(rootPath, getConfig("dbPath", "DATA/PLASMADB"));
this.log.logConfig("Plasma DB Path: " + this.plasmaPath.toString());
- this.listsPath = new File(rootPath, getConfig("listsPath", "LISTS"));
- this.log.logConfig("Lists Path: " + this.listsPath.toString());
+ this.listsPath = new File(rootPath, getConfig("listsPath", "DATA/LISTS"));
+ this.log.logConfig("Lists Path: " + this.listsPath.toString());
+ this.htDocsPath = new File(rootPath, getConfig("htDocsPath", "DATA/HTDOCS"));
+ this.log.logConfig("HTDOCS Path: " + this.htDocsPath.toString());
+ this.rankingPath = new File(rootPath, getConfig("rankingPath", "DATA/RANKING"));
+ this.log.logConfig("Ranking Path: " + this.rankingPath.toString());
/* ============================================================================
* Remote Proxy configuration
@@ -256,7 +266,9 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
// this.remoteProxyHost = null;
// this.remoteProxyPort = 0;
// }
- this.proxyLastAccess = System.currentTimeMillis() - 60000;
+ this.proxyLastAccess = System.currentTimeMillis() - 60000;
+ crg = new StringBuffer(maxCRGDump);
+ //crl = new StringBuffer(maxCRLDump);
// configuring list path
if (!(listsPath.exists())) listsPath.mkdirs();
@@ -529,16 +541,6 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
indexDistribution.setCounts(150, 1, 3, 10000);
deployThread("20_dhtdistribution", "DHT Distribution", "selection, transfer and deletion of index entries that are not searched on your peer, but on others", null,
new serverInstantThread(indexDistribution, "job", null), 600000);
-
- // init migratiion from 0.37 -> 0.38
- classicCache = new plasmaWordIndexClassicCacheMigration(plasmaPath, wordIndex);
-
- if (classicCache.size() > 0) {
- setConfig("99_indexcachemigration_idlesleep" , 10000);
- setConfig("99_indexcachemigration_busysleep" , 40);
- deployThread("99_indexcachemigration", "index cache migration", "migration of index cache data structures 0.37 -> 0.38", null,
- new serverInstantThread(classicCache, "oneStepMigration", "size"), 30000);
- }
// test routine for snippet fetch
//Set query = new HashSet();
@@ -732,6 +734,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
parser.close();
cacheManager.close();
sbQueue.close();
+ //flushCitationReference(crl, "crl");
+ flushCitationReference(crg, "crg");
} catch (IOException e) {}
log.logConfig("SWITCHBOARD SHUTDOWN TERMINATED");
}
@@ -930,7 +934,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
String stats = "LOCALCRAWL[" + urlPool.noticeURL.stackSize(plasmaCrawlNURL.STACK_TYPE_CORE) + ", " + urlPool.noticeURL.stackSize(plasmaCrawlNURL.STACK_TYPE_LIMIT) + ", " + urlPool.noticeURL.stackSize(plasmaCrawlNURL.STACK_TYPE_OVERHANG) + ", " + urlPool.noticeURL.stackSize(plasmaCrawlNURL.STACK_TYPE_REMOTE) + "]";
if ((urlEntry.url() == null) || (urlEntry.url().toString().length() < 10)) {
log.logInfo(stats + ": URL with hash " + ((urlEntry.hash()==null)?"Unknown":urlEntry.hash()) + " already removed from queue.");
- return true;
+ return true;
}
String profileHandle = urlEntry.profileHandle();
//System.out.println("DEBUG plasmaSwitchboard.processCrawling: profileHandle = " + profileHandle + ", urlEntry.url = " + urlEntry.url());
@@ -1088,7 +1092,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
private void processResourceStack(plasmaSwitchboardQueue.Entry entry) {
// work off one stack entry with a fresh resource
- try {
+ try {
long stackStartTime = 0, stackEndTime = 0,
parsingStartTime = 0, parsingEndTime = 0,
indexingStartTime = 0, indexingEndTime = 0,
@@ -1147,12 +1151,12 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
}
parsingEndTime = System.currentTimeMillis();
- Date loadDate = null;
+ Date docDate = null;
if (entry.responseHeader() != null) {
- loadDate = entry.responseHeader().lastModified();
- if (loadDate == null) loadDate = entry.responseHeader().date();
+ docDate = entry.responseHeader().lastModified();
+ if (docDate == null) docDate = entry.responseHeader().date();
}
- if (loadDate == null) loadDate = new Date();
+ if (docDate == null) docDate = new Date();
// put anchors on crawl stack
stackStartTime = System.currentTimeMillis();
@@ -1167,9 +1171,9 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
while (i.hasNext()) {
e = (Map.Entry) i.next();
nexturlstring = (String) e.getKey();
- nexturlstring = plasmaParser.urlNormalform(nexturlstring);
+ nexturlstring = htmlFilterContentScraper.urlNormalform(null, nexturlstring);
- sbStackCrawlThread.enqueue(nexturlstring, entry.url().toString(), initiatorHash, (String) e.getValue(), loadDate, entry.depth() + 1, entry.profile());
+ sbStackCrawlThread.enqueue(nexturlstring, entry.url().toString(), initiatorHash, (String) e.getValue(), docDate, entry.depth() + 1, entry.profile());
// rejectReason = stackCrawl(nexturlstring, entry.normalizedURLString(), initiatorHash, (String) e.getValue(), loadDate, entry.depth() + 1, entry.profile());
// if (rejectReason == null) {
@@ -1202,30 +1206,25 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
log.logFine("Condensing for '" + entry.normalizedURLString() + "'");
plasmaCondenser condenser = new plasmaCondenser(new ByteArrayInputStream(document.getText()));
+ // generate citation reference
+ generateCitationReference(entry.urlHash(), docDate, document, condenser);
+
//log.logInfo("INDEXING HEADLINE:" + descr);
try {
//log.logDebug("Create LURL-Entry for '" + entry.normalizedURLString() + "', " +
// "responseHeader=" + entry.responseHeader().toString());
- Date lastModified = null;
- if (entry.responseHeader() == null) {
- lastModified = new Date();
- } else {
- lastModified = entry.responseHeader().lastModified();
- if (lastModified == null) lastModified = entry.responseHeader().date();
- if (lastModified == null) lastModified = new Date();
- }
plasmaCrawlLURL.Entry newEntry = urlPool.loadedURL.addEntry(
- entry.url(), descr, lastModified, new Date(),
+ entry.url(), descr, docDate, new Date(),
initiatorHash,
yacyCore.seedDB.mySeed.hash,
referrerHash,
0, true,
- Integer.parseInt(condenser.getAnalysis().getProperty("INFORMATION_VALUE","0"), 16),
+ condenser.RESULT_INFORMATION_VALUE,
plasmaWordIndexEntry.language(entry.url()),
plasmaWordIndexEntry.docType(document.getMimeType()),
entry.size(),
- (int) Long.parseLong(condenser.getAnalysis().getProperty("NUMB_WORDS","0"), 16),
+ condenser.RESULT_NUMB_WORDS,
processCase
);
@@ -1245,17 +1244,16 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
if (((storagePeerHash = getConfig("storagePeerHash",null))== null) ||
(storagePeerHash.trim().length() == 0) ||
((seed = yacyCore.seedDB.getConnected(storagePeerHash))==null)){
- words = wordIndex.addPageIndex(entry.url(), urlHash, loadDate, condenser, plasmaWordIndexEntry.language(entry.url()), plasmaWordIndexEntry.docType(document.getMimeType()));
+ words = wordIndex.addPageIndex(entry.url(), urlHash, docDate, condenser, plasmaWordIndexEntry.language(entry.url()), plasmaWordIndexEntry.docType(document.getMimeType()));
} else {
HashMap urlCache = new HashMap(1);
urlCache.put(newEntry.hash(),newEntry);
ArrayList tmpEntities = new ArrayList(condenser.getWords().size());
- int age = plasmaWordIndex.calcVirtualAge(lastModified);
int quality = 0;
try {
- quality = Integer.parseInt(condenser.getAnalysis().getProperty("INFORMATION_VALUE","0"), 16);
+ quality = condenser.RESULT_INFORMATION_VALUE;
} catch (NumberFormatException e) {
System.out.println("INTERNAL ERROR WITH CONDENSER.INFORMATION_VALUE: " + e.toString() + ": in URL " + newEntry.url().toString());
}
@@ -1272,7 +1270,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
String wordHash = plasmaWordIndexEntry.word2hash(word);
plasmaWordIndexEntity wordIdxEntity = new plasmaWordIndexEntity(wordHash);
plasmaWordIndexEntry wordIdxEntry = new plasmaWordIndexEntry(urlHash, count, p++, 0, 0,
- age, quality, language, doctype, true);
+ plasmaWordIndex.microDateDays(docDate), quality, language, doctype, true);
wordIdxEntity.addEntry(wordIdxEntry);
tmpEntities.add(wordIdxEntity);
// wordIndex.addEntries(plasmaWordIndexEntryContainer.instantContainer(wordHash, System.currentTimeMillis(), entry));
@@ -1284,7 +1282,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
String error = yacyClient.transferIndex(seed,(plasmaWordIndexEntity[])tmpEntities.toArray(new plasmaWordIndexEntity[tmpEntities.size()]),urlCache,true,120000);
if (error != null) {
- words = wordIndex.addPageIndex(entry.url(), urlHash, loadDate, condenser, plasmaWordIndexEntry.language(entry.url()), plasmaWordIndexEntry.docType(document.getMimeType()));
+ words = wordIndex.addPageIndex(entry.url(), urlHash, docDate, condenser, plasmaWordIndexEntry.language(entry.url()), plasmaWordIndexEntry.docType(document.getMimeType()));
}
// cleanup
@@ -1334,15 +1332,15 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
}
}
- document = null;
-
+ document = null;
+
} catch (IOException e) {
log.logSevere("ERROR in plasmaSwitchboard.process(): " + e.toString());
} finally {
// removing current entry from in process list
synchronized (this.indexingTasksInProcess) {
this.indexingTasksInProcess.remove(entry.urlHash());
- }
+ }
// removing current entry from notice URL queue
boolean removed = urlPool.noticeURL.remove(entry.urlHash()); // worked-off
@@ -1355,11 +1353,84 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
plasmaHTCache.filesInUse.remove(entry.cacheFile());
cacheManager.deleteFile(entry.url());
}
- entry = null;
+ entry = null;
}
}
-
+ private void generateCitationReference(String baseurlhash, Date docDate, plasmaParserDocument document, plasmaCondenser condenser) {
+ // generate citation reference
+ Map hl = document.getHyperlinks();
+ Iterator it = hl.entrySet().iterator();
+ String nexturlhash;
+ StringBuffer cpg = new StringBuffer(12 * (hl.size() + 1) + 1);
+ StringBuffer cpl = new StringBuffer(12 * (hl.size() + 1) + 1);
+ String lhp = baseurlhash.substring(6); // local hash part
+ int GCount = 0;
+ int LCount = 0;
+ while (it.hasNext()) {
+ nexturlhash = plasmaURL.urlHash((String) ((Map.Entry) it.next()).getKey());
+ if (nexturlhash != null) {
+ if (nexturlhash.substring(6).equals(lhp)) {
+ cpl.append(nexturlhash.substring(0, 6));
+ LCount++;
+ } else {
+ cpg.append(nexturlhash);
+ GCount++;
+ }
+ }
+ }
+
+ // append this reference to buffer
+ // generate header info
+ String head = baseurlhash + "=" +
+ plasmaWordIndex.microDateHoursStr(docDate.getTime()) + // latest update timestamp of the URL
+ plasmaWordIndex.microDateHoursStr(System.currentTimeMillis()) + // last visit timestamp of the URL
+ serverCodings.enhancedCoder.encodeBase64LongSmart(LCount, 2) + // count of links to local resources
+ serverCodings.enhancedCoder.encodeBase64LongSmart(GCount, 2) + // count of links to global resources
+ serverCodings.enhancedCoder.encodeBase64LongSmart(document.getImages().size(), 2) + // count of Images in document
+ serverCodings.enhancedCoder.encodeBase64LongSmart(0, 2) + // count of links to other documents
+ serverCodings.enhancedCoder.encodeBase64LongSmart(document.getText().length, 3) + // length of plain text in bytes
+ serverCodings.enhancedCoder.encodeBase64LongSmart(condenser.RESULT_NUMB_WORDS, 3) + // count of all appearing words
+ serverCodings.enhancedCoder.encodeBase64LongSmart(condenser.RESULT_SIMI_WORDS, 3) + // count of all unique words
+ serverCodings.enhancedCoder.encodeBase64LongSmart(0, 1); // Flags (update, popularity, attention, vote)
+
+ //crl.append(head); crl.append ('|'); crl.append(cpl); crl.append((char) 13); crl.append((char) 10);
+ crg.append(head); crg.append ('|'); crg.append(cpg); crg.append((char) 13); crg.append((char) 10);
+
+ // if buffer is full, flush it.
+ /*
+ if (crl.length() > maxCRLDump) {
+ flushCitationReference(crl, "crl");
+ crl = new StringBuffer(maxCRLDump);
+ }
+ **/
+ if (crg.length() > maxCRGDump) {
+ flushCitationReference(crg, "crg");
+ crg = new StringBuffer(maxCRGDump);
+ }
+ }
+
+ private void flushCitationReference(StringBuffer cr, String type) {
+ if (cr.length() < 12) return;
+ String filename = type.toUpperCase() + "-A-" + new serverDate().toShortString(true) + "." + cr.substring(0, 12) + ".cr.gz";
+ File path = new File(rankingPath, (type.equals("crl") ? "LOCAL/010_cr/" : "GLOBAL/010_owncr/"));
+ path.mkdirs();
+ File file = new File(path, filename);
+
+ // generate header
+ StringBuffer header = new StringBuffer(200);
+ header.append("# Name=YaCy " + ((type.equals("crl")) ? "Local" : "Global") + " Citation Reference Ticket"); header.append((char) 13); header.append((char) 10);
+ header.append("# Created=" + System.currentTimeMillis()); header.append((char) 13); header.append((char) 10);
+ header.append("# Structure=<Referee-12>,'=',<UDate-3>,<VDate-3>,<LCount-2>,<GCount-2>,<ICount-2>,<DCount-2>,<TLength-3>,<WACount-3>,<WUCount-3>,<Flags-1>,'|',*<Anchor-" + ((type.equals("crl")) ? "6" : "12") + ">"); header.append((char) 13); header.append((char) 10);
+ header.append("# ---"); header.append((char) 13); header.append((char) 10);
+ cr.insert(0, header.toString());
+ try {
+ serverFileUtils.writeAndZip(cr.toString().getBytes(), file);
+ log.logFine("wrote citation reference dump " + file.toString());
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
private void processLocalCrawling(plasmaCrawlNURL.Entry urlEntry, plasmaCrawlProfile.entry profile, String stats) {
// work off one Crawl stack entry
diff --git a/source/de/anomic/plasma/plasmaURL.java b/source/de/anomic/plasma/plasmaURL.java
index ba8d5d37e..75f3ed184 100644
--- a/source/de/anomic/plasma/plasmaURL.java
+++ b/source/de/anomic/plasma/plasmaURL.java
@@ -537,7 +537,7 @@ public class plasmaURL {
public static final String oldurlHash(String url) {
if ((url == null) || (url.length() < 10)) return null;
- String hash = serverCodings.encodeMD5B64(htmlFilterContentScraper.urlNormalform(url), true).substring(0, urlHashLength);
+ String hash = serverCodings.encodeMD5B64(htmlFilterContentScraper.urlNormalform(null, url), true).substring(0, urlHashLength);
return hash;
}
diff --git a/source/de/anomic/plasma/plasmaWordIndex.java b/source/de/anomic/plasma/plasmaWordIndex.java
index 9827dcdb3..0b1b60373 100644
--- a/source/de/anomic/plasma/plasmaWordIndex.java
+++ b/source/de/anomic/plasma/plasmaWordIndex.java
@@ -60,6 +60,7 @@ import java.net.URL;
import de.anomic.kelondro.kelondroMSetTools;
import de.anomic.server.logging.serverLog;
+import de.anomic.server.serverCodings;
import de.anomic.yacy.yacySeedDB;
public final class plasmaWordIndex {
@@ -103,27 +104,40 @@ public final class plasmaWordIndex {
public int addEntries(plasmaWordIndexEntryContainer entries, boolean highPriority) {
return ramCache.addEntries(entries, System.currentTimeMillis(), highPriority);
- }
+ }
- public static int calcVirtualAge(Date modified) {
+ private static final int hour = 3600000;
+ private static final int day = 86400000;
+
+ public static int microDateDays(Date modified) {
// this calculates a virtual age from a given date
// the purpose is to have an age in days of a given modified date
// from a fixed standpoint in the past
- //if (modified == null) return 0;
- // this is milliseconds. we need days
// one day has 60*60*24 seconds = 86400 seconds
// we take mod 64**3 = 262144, this is the mask of the storage
- return (int) ((modified.getTime() / 86400000) % 262144);
+ return (int) ((modified.getTime() / day) % 262144);
+ }
+
+ public static String microDateHoursStr(long time) {
+ return serverCodings.enhancedCoder.encodeBase64Long(microDateHoursInt(time), 3);
+ }
+
+ public static int microDateHoursInt(long time) {
+ return (int) ((time / hour) % 262144);
+ }
+
+ public static int microDateHoursAge(String mdhs) {
+ return microDateHoursInt(System.currentTimeMillis()) - (int) serverCodings.enhancedCoder.decodeBase64Long(mdhs);
}
public int addPageIndex(URL url, String urlHash, Date urlModified, plasmaCondenser condenser,
String language, char doctype) {
// this is called by the switchboard to put in a new page into the index
// use all the words in one condenser object to simultanous create index entries
- int age = calcVirtualAge(urlModified);
+ int age = microDateDays(urlModified);
int quality = 0;
try {
- quality = Integer.parseInt(condenser.getAnalysis().getProperty("INFORMATION_VALUE","0"), 16);
+ quality = condenser.RESULT_INFORMATION_VALUE;
} catch (NumberFormatException e) {
System.out.println("INTERNAL ERROR WITH CONDENSER.INFORMATION_VALUE: " + e.toString() + ": in URL " + url.toString());
}
diff --git a/source/de/anomic/plasma/plasmaWordIndexClassicCacheMigration.java b/source/de/anomic/plasma/plasmaWordIndexClassicCacheMigration.java
deleted file mode 100644
index 60a06c9ad..000000000
--- a/source/de/anomic/plasma/plasmaWordIndexClassicCacheMigration.java
+++ /dev/null
@@ -1,179 +0,0 @@
-// plasmaWordIndexFileCacheMigration.java
-// --------------------------------------
-// part of YACY
-// (C) by Michael Peter Christen; [email protected]
-// first published on http://www.anomic.de
-// Frankfurt, Germany, 2004
-// last major change: 22.01.2004
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// Using this software in any meaning (reading, learning, copying, compiling,
-// running) means that you agree that the Author(s) is (are) not responsible
-// for cost, loss of data or any harm that may be caused directly or indirectly
-// by usage of this softare or this documentation. The usage of this software
-// is on your own risk. The installation and usage (starting/running) of this
-// software may allow other people or application to access your computer and
-// any attached devices and is highly dependent on the configuration of the
-// software which must be done by the user of the software; the author(s) is
-// (are) also not responsible for proper configuration and usage of the
-// software, even if provoked by documentation provided together with
-// the software.
-//
-// Any changes to this file according to the GPL as documented in the file
-// gpl.txt aside this file in the shipment you received can be done to the
-// lines that follows this copyright notice here, but changes must not be
-// done inside the copyright notive above. A re-distribution must contain
-// the intact and unchanged copyright notice.
-// Contributions and changes to the program code must be marked as such.
-
-
-/*
- The plasmaIndexCache manages a database table with a list of
- indexEntries in it. This is done in a completely different fashion
- as organized by the plasmaIndex tables. The entries are not
- sorted and just stored in a buffer.
- Whenever during a seach an index is retrieved, first it's buffer
- is flushed into the corresponding index table, so that it can be
- sorted into the remaining index entry elements.
- The cache database consist of
- - the word hash as primary key
- - one column with a one-byte counter
- - a number of more columns with indexEntry elements
-*/
-
-
-// compile with
-// javac -classpath classes -sourcepath source -d classes -g source/de/anomic/plasma/*.java
-
-package de.anomic.plasma;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.Iterator;
-
-import de.anomic.kelondro.kelondroException;
-import de.anomic.kelondro.kelondroTree;
-import de.anomic.server.logging.serverLog;
-
-public class plasmaWordIndexClassicCacheMigration {
-
- private static final String indexCacheFileName = "indexCache.db";
-
- // class variables
- private File databaseRoot;
- private kelondroTree indexCache;
- private plasmaWordIndex fresh;
-
- public plasmaWordIndexClassicCacheMigration(File databaseRoot, plasmaWordIndex fresh) throws IOException {
- this.fresh = fresh;
- this.databaseRoot = databaseRoot;
- File indexCacheFile = new File(databaseRoot, indexCacheFileName);
- if (indexCacheFile.exists()) {
- // simply open the file
- indexCache = new kelondroTree(indexCacheFile, 0x400);
- if (indexCache.size() == 0) {
- indexCache.close();
- indexCacheFile.delete();
- indexCache = null;
- }
- } else {
- indexCache = null;
- }
- }
-
- protected void close() throws IOException {
- if (indexCache != null) indexCache.close();
- indexCache = null;
- }
-
- private byte[][] getCache(String wordHash) throws IOException {
- if (indexCache == null) return null;
- // read one line from the cache; if none exists: construct one
- byte[][] row;
- try {
- row = indexCache.get(wordHash.getBytes());
- } catch (Exception e) {
- // we had some negativeSeekOffsetExceptions here, and also loops may cause this
- // in that case the indexCache is corrupt
- System.out.println("Error in plasmaWordINdexFileCache.getCache: index for hash " + wordHash + " is corrupt:" + e.toString());
- //e.printStackTrace();
- row = null;
- }
- if (row == null) {
- row = new byte[indexCache.columns()][];
- row[0] = wordHash.getBytes();
- row[1] = new byte[1];
- row[1][0] = (byte) 0;
- }
- return row;
- }
-
- protected Iterator wordHashes() throws IOException {
- if (indexCache == null) return new HashSet().iterator();
- try {
- return indexCache.rows(true, false, null);
- } catch (kelondroException e) {
- de.anomic.server.logging.serverLog.logSevere("PLASMA", "kelondro error in plasmaWordIndexFileCache: " + e.getMessage());
- return new HashSet().iterator();
- }
- }
-
- protected void remove(String wordHash) throws IOException {
- if (indexCache == null) return;
- indexCache.remove(wordHash.getBytes());
- }
-
- private int size(String wordHash) throws IOException {
- if (indexCache == null) return 0;
- // return number of entries in specific cache
- byte[][] row = indexCache.get(wordHash.getBytes());
- if (row == null) return 0;
- return (int) row[1][0];
- }
-
- public int size() {
- if (indexCache == null) return 0; else return indexCache.size();
- }
-
- public boolean oneStepMigration() {
- try {
- Iterator i = wordHashes();
- if (!(i.hasNext())) return false;
- byte[][] row = (byte[][]) i.next();
- if (row == null) return false;
- String hash = new String(row[0]);
- if (hash == null) return false;
- int size = (int) row[1][0];
- plasmaWordIndexEntryContainer container = new plasmaWordIndexEntryContainer(hash);
- plasmaWordIndexEntry[] entries = new plasmaWordIndexEntry[size];
- for (int j = 0; j < size; j++) {
- entries[j] = new plasmaWordIndexEntry(
- new String(row[j + 2], 0, plasmaCrawlLURL.urlHashLength),
- new String(row[j + 2], plasmaCrawlLURL.urlHashLength, plasmaWordIndexEntry.attrSpaceShort));
- }
- container.add(entries, System.currentTimeMillis());
- fresh.addEntries(container, false);
- i = null;
- remove(hash);
- return true;
- } catch (Exception e) {
- serverLog.logSevere("PLASMA MIGRATION", "oneStepMigration error: " + e.getMessage(), e);
- return false;
- }
- }
-
-}
diff --git a/source/de/anomic/server/serverCodings.java b/source/de/anomic/server/serverCodings.java
index 8f4eba5e3..2efff5508 100644
--- a/source/de/anomic/server/serverCodings.java
+++ b/source/de/anomic/server/serverCodings.java
@@ -87,19 +87,35 @@ public final class serverCodings {
return ahpla[b];
}
+
+ public String encodeBase64LongSmart(long c, int length) {
+ if (c >= maxBase64(length)) {
+ StringBuffer s = new StringBuffer(length);
+ while (length > 0) {
+ s.insert(0,alpha[0x3F]);
+ length--;
+ }
+ return s.toString();
+ } else {
+ return encodeBase64Long(c, length);
+ }
+ }
public String encodeBase64Long(long c, int length) {
- if (length < 0) length = 0;
- StringBuffer s = new StringBuffer(length); //String s = "";
- if (c == 0) s.insert(0,alpha[0]); //s = alpha[0] + s;
- else while (c > 0) {
- s.insert(0,alpha[(byte) (c & 0x3F)]); //s = alpha[(byte) (c & 0x3F)] + s;
- c >>= 6;
- }
- if ((length != 0) && (s.length() > length))
- throw new RuntimeException("encodeBase64 result '" + s + "' exceeds demanded length of " + length + " digits");
- if (length == 0) length = 1; // rare exception for the case that c == 0
- while (s.length() < length) s.insert(0,alpha[0]); //s = alpha[0] + s;
- return s.toString();
+ if (length < 0) length = 0;
+ StringBuffer s = new StringBuffer(length); //String s = "";
+ if (c == 0) {
+ s.insert(0,alpha[0]); //s = alpha[0] + s;
+ } else {
+ while (c > 0) {
+ s.insert(0,alpha[(byte) (c & 0x3F)]); //s = alpha[(byte) (c & 0x3F)] + s;
+ c >>= 6;
+ }
+ }
+ if ((length != 0) && (s.length() > length))
+ throw new RuntimeException("encodeBase64 result '" + s + "' exceeds demanded length of " + length + " digits");
+ if (length == 0) length = 1; // rare exception for the case that c == 0
+ while (s.length() < length) s.insert(0,alpha[0]); //s = alpha[0] + s;
+ return s.toString();
}
public long decodeBase64Long(String s) {
diff --git a/source/de/anomic/server/serverFileUtils.java b/source/de/anomic/server/serverFileUtils.java
index bb76e831c..088115683 100644
--- a/source/de/anomic/server/serverFileUtils.java
+++ b/source/de/anomic/server/serverFileUtils.java
@@ -63,15 +63,15 @@ import java.util.Iterator;
public final class serverFileUtils {
public static int copy(InputStream source, OutputStream dest) throws IOException {
- byte[] buffer = new byte[4096];
+ byte[] buffer = new byte[4096];
- int c, total = 0;
- while ((c = source.read(buffer)) > 0) {
+ int c, total = 0;
+ while ((c = source.read(buffer)) > 0) {
dest.write(buffer, 0, c);
dest.flush();
total += c;
}
- dest.flush();
+ dest.flush();
return total;
}
@@ -79,10 +79,10 @@ public final class serverFileUtils {
public static void copy(InputStream source, File dest) throws IOException {
FileOutputStream fos = null;
try {
- fos = new FileOutputStream(dest);
- copy(source, fos);
+ fos = new FileOutputStream(dest);
+ copy(source, fos);
} finally {
- if (fos != null) try {fos.close();} catch (Exception e) {}
+ if (fos != null) try {fos.close();} catch (Exception e) {}
}
}
@@ -135,7 +135,7 @@ public final class serverFileUtils {
try {
byteOut = new ByteArrayOutputStream((int)(source.length()/2));
zipOut = new GZIPOutputStream(byteOut);
- copy(source,zipOut);
+ copy(source, zipOut);
zipOut.close();
return byteOut.toByteArray();
} finally {
@@ -144,6 +144,27 @@ public final class serverFileUtils {
}
}
+ public static void writeAndZip(byte[] source, File dest) throws IOException {
+ FileOutputStream fos = null;
+ try {
+ fos = new FileOutputStream(dest);
+ writeAndZip(source, fos);
+ } finally {
+ if (fos != null) try {fos.close();} catch (Exception e) {}
+ }
+ }
+
+ public static void writeAndZip(byte[] source, OutputStream dest) throws IOException {
+ GZIPOutputStream zipOut = null;
+ try {
+ zipOut = new GZIPOutputStream(dest);
+ write(source, zipOut);
+ zipOut.close();
+ } finally {
+ if (zipOut != null) try { zipOut.close(); } catch (Exception e) {}
+ }
+ }
+
public static void write(byte[] source, OutputStream dest) throws IOException {
copy(new ByteArrayInputStream(source), dest);
}
@@ -205,4 +226,11 @@ public final class serverFileUtils {
}
}
+ public static void main(String[] args) {
+ try {
+ writeAndZip("ein zwei drei, Zauberei".getBytes(), new File("zauberei.txt.gz"));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
}
diff --git a/source/de/anomic/yacy/yacyClient.java b/source/de/anomic/yacy/yacyClient.java
index b37820275..89100dcbc 100644
--- a/source/de/anomic/yacy/yacyClient.java
+++ b/source/de/anomic/yacy/yacyClient.java
@@ -447,7 +447,7 @@ public final class yacyClient {
link = urlManager.addEntry(lEntry, yacyCore.seedDB.mySeed.hash, targetPeer.hash, 2);
// save the url entry
final plasmaWordIndexEntry entry = new plasmaWordIndexEntry(link.hash(), link.wordCount(), 0, 0, 0,
- plasmaWordIndex.calcVirtualAge(link.moddate()), link.quality(),
+ plasmaWordIndex.microDateDays(link.moddate()), link.quality(),
link.language(), link.doctype(), false);
if (link.snippet() != null) {
// we don't store the snippets along the url entry, because they are search-specific.
diff --git a/yacy.init b/yacy.init
index 762e735e8..4a3da59fe 100644
--- a/yacy.init
+++ b/yacy.init
@@ -652,5 +652,9 @@ searchProcessRemoteCount_f = 100
searchProcessRemoteTime_s = 10
searchProcessRemoteCount_s = 10
+# path to ranking directory containing ranking reference files
+rankingPath = DATA/RANKING
+
# a list of domain name patterns that should not be cached by the httpc dns cache
-httpc.nameCacheNoCachingPatterns = .*.dyndns.org, .*.dynalias.org
\ No newline at end of file
+httpc.nameCacheNoCachingPatterns = .*.dyndns.org, .*.dynalias.org
+