Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
- separated the LURL data storage and Crawl result stack for process supervision. this is another step to enable multiple, concurrent fulltext-indexes - another try to make the yacy-httpc more stable
orbiterd6050b9ffbb5
diff --git a/htroot/Bookmarks.java b/htroot/Bookmarks.javaindex cc854bb62..f87f961dd 100644--- a/htroot/Bookmarks.java+++ b/htroot/Bookmarks.java@@ -196,7 +196,7 @@ public class Bookmarks {bookmarksDB.Bookmark bookmark = switchboard.bookmarksDB.getBookmark(urlHash);if (bookmark == null) {// try to get the bookmark from the LURL database- indexURLEntry urlentry = switchboard.wordIndex.loadedURL.load(urlHash, null, 0);+ indexURLEntry urlentry = switchboard.wordIndex.getURL(urlHash, null, 0);plasmaParserDocument document = null;if (urlentry != null) {indexURLEntry.Components comp = urlentry.comp();diff --git a/htroot/CrawlResults.java b/htroot/CrawlResults.javaindex 098d1f67d..4606edfd6 100644--- a/htroot/CrawlResults.java+++ b/htroot/CrawlResults.java@@ -69,7 +69,7 @@ public class CrawlResults {tabletype = 0;}- if ((post != null) && (post.containsKey("autoforward")) && (tabletype == 5) && (sb.wordIndex.loadedURL.getStackSize(5) == 0)) {+ if ((post != null) && (post.containsKey("autoforward")) && (tabletype == 5) && (sb.crawlResults.getStackSize(5) == 0)) {// the main menu does a request to the local crawler page, but in case this table is empty, the overview page is showntabletype = 0;}@@ -98,12 +98,12 @@ public class CrawlResults {}// do the commands- if (post.containsKey("clearlist")) sb.wordIndex.loadedURL.clearStack(tabletype);+ if (post.containsKey("clearlist")) sb.crawlResults.clearStack(tabletype);if (post.containsKey("deleteentry")) {String hash = post.get("hash", null);if (hash != null) {// delete from database- sb.wordIndex.loadedURL.remove(hash);+ sb.wordIndex.removeURL(hash);}}if (post.containsKey("moreIndexed")) {@@ -127,18 +127,18 @@ public class CrawlResults {// create tableif (tabletype == 0) {prop.put("table", "2");- } else if (sb.wordIndex.loadedURL.getStackSize(tabletype) == 0) {+ } else if (sb.crawlResults.getStackSize(tabletype) == 0) {prop.put("table", "0");} else {prop.put("table", "1");- if (lines > sb.wordIndex.loadedURL.getStackSize(tabletype)) lines = sb.wordIndex.loadedURL.getStackSize(tabletype);- if (lines == sb.wordIndex.loadedURL.getStackSize(tabletype)) {+ if (lines > sb.crawlResults.getStackSize(tabletype)) lines = sb.crawlResults.getStackSize(tabletype);+ if (lines == sb.crawlResults.getStackSize(tabletype)) {prop.put("table_size", "0");} else {prop.put("table_size", "1");prop.put("table_size_count", lines);}- prop.put("table_size_all", sb.wordIndex.loadedURL.getStackSize(tabletype));+ prop.put("table_size_all", sb.crawlResults.getStackSize(tabletype));if (showControl) {prop.put("table_showControl", "1");@@ -160,14 +160,14 @@ public class CrawlResults {indexURLEntry urle;int i, cnt = 0;- for (i = sb.wordIndex.loadedURL.getStackSize(tabletype) - 1; i >= (sb.wordIndex.loadedURL.getStackSize(tabletype) - lines); i--) {- initiatorHash = sb.wordIndex.loadedURL.getInitiatorHash(tabletype, i);- executorHash = sb.wordIndex.loadedURL.getExecutorHash(tabletype, i);+ for (i = sb.crawlResults.getStackSize(tabletype) - 1; i >= (sb.crawlResults.getStackSize(tabletype) - lines); i--) {+ initiatorHash = sb.crawlResults.getInitiatorHash(tabletype, i);+ executorHash = sb.crawlResults.getExecutorHash(tabletype, i);// serverLog.logFinest("PLASMA", "plasmaCrawlLURL/genTableProps initiatorHash=" + initiatorHash + " executorHash=" + executorHash);- urlHash = sb.wordIndex.loadedURL.getUrlHash(tabletype, i);+ urlHash = sb.crawlResults.getUrlHash(tabletype, i);// serverLog.logFinest("PLASMA", "plasmaCrawlLURL/genTableProps urlHash=" + urlHash);try {- urle = sb.wordIndex.loadedURL.load(urlHash, null, 0);+ urle = sb.wordIndex.getURL(urlHash, null, 0);indexURLEntry.Components comp = urle.comp();// serverLog.logFinest("PLASMA", "plasmaCrawlLURL/genTableProps urle=" + urle.toString());initiatorSeed = yacyCore.seedDB.getConnected(initiatorHash);diff --git a/htroot/IndexCleaner_p.java b/htroot/IndexCleaner_p.javaindex bee194f54..7bbe71858 100755--- a/htroot/IndexCleaner_p.java+++ b/htroot/IndexCleaner_p.java@@ -44,15 +44,15 @@//Contributions and changes to the program code must be marked as such.import de.anomic.http.httpHeader;-import de.anomic.plasma.plasmaCrawlLURL;+import de.anomic.index.indexRepositoryReference;import de.anomic.plasma.plasmaSwitchboard;import de.anomic.plasma.plasmaWordIndex;import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;public class IndexCleaner_p {- private static plasmaCrawlLURL.Cleaner urldbCleanerThread;- private static plasmaWordIndex.Cleaner indexCleanerThread;+ private static indexRepositoryReference.BlacklistCleaner urldbCleanerThread;+ private static plasmaWordIndex.ReferenceCleaner indexCleanerThread;public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch<?> env) {serverObjects prop = new serverObjects();@@ -62,7 +62,7 @@ public class IndexCleaner_p {//prop.putHTML("bla", "post!=null");if (post.get("action").equals("ustart")) {if (urldbCleanerThread==null || !urldbCleanerThread.isAlive()) {- urldbCleanerThread = sb.wordIndex.loadedURL.makeCleaner();+ urldbCleanerThread = sb.wordIndex.getURLCleaner(plasmaSwitchboard.urlBlacklist);urldbCleanerThread.start();}else {@@ -77,7 +77,7 @@ public class IndexCleaner_p {}else if (post.get("action").equals("rstart")) {if (indexCleanerThread==null || !indexCleanerThread.isAlive()) {- indexCleanerThread = sb.wordIndex.makeCleaner(sb.wordIndex.loadedURL, post.get("wordHash","AAAAAAAAAAAA"));+ indexCleanerThread = sb.wordIndex.getReferenceCleaner(post.get("wordHash","AAAAAAAAAAAA"));indexCleanerThread.start();}else {@@ -96,7 +96,7 @@ public class IndexCleaner_p {//prop.put("bla", "post==null");if (urldbCleanerThread!=null) {prop.put("urldb", "1");- prop.putNum("urldb_percentUrls", ((double)urldbCleanerThread.totalSearchedUrls/sb.wordIndex.loadedURL.size())*100);+ prop.putNum("urldb_percentUrls", ((double)urldbCleanerThread.totalSearchedUrls/sb.wordIndex.countURL())*100);prop.putNum("urldb_blacklisted", urldbCleanerThread.blacklistedUrls);prop.putNum("urldb_total", urldbCleanerThread.totalSearchedUrls);prop.putHTML("urldb_lastBlacklistedUrl", urldbCleanerThread.lastBlacklistedUrl);diff --git a/htroot/IndexControlRWIs_p.java b/htroot/IndexControlRWIs_p.javaindex 4928a14f4..e0b1c2b4c 100644--- a/htroot/IndexControlRWIs_p.java+++ b/htroot/IndexControlRWIs_p.java@@ -197,7 +197,7 @@ public class IndexControlRWIs_p {indexURLEntry lurl;while (urlIter.hasNext()) {iEntry = urlIter.next();- lurl = sb.wordIndex.loadedURL.load(iEntry.urlHash(), null, 0);+ lurl = sb.wordIndex.getURL(iEntry.urlHash(), null, 0);if (lurl == null) {unknownURLEntries.add(iEntry.urlHash());urlIter.remove();@@ -254,8 +254,8 @@ public class IndexControlRWIs_p {yacyURL url;for (int i=0; i<urlx.length; i++) {urlHashes.add(urlx[i]);- indexURLEntry e = sb.wordIndex.loadedURL.load(urlx[i], null, 0);- sb.wordIndex.loadedURL.remove(urlx[i]);+ indexURLEntry e = sb.wordIndex.getURL(urlx[i], null, 0);+ sb.wordIndex.removeURL(urlx[i]);if (e != null) {url = e.comp().url();pw.println(url.getHost() + "/" + url.getFile());@@ -282,8 +282,8 @@ public class IndexControlRWIs_p {yacyURL url;for (int i=0; i<urlx.length; i++) {urlHashes.add(urlx[i]);- indexURLEntry e = sb.wordIndex.loadedURL.load(urlx[i], null, 0);- sb.wordIndex.loadedURL.remove(urlx[i]);+ indexURLEntry e = sb.wordIndex.getURL(urlx[i], null, 0);+ sb.wordIndex.removeURL(urlx[i]);if (e != null) {url = e.comp().url();pw.println(url.getHost() + "/.*");diff --git a/htroot/IndexControlURLs_p.java b/htroot/IndexControlURLs_p.javaindex 555fa7592..ab335481d 100644--- a/htroot/IndexControlURLs_p.java+++ b/htroot/IndexControlURLs_p.java@@ -31,6 +31,7 @@ import java.net.MalformedURLException;import java.util.Iterator;import de.anomic.http.httpHeader;+import de.anomic.index.indexRepositoryReference;import de.anomic.index.indexURLEntry;import de.anomic.kelondro.kelondroBase64Order;import de.anomic.kelondro.kelondroRotateIterator;@@ -51,35 +52,33 @@ public class IndexControlURLs_p {prop.put("urlstring", "");prop.put("urlhash", "");prop.put("result", "");- prop.put("ucount", Integer.toString(sb.wordIndex.loadedURL.size()));+ prop.put("ucount", Integer.toString(sb.wordIndex.countURL()));prop.put("otherHosts", "");- if (sb.wordIndex.loadedURL.export_running()) {+ indexRepositoryReference.Export export = sb.wordIndex.exportURL();+ if ((export != null) && (export.isAlive())) {// there is currently a running exportprop.put("lurlexportfinished", 0);prop.put("lurlexporterror", 0);prop.put("lurlexport", 2);- prop.put("lurlexport_exportfile", sb.wordIndex.loadedURL.export_file().toString());- prop.put("lurlexport_urlcount", sb.wordIndex.loadedURL.export_count());+ prop.put("lurlexport_exportfile", export.file().toString());+ prop.put("lurlexport_urlcount", export.count());} else {prop.put("lurlexport", 1);prop.put("lurlexport_exportfile", sb.getRootPath() + "/DATA/EXPORT/" + serverDate.formatShortSecond());prop.put("lurlexportfinished", 0);prop.put("lurlexporterror", 0);- if (sb.wordIndex.loadedURL.export_failed() == null) {+ if (export == null) {// the export is finished, or there has not been a export- if (sb.wordIndex.loadedURL.export_count() > 0) {- // an export is finished- prop.put("lurlexportfinished", 1);- prop.put("lurlexportfinished_exportfile", sb.wordIndex.loadedURL.export_file().toString());- prop.put("lurlexportfinished_urlcount", sb.wordIndex.loadedURL.export_count());- }+ prop.put("lurlexportfinished", 1);+ prop.put("lurlexportfinished_exportfile", "");+ prop.put("lurlexportfinished_urlcount", 0);} else {// the export had errorsprop.put("lurlexporterror", 1);- prop.put("lurlexporterror_exportfile", sb.wordIndex.loadedURL.export_file().toString());- prop.put("lurlexporterror_exportfailmsg", sb.wordIndex.loadedURL.export_failed());+ prop.put("lurlexporterror_exportfile", export.file().toString());+ prop.put("lurlexporterror_exportfailmsg", export.failed());}}if (post == null || env == null) {@@ -104,7 +103,7 @@ public class IndexControlURLs_p {}if (post.containsKey("urlhashdelete")) {- indexURLEntry entry = sb.wordIndex.loadedURL.load(urlhash, null, 0);+ indexURLEntry entry = sb.wordIndex.getURL(urlhash, null, 0);if (entry == null) {prop.put("result", "No Entry for URL hash " + urlhash + "; nothing deleted.");} else {@@ -136,7 +135,7 @@ public class IndexControlURLs_p {yacyURL url = new yacyURL(urlstring, null);urlhash = url.hash();prop.put("urlhash", urlhash);- indexURLEntry entry = sb.wordIndex.loadedURL.load(urlhash, null, 0);+ indexURLEntry entry = sb.wordIndex.getURL(urlhash, null, 0);if (entry == null) {prop.putHTML("urlstring", "unknown url: " + urlstring);prop.put("urlhash", "");@@ -151,7 +150,7 @@ public class IndexControlURLs_p {}if (post.containsKey("urlhashsearch")) {- indexURLEntry entry = sb.wordIndex.loadedURL.load(urlhash, null, 0);+ indexURLEntry entry = sb.wordIndex.getURL(urlhash, null, 0);if (entry == null) {prop.put("result", "No Entry for URL hash " + urlhash);} else {@@ -164,7 +163,7 @@ public class IndexControlURLs_p {// generate listif (post.containsKey("urlhashsimilar")) {try {- final Iterator<indexURLEntry> entryIt = new kelondroRotateIterator<indexURLEntry>(sb.wordIndex.loadedURL.entries(true, urlhash), new String(kelondroBase64Order.zero(urlhash.length())), sb.wordIndex.size());+ final Iterator<indexURLEntry> entryIt = new kelondroRotateIterator<indexURLEntry>(sb.wordIndex.entriesURL(true, urlhash), new String(kelondroBase64Order.zero(urlhash.length())), sb.wordIndex.size());StringBuffer result = new StringBuffer("Sequential List of URL-Hashes:<br />");indexURLEntry entry;int i = 0;@@ -209,17 +208,17 @@ public class IndexControlURLs_p {File f = new File(s);f.getParentFile().mkdirs();String filter = post.get("exportfilter", ".*");- boolean running = sb.wordIndex.loadedURL.export(f, filter, format, dom);+ indexRepositoryReference.Export running = sb.wordIndex.exportURL(f, filter, format, dom);prop.put("lurlexport_exportfile", s);- prop.put("lurlexport_urlcount", sb.wordIndex.loadedURL.export_count());- if ((running) && (sb.wordIndex.loadedURL.export_failed() == null)) {+ prop.put("lurlexport_urlcount", running.count());+ if ((running != null) && (running.failed() == null)) {prop.put("lurlexport", 2);}}// insert constants- prop.putNum("ucount", sb.wordIndex.loadedURL.size());+ prop.putNum("ucount", sb.wordIndex.countURL());// return rewrite propertiesreturn prop;}@@ -232,7 +231,7 @@ public class IndexControlURLs_p {return prop;}indexURLEntry.Components comp = entry.comp();- indexURLEntry le = ((entry.referrerHash() == null) || (entry.referrerHash().length() != yacySeedDB.commonHashLength)) ? null : switchboard.wordIndex.loadedURL.load(entry.referrerHash(), null, 0);+ indexURLEntry le = ((entry.referrerHash() == null) || (entry.referrerHash().length() != yacySeedDB.commonHashLength)) ? null : switchboard.wordIndex.getURL(entry.referrerHash(), null, 0);if (comp.url() == null) {prop.put("genUrlProfile", "1");prop.put("genUrlProfile_urlhash", urlhash);diff --git a/htroot/IndexImport_p.java b/htroot/IndexImport_p.javaindex d5d56c7ef..675c94330 100644--- a/htroot/IndexImport_p.java+++ b/htroot/IndexImport_p.java@@ -140,7 +140,7 @@ public final class IndexImport_p {}prop.putNum("wcount", switchboard.wordIndex.size());- prop.putNum("ucount", switchboard.wordIndex.loadedURL.size());+ prop.putNum("ucount", switchboard.wordIndex.countURL());/** Loop over all currently running jobsdiff --git a/htroot/IndexShare_p.java b/htroot/IndexShare_p.javaindex e9f127b52..cbb465f94 100644--- a/htroot/IndexShare_p.java+++ b/htroot/IndexShare_p.java@@ -66,7 +66,7 @@ public class IndexShare_p {prop.put("dtable", "");prop.put("rtable", "");prop.putNum("wcount", switchboard.wordIndex.size());- prop.putNum("ucount", switchboard.wordIndex.loadedURL.size());+ prop.putNum("ucount", switchboard.wordIndex.countURL());return prop; // be save}@@ -79,7 +79,7 @@ public class IndexShare_p {// insert constantsprop.putNum("wcount", switchboard.wordIndex.size());- prop.putNum("ucount", switchboard.wordIndex.loadedURL.size());+ prop.putNum("ucount", switchboard.wordIndex.countURL());// return rewrite propertiesreturn prop;diff --git a/htroot/IndexTransfer_p.java b/htroot/IndexTransfer_p.javaindex e6f99372a..f73756038 100644--- a/htroot/IndexTransfer_p.java+++ b/htroot/IndexTransfer_p.java@@ -96,7 +96,7 @@ public final class IndexTransfer_p {// insert constantsprop.putNum("wcount", switchboard.wordIndex.size());- prop.putNum("ucount", switchboard.wordIndex.loadedURL.size());+ prop.putNum("ucount", switchboard.wordIndex.countURL());prop.put("running",(switchboard.transferIdxThread==null) ? "0" : "1");if (switchboard.transferIdxThread != null) {String[] status = switchboard.transferIdxThread.getStatus();diff --git a/htroot/PerformanceQueues_p.java b/htroot/PerformanceQueues_p.javaindex 8b59b8b67..36ae36679 100644--- a/htroot/PerformanceQueues_p.java+++ b/htroot/PerformanceQueues_p.java@@ -234,7 +234,7 @@ public class PerformanceQueues_p {}// table cache settings- prop.putNum("urlCacheSize", switchboard.wordIndex.loadedURL.writeCacheSize());+ prop.putNum("urlCacheSize", switchboard.wordIndex.getURLwriteCacheSize());prop.putNum("wordCacheWSize", switchboard.wordIndex.dhtOutCacheSize());prop.putNum("wordCacheKSize", switchboard.wordIndex.dhtInCacheSize());prop.putNum("wordCacheWSizeKBytes", switchboard.wordIndex.dhtCacheSizeBytes(false)/1024);diff --git a/htroot/QuickCrawlLink_p.java b/htroot/QuickCrawlLink_p.javaindex c21d962fb..02c05a002 100644--- a/htroot/QuickCrawlLink_p.java+++ b/htroot/QuickCrawlLink_p.java@@ -139,7 +139,7 @@ public class QuickCrawlLink_p {}String urlhash = crawlingStartURL.hash();- switchboard.wordIndex.loadedURL.remove(urlhash);+ switchboard.wordIndex.removeURL(urlhash);switchboard.crawlQueues.noticeURL.removeByURLHash(urlhash);switchboard.crawlQueues.errorURL.remove(urlhash);diff --git a/htroot/ViewFile.java b/htroot/ViewFile.javaindex 04a4df611..13a1f5d3b 100644--- a/htroot/ViewFile.java+++ b/htroot/ViewFile.java@@ -109,7 +109,7 @@ public class ViewFile {if (urlHash.length() > 0) {// getting the urlEntry that belongs to the url hashindexURLEntry urlEntry = null;- urlEntry = sb.wordIndex.loadedURL.load(urlHash, null, 0);+ urlEntry = sb.wordIndex.getURL(urlHash, null, 0);if (urlEntry == null) {prop.put("error", "2");prop.put("viewMode",VIEW_MODE_NO_TEXT);diff --git a/htroot/WatchCrawler_p.java b/htroot/WatchCrawler_p.javaindex 563429909..574a95440 100644--- a/htroot/WatchCrawler_p.java+++ b/htroot/WatchCrawler_p.java@@ -185,7 +185,7 @@ public class WatchCrawler_p {// first delete old entry, if existsyacyURL url = new yacyURL(crawlingStart, null);String urlhash = url.hash();- switchboard.wordIndex.loadedURL.remove(urlhash);+ switchboard.wordIndex.removeURL(urlhash);switchboard.crawlQueues.noticeURL.removeByURLHash(urlhash);switchboard.crawlQueues.errorURL.remove(urlhash);diff --git a/htroot/xml/queues_p.java b/htroot/xml/queues_p.javaindex 2894f1499..d0b40e6a7 100644--- a/htroot/xml/queues_p.java+++ b/htroot/xml/queues_p.java@@ -89,7 +89,7 @@ public class queues_p {//indexing queueprop.putNum("indexingSize", sb.getThread(plasmaSwitchboard.INDEXER).getJobCount()+sb.indexingTasksInProcess.size());prop.putNum("indexingMax", (int) sb.getConfigLong(plasmaSwitchboard.INDEXER_SLOTS, 30));- prop.putNum("urlpublictextSize", sb.wordIndex.loadedURL.size());+ prop.putNum("urlpublictextSize", sb.wordIndex.countURL());prop.putNum("rwipublictextSize", sb.wordIndex.size());if ((sb.sbQueue.size() == 0) && (sb.indexingTasksInProcess.size() == 0)) {prop.put("list", "0"); //is emptydiff --git a/htroot/yacy/crawlReceipt.java b/htroot/yacy/crawlReceipt.javaindex 481d5fbf0..3778f23a5 100644--- a/htroot/yacy/crawlReceipt.java+++ b/htroot/yacy/crawlReceipt.java@@ -132,7 +132,7 @@ public final class crawlReceipt {}// generating a new loaded URL entry- indexURLEntry entry = switchboard.wordIndex.loadedURL.newEntry(propStr);+ indexURLEntry entry = indexURLEntry.importEntry(propStr);if (entry == null) {log.logWarning("crawlReceipt: RECEIVED wrong RECEIPT (entry null) from peer " + iam + "\n\tURL properties: "+ propStr);prop.put("delay", "3600");@@ -155,8 +155,8 @@ public final class crawlReceipt {if (result.equals("fill")) try {// put new entry into database- switchboard.wordIndex.loadedURL.store(entry);- switchboard.wordIndex.loadedURL.stack(entry, youare, iam, 1);+ switchboard.wordIndex.putURL(entry);+ switchboard.crawlResults.stack(entry, youare, iam, 1);switchboard.crawlQueues.delegatedURL.remove(entry.hash()); // the delegated work has been donelog.logInfo("crawlReceipt: RECEIVED RECEIPT from " + otherPeerName + " for URL " + entry.hash() + ":" + comp.url().toNormalform(false, true));diff --git a/htroot/yacy/query.java b/htroot/yacy/query.javaindex c8fbf45e0..2872e1af5 100644--- a/htroot/yacy/query.java+++ b/htroot/yacy/query.java@@ -110,7 +110,7 @@ public final class query {if (obj.equals("lurlcount")) {// return the number of all available l-url's- prop.put("response", sb.wordIndex.loadedURL.size());+ prop.put("response", sb.wordIndex.countURL());return prop;}diff --git a/htroot/yacy/search.java b/htroot/yacy/search.javaindex 4b382e213..6e8d43c2f 100644--- a/htroot/yacy/search.java+++ b/htroot/yacy/search.java@@ -179,7 +179,7 @@ public final class search {yacyCore.log.logInfo("INIT HASH SEARCH (query-" + abstracts + "): " + plasmaSearchQuery.anonymizedQueryHashes(theQuery.queryHashes) + " - " + theQuery.displayResults() + " links");// make event- theSearch = plasmaSearchEvent.getEvent(theQuery, rankingProfile, sb.wordIndex, null, true);+ theSearch = plasmaSearchEvent.getEvent(theQuery, rankingProfile, sb.wordIndex, sb.crawlResults, null, true);// set statistic details of search result and find best result index setif (theSearch.getRankingResult().getLocalResourceSize() == 0) {diff --git a/htroot/yacy/transferRWI.java b/htroot/yacy/transferRWI.javaindex 384878fbe..10e01f3ad 100644--- a/htroot/yacy/transferRWI.java+++ b/htroot/yacy/transferRWI.java@@ -172,7 +172,7 @@ public final class transferRWI {// check if we need to ask for the corresponding URLif (!(knownURL.contains(urlHash)||unknownURL.contains(urlHash))) try {- if (sb.wordIndex.loadedURL.exists(urlHash)) {+ if (sb.wordIndex.existsURL(urlHash)) {knownURL.add(urlHash);} else {unknownURL.add(urlHash);diff --git a/htroot/yacy/transferURL.java b/htroot/yacy/transferURL.javaindex da35f8c4c..547b273d2 100644--- a/htroot/yacy/transferURL.java+++ b/htroot/yacy/transferURL.java@@ -98,7 +98,7 @@ public final class transferURL {} else {int received = 0;int blocked = 0;- final int sizeBefore = sb.wordIndex.loadedURL.size();+ final int sizeBefore = sb.wordIndex.countURL();// read the urls from the other properties and storeString urls;indexURLEntry lEntry;@@ -114,7 +114,7 @@ public final class transferURL {}// parse new lurl-entry- lEntry = sb.wordIndex.loadedURL.newEntry(urls);+ lEntry = indexURLEntry.importEntry(urls);if (lEntry == null) {yacyCore.log.logWarning("transferURL: received invalid URL (entry null) from peer " + otherPeerName + "\n\tURL Property: " + urls);blocked++;@@ -155,8 +155,8 @@ public final class transferURL {// write entry to databasetry {- sb.wordIndex.loadedURL.store(lEntry);- sb.wordIndex.loadedURL.stack(lEntry, iam, iam, 3);+ sb.wordIndex.putURL(lEntry);+ sb.crawlResults.stack(lEntry, iam, iam, 3);yacyCore.log.logFine("transferURL: received URL '" + comp.url().toNormalform(false, true) + "' from peer " + otherPeerName);received++;} catch (IOException e) {@@ -167,7 +167,7 @@ public final class transferURL {yacyCore.seedDB.mySeed().incRU(received);// return rewrite properties- final int more = sb.wordIndex.loadedURL.size() - sizeBefore;+ final int more = sb.wordIndex.countURL() - sizeBefore;doublevalues = Integer.toString(received - more);sb.getLog().logInfo("Received " + received + " URLs from peer " + otherPeerName + " in " + (System.currentTimeMillis() - start) + " ms, Blocked " + blocked + " URLs");if ((received - more) > 0) sb.getLog().logSevere("Received " + doublevalues + " double URLs from peer " + otherPeerName);diff --git a/htroot/yacy/ui/result.java b/htroot/yacy/ui/result.javaindex 9b2dad521..d233cfc08 100644--- a/htroot/yacy/ui/result.java+++ b/htroot/yacy/ui/result.java@@ -203,7 +203,7 @@ public class result {theQuery.setOffset(0); // in case that this is a new search, always start without a offsetoffset = 0;}- plasmaSearchEvent theSearch = plasmaSearchEvent.getEvent(theQuery, ranking, sb.wordIndex, (sb.isRobinsonMode()) ? sb.clusterhashes : null, false);+ plasmaSearchEvent theSearch = plasmaSearchEvent.getEvent(theQuery, ranking, sb.wordIndex, sb.crawlResults, (sb.isRobinsonMode()) ? sb.clusterhashes : null, false);// generate result objectserverLog.logFine("LOCAL_SEARCH", "SEARCH TIME AFTER ORDERING OF SEARCH RESULTS: " + ((System.currentTimeMillis() - timestamp) / 1000) + " seconds");diff --git a/htroot/yacy/ui/ymarks.java b/htroot/yacy/ui/ymarks.javaindex 148472f70..790fd0b77 100644--- a/htroot/yacy/ui/ymarks.java+++ b/htroot/yacy/ui/ymarks.java@@ -196,7 +196,7 @@ public class ymarks {bookmarksDB.Bookmark bookmark = switchboard.bookmarksDB.getBookmark(urlHash);if (bookmark == null) {// try to get the bookmark from the LURL database- indexURLEntry urlentry = switchboard.wordIndex.loadedURL.load(urlHash, null, 0);+ indexURLEntry urlentry = switchboard.wordIndex.getURL(urlHash, null, 0);plasmaParserDocument document = null;if (urlentry != null) {indexURLEntry.Components comp = urlentry.comp();diff --git a/htroot/yacy/urls.java b/htroot/yacy/urls.javaindex 3f1031635..7eb0e4c5d 100644--- a/htroot/yacy/urls.java+++ b/htroot/yacy/urls.java@@ -98,7 +98,7 @@ public class urls {indexURLEntry.Components comp;yacyURL referrer;for (int i = 0; i < count; i++) {- entry = sb.wordIndex.loadedURL.load(urlhashes.substring(12 * i, 12 * (i + 1)), null, 0);+ entry = sb.wordIndex.getURL(urlhashes.substring(12 * i, 12 * (i + 1)), null, 0);if (entry == null) continue;// find referrer, if there is onereferrer = sb.getURL(entry.referrerHash());diff --git a/htroot/yacy/user/ysearch.java b/htroot/yacy/user/ysearch.javaindex 3f704857d..1f78fee52 100644--- a/htroot/yacy/user/ysearch.java+++ b/htroot/yacy/user/ysearch.java@@ -203,7 +203,7 @@ public class ysearch {theQuery.setOffset(0); // in case that this is a new search, always start without a offsetoffset = 0;}- plasmaSearchEvent theSearch = plasmaSearchEvent.getEvent(theQuery, ranking, sb.wordIndex, (sb.isRobinsonMode()) ? sb.clusterhashes : null, false);+ plasmaSearchEvent theSearch = plasmaSearchEvent.getEvent(theQuery, ranking, sb.wordIndex, sb.crawlResults, (sb.isRobinsonMode()) ? sb.clusterhashes : null, false);// generate result objectserverLog.logFine("LOCAL_SEARCH", "SEARCH TIME AFTER ORDERING OF SEARCH RESULTS: " + ((System.currentTimeMillis() - timestamp) / 1000) + " seconds");diff --git a/htroot/yacysearch.java b/htroot/yacysearch.javaindex e732e5c7f..9337d0886 100644--- a/htroot/yacysearch.java+++ b/htroot/yacysearch.java@@ -216,7 +216,7 @@ public class yacysearch {return prop;}final String recommendHash = post.get("recommendref", ""); // urlhash- indexURLEntry urlentry = sb.wordIndex.loadedURL.load(recommendHash, null, 0);+ indexURLEntry urlentry = sb.wordIndex.getURL(recommendHash, null, 0);if (urlentry != null) {indexURLEntry.Components comp = urlentry.comp();plasmaParserDocument document;@@ -278,7 +278,7 @@ public class yacysearch {theQuery.setOffset(0); // in case that this is a new search, always start without a offsetoffset = 0;}- plasmaSearchEvent theSearch = plasmaSearchEvent.getEvent(theQuery, ranking, sb.wordIndex, (sb.isRobinsonMode()) ? sb.clusterhashes : null, false);+ plasmaSearchEvent theSearch = plasmaSearchEvent.getEvent(theQuery, ranking, sb.wordIndex, sb.crawlResults, (sb.isRobinsonMode()) ? sb.clusterhashes : null, false);// generate result objectserverLog.logFine("LOCAL_SEARCH", "SEARCH TIME AFTER ORDERING OF SEARCH RESULTS: " + ((System.currentTimeMillis() - timestamp) / 1000) + " seconds");diff --git a/source/de/anomic/data/SitemapParser.java b/source/de/anomic/data/SitemapParser.javaindex aebe31e07..a94a483fd 100644--- a/source/de/anomic/data/SitemapParser.java+++ b/source/de/anomic/data/SitemapParser.java@@ -286,7 +286,7 @@ public class SitemapParser extends DefaultHandler {String dbocc = this.switchboard.urlExists(nexturlhash);if ((dbocc != null) && (dbocc.equalsIgnoreCase("loaded"))) {// the url was already loaded. we need to check the date- indexURLEntry oldEntry = this.switchboard.wordIndex.loadedURL.load(nexturlhash, null, 0);+ indexURLEntry oldEntry = switchboard.wordIndex.getURL(nexturlhash, null, 0);if (oldEntry != null) {Date modDate = oldEntry.moddate();// check if modDate is nulldiff --git a/source/de/anomic/http/httpc.java b/source/de/anomic/http/httpc.javaindex 4b9919cd8..6ae599a13 100644--- a/source/de/anomic/http/httpc.java+++ b/source/de/anomic/http/httpc.java@@ -395,15 +395,29 @@ public final class httpc {// trying to establish a connection to the addressthis.initTime = System.currentTimeMillis();this.lastIO = System.currentTimeMillis();- this.socket.setKeepAlive(true);- // set socket timeout and keep alive behavior+ //this.socket.setKeepAlive(true); // set socket timeout and keep alive behaviorassert timeout >= 1000;- this.socket.setSoTimeout(timeout); // waiting time for read+ this.socket.setSoTimeout(0); // waiting time for read; 0 means: no timeout, wait foreverthis.socket.setTcpNoDelay(true); // no accumulation until buffer is full- this.socket.setSoLinger(false, timeout); // !wait for all data being written on close()+ this.socket.setSoLinger(false, 0); // !wait for all data being written on close()this.socket.setSendBufferSize(1440); // read http://www.cisco.com/warp/public/105/38.shtml- this.socket.setReceiveBufferSize(1440); // read http://www.cisco.com/warp/public/105/38.shtml+ //this.socket.setReceiveBufferSize(1440); // read http://www.cisco.com/warp/public/105/38.shtml+ /*++ public int getSoTimeout() {+ return getIntParameter(SO_TIMEOUT, 0);+ public boolean getTcpNoDelay() {+ return getBooleanParameter(TCP_NODELAY, true);+ public int getLinger() {+ return getIntParameter(SO_LINGER, -1);+ public int getSendBufferSize() {+ return getIntParameter(SO_SNDBUF, -1);+ public int getReceiveBufferSize() {+ return getIntParameter(SO_RCVBUF, -1);++ */+// get the connectionthis.socket.connect(address, timeout);@@ -435,7 +449,48 @@ public final class httpc {throw e;}}-+ /* code from apache commons+ protected boolean isStale() throws IOException {+ boolean isStale = true;+ if (isOpen) {+ // the connection is open, but now we have to see if we can read it+ // assume the connection is not stale.+ isStale = false;+ try {+ if (inputStream.available() <= 0) {+ try {+ socket.setSoTimeout(1);+ inputStream.mark(1);+ int byteRead = inputStream.read();+ if (byteRead == -1) {+ // again - if the socket is reporting all data read,+ // probably stale+ isStale = true;+ } else {+ inputStream.reset();+ }+ } finally {+ socket.setSoTimeout(this.params.getSoTimeout());+ }+ }+ } catch (InterruptedIOException e) {+ if (!ExceptionUtil.isSocketTimeoutException(e)) {+ throw e;+ }+ // aha - the connection is NOT stale - continue on!+ } catch (IOException e) {+ // oops - the connection is stale, the read or soTimeout failed.+ LOG.debug(+ "An error occurred while reading from the socket, is appears to be stale",+ e+ );+ isStale = true;+ }+ }++ return isStale;+ }+*/public long getInputStreamByteCount() {return (this.clientInputByteCount == null)?0:this.clientInputByteCount.getCount();}diff --git a/source/de/anomic/index/indexRepositoryReference.java b/source/de/anomic/index/indexRepositoryReference.javanew file mode 100644index 000000000..0328d7a39--- /dev/null+++ b/source/de/anomic/index/indexRepositoryReference.java@@ -0,0 +1,513 @@+// indexRepositoryReference.java+// (C) 2006 by Michael Peter Christen; [email protected], Frankfurt a. M., Germany+// first published 2006 as part of 'plasmaCrawlLURL.java' on http://yacy.net+//+// This is a part of YaCy, a peer-to-peer based web search engine+//+// $LastChangedDate: 2006-04-02 22:40:07 +0200 (So, 02 Apr 2006) $+// $LastChangedRevision: 1986 $+// $LastChangedBy: orbiter $+//+// LICENSE+//+// 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++package de.anomic.index;++import java.io.BufferedOutputStream;+import java.io.File;+import java.io.FileOutputStream;+import java.io.IOException;+import java.io.PrintWriter;+import java.util.Date;+import java.util.HashSet;+import java.util.Iterator;++import de.anomic.data.htmlTools;+import de.anomic.http.httpRemoteProxyConfig;+import de.anomic.http.httpc;+import de.anomic.http.httpc.response;+import de.anomic.kelondro.kelondroBase64Order;+import de.anomic.kelondro.kelondroCache;+import de.anomic.kelondro.kelondroCloneableIterator;+import de.anomic.kelondro.kelondroException;+import de.anomic.kelondro.kelondroIndex;+import de.anomic.kelondro.kelondroRow;+import de.anomic.kelondro.kelondroRowSet;+import de.anomic.kelondro.kelondroSplitTable;+import de.anomic.plasma.urlPattern.plasmaURLPattern;+import de.anomic.server.serverCodings;+import de.anomic.server.logging.serverLog;+import de.anomic.yacy.yacyURL;++public final class indexRepositoryReference {++ // class objects+ private kelondroIndex urlIndexFile;+ private Export exportthread = null; // will habe a export thread assigned if exporter is running++ public indexRepositoryReference(File indexSecondaryRoot, String networkName) {+ super();+ File indexSecondaryPath = new File(indexSecondaryRoot, networkName);+ File indexSecondaryTextLocation = new File(indexSecondaryPath, "TEXT");+ if (!indexSecondaryTextLocation.exists()) {+ // patch old index locations; the secondary path is patched in plasmaCrawlLURL+ File oldSecondaryPath = new File(new File(indexSecondaryRoot, "PUBLIC"), "TEXT");+ File oldSecondaryTextLocation = new File(new File(indexSecondaryRoot, "PUBLIC"), "TEXT");+ if (oldSecondaryPath.exists() && oldSecondaryTextLocation.exists()) {+ // move the text folder from the old location to the new location+ assert !indexSecondaryTextLocation.exists();+ indexSecondaryTextLocation.mkdirs();+ if (oldSecondaryTextLocation.renameTo(indexSecondaryTextLocation)) {+ if (!oldSecondaryPath.delete()) oldSecondaryPath.deleteOnExit();+ } else {+ indexSecondaryTextLocation = oldSecondaryTextLocation; // emergency case: stay with old directory+ }+ }+ }++ urlIndexFile = new kelondroSplitTable(indexSecondaryTextLocation, "urls", indexURLEntry.rowdef, false);+ }++ public int size() {+ return urlIndexFile.size();+ }++ public void close() {+ if (urlIndexFile != null) {+ urlIndexFile.close();+ urlIndexFile = null;+ }+ }++ public synchronized int writeCacheSize() {+ if (urlIndexFile instanceof kelondroSplitTable) return ((kelondroSplitTable) urlIndexFile).writeBufferSize();+ if (urlIndexFile instanceof kelondroCache) return ((kelondroCache) urlIndexFile).writeBufferSize();+ return 0;+ }++ public synchronized indexURLEntry load(String urlHash, indexRWIEntry searchedWord, long ranking) {+ // generates an plasmaLURLEntry using the url hash+ // if the url cannot be found, this returns null+ if (urlHash == null) return null;+ try {+ kelondroRow.Entry entry = urlIndexFile.get(urlHash.getBytes());+ if (entry == null) return null;+ return new indexURLEntry(entry, searchedWord, ranking);+ } catch (IOException e) {+ return null;+ }+ }++ public synchronized void store(indexURLEntry entry) throws IOException {+ // Check if there is a more recent Entry already in the DB+ indexURLEntry oldEntry;+ try {+ if (exists(entry.hash())) {+ oldEntry = load(entry.hash(), null, 0);+ } else {+ oldEntry = null;+ }+ } catch (Exception e) {+ e.printStackTrace();+ oldEntry = null;+ }+ if ((oldEntry != null) && (entry.isOlder(oldEntry))) {+ // the fetched oldEntry is better, so return its properties instead of the new ones+ // this.urlHash = oldEntry.urlHash; // unnecessary, should be the same+ // this.url = oldEntry.url; // unnecessary, should be the same+ entry = oldEntry;+ return; // this did not need to be stored, but is updated+ }++ urlIndexFile.put(entry.toRowEntry(), new Date() /*entry.loaddate()*/);+ }++ public synchronized indexURLEntry newEntry(String propStr) {+ if (propStr != null && propStr.startsWith("{") && propStr.endsWith("}")) try {+ return new indexURLEntry(serverCodings.s2p(propStr.substring(1, propStr.length() - 1)));+ } catch (kelondroException e) {+ // wrong format+ return null;+ } else {+ return null;+ }+ }++ public synchronized boolean remove(String urlHash) {+ if (urlHash == null) return false;+ try {+ kelondroRow.Entry r = urlIndexFile.remove(urlHash.getBytes(), false);+ return r != null;+ } catch (IOException e) {+ return false;+ }+ }++ public synchronized boolean exists(String urlHash) {+ if (urlIndexFile == null) return false; // case may happen during shutdown+ try {+ return urlIndexFile.has(urlHash.getBytes());+ } catch (IOException e) {+ return false;+ }+ }++ public kelondroCloneableIterator<indexURLEntry> entries(boolean up, String firstHash) throws IOException {+ // enumerates entry elements+ return new kiter(up, firstHash);+ }++ public class kiter implements kelondroCloneableIterator<indexURLEntry> {+ // enumerates entry elements+ private Iterator<kelondroRow.Entry> iter;+ private boolean error;+ boolean up;++ public kiter(boolean up, String firstHash) throws IOException {+ this.up = up;+ this.iter = urlIndexFile.rows(up, (firstHash == null) ? null : firstHash.getBytes());+ this.error = false;+ }++ public kiter clone(Object secondHash) {+ try {+ return new kiter(up, (String) secondHash);+ } catch (IOException e) {+ return null;+ }+ }++ public final boolean hasNext() {+ if (this.error) return false;+ if (this.iter == null) return false;+ return this.iter.hasNext();+ }++ public final indexURLEntry next() {+ kelondroRow.Entry e = null;+ if (this.iter == null) { return null; }+ if (this.iter.hasNext()) { e = this.iter.next(); }+ if (e == null) { return null; }+ return new indexURLEntry(e, null, 0);+ }++ public final void remove() {+ this.iter.remove();+ }+ }+++ /**+ * Uses an Iteration over urlHash.db to detect malformed URL-Entries.+ * Damaged URL-Entries will be marked in a HashSet and removed at the end of the function.+ *+ * @param homePath Root-Path where all information is to be found.+ */+ public void deadlinkCleaner(httpRemoteProxyConfig proxyConfig) {+ serverLog log = new serverLog("URLDBCLEANUP");+ HashSet<String> damagedURLS = new HashSet<String>();+ try {+ Iterator<indexURLEntry> eiter = entries(true, null);+ int iteratorCount = 0;+ while (eiter.hasNext()) try {+ eiter.next();+ iteratorCount++;+ } catch (RuntimeException e) {+ if(e.getMessage() != null) {+ String m = e.getMessage();+ damagedURLS.add(m.substring(m.length() - 12));+ } else {+ log.logSevere("RuntimeException:", e);+ }+ }+ try { Thread.sleep(1000); } catch (InterruptedException e) { }+ log.logInfo("URLs vorher: " + urlIndexFile.size() + " Entries loaded during Iteratorloop: " + iteratorCount + " kaputte URLs: " + damagedURLS.size());++ Iterator<String> eiter2 = damagedURLS.iterator();+ String urlHash;+ while (eiter2.hasNext()) {+ urlHash = (String) eiter2.next();++ // trying to fix the invalid URL+ httpc theHttpc = null;+ String oldUrlStr = null;+ try {+ // getting the url data as byte array+ kelondroRow.Entry entry = urlIndexFile.get(urlHash.getBytes());++ // getting the wrong url string+ oldUrlStr = entry.getColString(1, null).trim();++ int pos = -1;+ if ((pos = oldUrlStr.indexOf("://")) != -1) {+ // trying to correct the url+ String newUrlStr = "http://" + oldUrlStr.substring(pos + 3);+ yacyURL newUrl = new yacyURL(newUrlStr, null);++ // doing a http head request to test if the url is correct+ theHttpc = new httpc(newUrl.getHost(), newUrl.getHost(), newUrl.getPort(), 30000, false, proxyConfig, null, null);+ response res = theHttpc.HEAD(newUrl.getPath(), null);++ if (res.statusCode == 200) {+ entry.setCol(1, newUrl.toString().getBytes());+ urlIndexFile.put(entry);+ log.logInfo("UrlDB-Entry with urlHash '" + urlHash + "' corrected\n\tURL: " + oldUrlStr + " -> " + newUrlStr);+ } else {+ remove(urlHash);+ log.logInfo("UrlDB-Entry with urlHash '" + urlHash + "' removed\n\tURL: " + oldUrlStr + "\n\tConnection Status: " + res.status);+ }+ theHttpc.close();+ }+ } catch (Exception e) {+ remove(urlHash);+ log.logInfo("UrlDB-Entry with urlHash '" + urlHash + "' removed\n\tURL: " + oldUrlStr + "\n\tExecption: " + e.getMessage());+ } finally {+ if (theHttpc != null) try {+ theHttpc.close();+ } catch (Exception e) { }+ }+ }++ log.logInfo("URLs nachher: " + size() + " kaputte URLs: " + damagedURLS.size());+ } catch (IOException e) {+ log.logSevere("IOException", e);+ }+ }++ public BlacklistCleaner getBlacklistCleaner(plasmaURLPattern blacklist) {+ return new BlacklistCleaner(blacklist);+ }++ public class BlacklistCleaner extends Thread {++ private boolean run = true;+ private boolean pause;+ public int blacklistedUrls = 0;+ public int totalSearchedUrls = 1;+ public String lastBlacklistedUrl = "";+ public String lastBlacklistedHash = "";+ public String lastUrl = "";+ public String lastHash = "";+ private plasmaURLPattern blacklist;++ public BlacklistCleaner(plasmaURLPattern blacklist) {+ this.blacklist = blacklist;+ }++ public void run() {+ try {+ serverLog.logInfo("URLDBCLEANER", "UrldbCleaner-Thread startet");+ final Iterator<indexURLEntry> eiter = entries(true, null);+ while (eiter.hasNext() && run) {+ synchronized (this) {+ if (this.pause) {+ try {+ this.wait();+ } catch (InterruptedException e) {+ serverLog.logWarning("URLDBCLEANER", "InterruptedException", e);+ this.run = false;+ return;+ }+ }+ }+ final indexURLEntry entry = eiter.next();+ if (entry == null) {+ serverLog.logFine("URLDBCLEANER", "entry == null");+ } else if (entry.hash() == null) {+ serverLog.logFine("URLDBCLEANER", ++blacklistedUrls + " blacklisted (" + ((double) blacklistedUrls / totalSearchedUrls) * 100 + "%): " + "hash == null");+ } else {+ final indexURLEntry.Components comp = entry.comp();+ totalSearchedUrls++;+ if (comp.url() == null) {+ serverLog.logFine("URLDBCLEANER", ++blacklistedUrls + " blacklisted (" + ((double) blacklistedUrls / totalSearchedUrls) * 100 + "%): " + entry.hash() + "URL == null");+ remove(entry.hash());+ } else if (blacklist.isListed(plasmaURLPattern.BLACKLIST_CRAWLER, comp.url()) ||+ blacklist.isListed(plasmaURLPattern.BLACKLIST_DHT, comp.url())) {+ lastBlacklistedUrl = comp.url().toNormalform(true, true);+ lastBlacklistedHash = entry.hash();+ serverLog.logFine("URLDBCLEANER", ++blacklistedUrls + " blacklisted (" + ((double) blacklistedUrls / totalSearchedUrls) * 100 + "%): " + entry.hash() + " " + comp.url().toNormalform(false, true));+ remove(entry.hash());+ if (blacklistedUrls % 100 == 0) {+ serverLog.logInfo("URLDBCLEANER", "Deleted " + blacklistedUrls + " URLs until now. Last deleted URL-Hash: " + lastBlacklistedUrl);+ }+ }+ lastUrl = comp.url().toNormalform(true, true);+ lastHash = entry.hash();+ }+ }+ } catch (RuntimeException e) {+ if (e.getMessage() != null && e.getMessage().indexOf("not found in LURL") != -1) {+ serverLog.logWarning("URLDBCLEANER", "urlHash not found in LURL", e);+ }+ else {+ serverLog.logWarning("URLDBCLEANER", "RuntimeException", e);+ run = false;+ }+ } catch (IOException e) {+ e.printStackTrace();+ run = false;+ }+ serverLog.logInfo("URLDBCLEANER", "UrldbCleaner-Thread stopped");+ }++ public void abort() {+ synchronized(this) {+ run = false;+ this.notifyAll();+ }+ }++ public void pause() {+ synchronized(this) {+ if (!pause) {+ pause = true;+ serverLog.logInfo("URLDBCLEANER", "UrldbCleaner-Thread paused");+ }+ }+ }++ public void endPause() {+ synchronized(this) {+ if (pause) {+ pause = false;+ this.notifyAll();+ serverLog.logInfo("URLDBCLEANER", "UrldbCleaner-Thread resumed");+ }+ }+ }+ }++ // export methods+ public Export export(File f, String filter, int format, boolean dom) {+ if ((exportthread != null) && (exportthread.isAlive())) {+ serverLog.logWarning("LURL-EXPORT", "cannot start another export thread, already one running");+ return exportthread;+ }+ this.exportthread = new Export(f, filter, format, dom);+ this.exportthread.start();+ return exportthread;+ }++ public Export export() {+ return this.exportthread;+ }++ public class Export extends Thread {+ private File f;+ private String filter;+ private int count;+ private String failure;+ private int format;+ private boolean dom;+ private kelondroRowSet doms;++ public Export(File f, String filter, int format, boolean dom) {+ // format: 0=text, 1=html, 2=rss/xml+ this.f = f;+ this.filter = filter;+ this.count = 0;+ this.failure = null;+ this.format = format;+ this.dom = dom;+ if ((dom) && (format == 2)) dom = false;+ this.doms = new kelondroRowSet(new kelondroRow("String hash-6", kelondroBase64Order.enhancedCoder, 0), 0);+ }++ public void run() {+ try {+ f.getParentFile().mkdirs();+ PrintWriter pw = new PrintWriter(new BufferedOutputStream(new FileOutputStream(f)));+ if (format == 1) {+ pw.println("<html><head></head><body>");+ }+ if (format == 2) {+ pw.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");+ pw.println("<?xml-stylesheet type='text/xsl' href='/yacysearch.xsl' version='1.0'?>");+ pw.println("<rss version=\"2.0\">");+ pw.println("<channel>");+ pw.println("<title>YaCy Peer-to-Peer - Web-Search LURL Export</title>");+ pw.println("<description></description>");+ pw.println("<link>http://yacy.net</link>");+ }++ Iterator<indexURLEntry> i = entries(true, null); // iterates indexURLEntry objects+ indexURLEntry entry;+ indexURLEntry.Components comp;+ String url;+ loop: while (i.hasNext()) {+ entry = i.next();+ comp = entry.comp();+ url = comp.url().toNormalform(true, false);+ if (!url.matches(filter)) continue;+ if (dom) {+ if (doms.has(entry.hash().substring(6).getBytes())) continue loop;+ doms.add(entry.hash().substring(6).getBytes());+ url = comp.url().getHost();+ if (format == 0) {+ pw.println(url);+ }+ if (format == 1) {+ pw.println("<a href=\"http://" + url + "\">" + url + "</a><br>");+ }+ } else {+ if (format == 0) {+ pw.println(url);+ }+ if (format == 1) {+ pw.println("<a href=\"" + url + "\">" + htmlTools.encodeUnicode2html(comp.dc_title(), true, true) + "</a><br>");+ }+ if (format == 2) {+ pw.println("<item>");+ pw.println("<title>" + htmlTools.encodeUnicode2html(comp.dc_title(), true, true) + "</title>");+ pw.println("<link>" + yacyURL.escape(url) + "</link>");+ if (comp.dc_creator().length() > 0) pw.println("<author>" + htmlTools.encodeUnicode2html(comp.dc_creator(), true, true) + "</author>");+ if (comp.dc_subject().length() > 0) pw.println("<description>" + htmlTools.encodeUnicode2html(comp.dc_subject(), true, true) + "</description>");+ pw.println("<pubDate>" + entry.moddate().toString() + "</pubDate>");+ pw.println("<guid isPermaLink=\"false\">" + entry.hash() + "</guid>");+ pw.println("</item>");+ }+ }+ count++;+ }+ if (format == 1) {+ pw.println("</body></html>");+ }+ if (format == 2) {+ pw.println("</channel>");+ pw.println("</rss>");+ }+ pw.close();+ } catch (IOException e) {+ e.printStackTrace();+ this.failure = e.getMessage();+ }+ // terminate process+ }++ public File file() {+ return this.f;+ }++ public String failed() {+ return this.failure;+ }++ public int count() {+ return this.count;+ }++ }+}diff --git a/source/de/anomic/index/indexURLEntry.java b/source/de/anomic/index/indexURLEntry.javaindex 3c40eb13b..f39a4a6c9 100644--- a/source/de/anomic/index/indexURLEntry.java+++ b/source/de/anomic/index/indexURLEntry.java@@ -248,6 +248,17 @@ public class indexURLEntry {this.ranking = 0;}+ public static indexURLEntry importEntry(String propStr) {+ if (propStr != null && propStr.startsWith("{") && propStr.endsWith("}")) try {+ return new indexURLEntry(serverCodings.s2p(propStr.substring(1, propStr.length() - 1)));+ } catch (kelondroException e) {+ // wrong format+ return null;+ } else {+ return null;+ }+ }+private StringBuffer corePropList() {// generate a parseable string; this is a simple property-listindexURLEntry.Components comp = this.comp();diff --git a/source/de/anomic/kelondro/kelondroRowCollection.java b/source/de/anomic/kelondro/kelondroRowCollection.javaindex bd8a95c38..59e7ffd5d 100644--- a/source/de/anomic/kelondro/kelondroRowCollection.java+++ b/source/de/anomic/kelondro/kelondroRowCollection.java@@ -610,7 +610,7 @@ public class kelondroRowCollection {// or// the collection has an ordering, but this is not relevant for this pivot// because the ordered zone is outside of ordering zone- int m = picMiddle(new int[]{L, (3 * L + R - 1) / 4, (L + R - 1) / 2, (3 * R - L - 1) / 4, R - 1}, 5);+ int m = picMiddle(new int[]{L, (3 * L + R - 1) / 4, (L + R - 1) / 2, (L + 3 * R - 3) / 4, R - 1}, 5);assert L <= m;assert m < R;return m;@@ -618,7 +618,7 @@ public class kelondroRowCollection {if (S < R) {// the collection has an ordering// and part of the ordered zone is inside the to-be-ordered zone- int m = picMiddle(new int[]{L + (S - L) / 3, L + 2 * (S - L) / 3, S, (S + R - 1) / 2, R - 1}, 5);+ int m = picMiddle(new int[]{L, L + (S - L) / 3, (L + R - 1) / 2, S, R - 1}, 5);assert L <= m;assert m < R;return m;@@ -958,7 +958,7 @@ public class kelondroRowCollection {public static void main(String[] args) {//test(1000);- test(10000);+ test(50000);//test(100000);//test(1000000);diff --git a/source/de/anomic/plasma/dbImport/plasmaDbImporter.java b/source/de/anomic/plasma/dbImport/plasmaDbImporter.javaindex 613aa4149..a57d66199 100644--- a/source/de/anomic/plasma/dbImport/plasmaDbImporter.java+++ b/source/de/anomic/plasma/dbImport/plasmaDbImporter.java@@ -136,8 +136,8 @@ public class plasmaDbImporter extends AbstractImporter implements dbImporter {try {this.log.logInfo("Importing DB from '" + this.importPrimaryPath.getAbsolutePath() + "'/'" + this.importSecondaryPath.getAbsolutePath() + "'");- this.log.logInfo("Home word index contains " + homeWordIndex.size() + " words and " + homeWordIndex.loadedURL.size() + " URLs.");- this.log.logInfo("Import word index contains " + this.importWordIndex.size() + " words and " + this.importWordIndex.loadedURL.size() + " URLs.");+ this.log.logInfo("Home word index contains " + homeWordIndex.size() + " words and " + homeWordIndex.countURL() + " URLs.");+ this.log.logInfo("Import word index contains " + this.importWordIndex.size() + " words and " + this.importWordIndex.countURL() + " URLs.");HashSet<String> unknownUrlBuffer = new HashSet<String>();HashSet<String> importedUrlBuffer = new HashSet<String>();@@ -185,11 +185,11 @@ public class plasmaDbImporter extends AbstractImporter implements dbImporter {// we need to import the url// getting the url entry- indexURLEntry urlEntry = this.importWordIndex.loadedURL.load(urlHash, null, 0);+ indexURLEntry urlEntry = this.importWordIndex.getURL(urlHash, null, 0);if (urlEntry != null) {/* write it into the home url db */- homeWordIndex.loadedURL.store(urlEntry);+ homeWordIndex.putURL(urlEntry);importedUrlBuffer.add(urlHash);this.urlCounter++;@@ -254,8 +254,8 @@ public class plasmaDbImporter extends AbstractImporter implements dbImporter {}}- this.log.logInfo("Home word index contains " + homeWordIndex.size() + " words and " + homeWordIndex.loadedURL.size() + " URLs.");- this.log.logInfo("Import word index contains " + this.importWordIndex.size() + " words and " + this.importWordIndex.loadedURL.size() + " URLs.");+ this.log.logInfo("Home word index contains " + homeWordIndex.size() + " words and " + homeWordIndex.countURL() + " URLs.");+ this.log.logInfo("Import word index contains " + this.importWordIndex.size() + " words and " + this.importWordIndex.countURL() + " URLs.");} catch (Exception e) {this.log.logSevere("Database import failed.",e);e.printStackTrace();diff --git a/source/de/anomic/plasma/plasmaCrawlLURL.java b/source/de/anomic/plasma/plasmaCrawlLURL.javadeleted file mode 100644index a3328d101..000000000--- a/source/de/anomic/plasma/plasmaCrawlLURL.java+++ /dev/null@@ -1,706 +0,0 @@-// plasmaCrawlLURL.java-// ------------------------// part of YaCy-// (C) by Michael Peter Christen; [email protected]-// first published on http://www.anomic.de-// Frankfurt, Germany, 2004-//-// $LastChangedDate$-// $LastChangedRevision$-// $LastChangedBy$-//-// 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.--/*- This class provides storage functions for the plasma search engine.- - the url-specific properties, including condenser results- - the text content of the url- Both entities are accessed with a hash, which is based on the MD5- algorithm. The MD5 is not encoded as a hex value, but a b64 value.-*/--package de.anomic.plasma;--import java.io.BufferedOutputStream;-import java.io.File;-import java.io.FileOutputStream;-import java.io.IOException;-import java.io.PrintWriter;-import java.net.MalformedURLException;-import java.util.Date;-import java.util.HashSet;-import java.util.Iterator;-import java.util.LinkedList;--import de.anomic.data.htmlTools;-import de.anomic.http.httpc;-import de.anomic.http.httpc.response;-import de.anomic.index.indexRWIEntry;-import de.anomic.index.indexURLEntry;-import de.anomic.kelondro.kelondroBase64Order;-import de.anomic.kelondro.kelondroCache;-import de.anomic.kelondro.kelondroCloneableIterator;-import de.anomic.kelondro.kelondroException;-import de.anomic.kelondro.kelondroIndex;-import de.anomic.kelondro.kelondroRow;-import de.anomic.kelondro.kelondroRowSet;-import de.anomic.kelondro.kelondroSplitTable;-import de.anomic.plasma.urlPattern.plasmaURLPattern;-import de.anomic.server.serverCodings;-import de.anomic.server.logging.serverLog;-import de.anomic.yacy.yacySeedDB;-import de.anomic.yacy.yacyURL;--public final class plasmaCrawlLURL {-- // result stacks;- // these have all entries of form- // strings: urlHash + initiatorHash + ExecutorHash- private final LinkedList<String> externResultStack; // 1 - remote index: retrieved by other peer- private final LinkedList<String> searchResultStack; // 2 - partly remote/local index: result of search queries- private final LinkedList<String> transfResultStack; // 3 - partly remote/local index: result of index transfer- private final LinkedList<String> proxyResultStack; // 4 - local index: result of proxy fetch/prefetch- private final LinkedList<String> lcrawlResultStack; // 5 - local index: result of local crawling- private final LinkedList<String> gcrawlResultStack; // 6 - local index: triggered external-- // the class object- kelondroIndex urlIndexFile;-- public plasmaCrawlLURL(File indexSecondaryRoot, String networkName) {- super();- File indexSecondaryPath = new File(indexSecondaryRoot, networkName);- File indexSecondaryTextLocation = new File(indexSecondaryPath, "TEXT");- if (!indexSecondaryTextLocation.exists()) {- // patch old index locations; the secondary path is patched in plasmaCrawlLURL- File oldSecondaryPath = new File(new File(indexSecondaryRoot, "PUBLIC"), "TEXT");- File oldSecondaryTextLocation = new File(new File(indexSecondaryRoot, "PUBLIC"), "TEXT");- if (oldSecondaryPath.exists() && oldSecondaryTextLocation.exists()) {- // move the text folder from the old location to the new location- assert !indexSecondaryTextLocation.exists();- indexSecondaryTextLocation.mkdirs();- if (oldSecondaryTextLocation.renameTo(indexSecondaryTextLocation)) {- if (!oldSecondaryPath.delete()) oldSecondaryPath.deleteOnExit();- } else {- indexSecondaryTextLocation = oldSecondaryTextLocation; // emergency case: stay with old directory- }- }- }-- urlIndexFile = new kelondroSplitTable(indexSecondaryTextLocation, "urls", indexURLEntry.rowdef, false);-- // init result stacks- externResultStack = new LinkedList<String>();- searchResultStack = new LinkedList<String>();- transfResultStack = new LinkedList<String>();- proxyResultStack = new LinkedList<String>();- lcrawlResultStack = new LinkedList<String>();- gcrawlResultStack = new LinkedList<String>();- }-- public int size() {- return urlIndexFile.size();- }-- public void close() {- if (urlIndexFile != null) {- urlIndexFile.close();- urlIndexFile = null;- }- }-- public synchronized void stack(indexURLEntry e, String initiatorHash, String executorHash, int stackType) {- if (e == null) { return; }- try {- if (initiatorHash == null) { initiatorHash = yacyURL.dummyHash; }- if (executorHash == null) { executorHash = yacyURL.dummyHash; }- switch (stackType) {- case 0: break;- case 1: externResultStack.add(e.hash() + initiatorHash + executorHash); break;- case 2: searchResultStack.add(e.hash() + initiatorHash + executorHash); break;- case 3: transfResultStack.add(e.hash() + initiatorHash + executorHash); break;- case 4: proxyResultStack.add(e.hash() + initiatorHash + executorHash); break;- case 5: lcrawlResultStack.add(e.hash() + initiatorHash + executorHash); break;- case 6: gcrawlResultStack.add(e.hash() + initiatorHash + executorHash); break;- }- return;- } catch (Exception ex) {- System.out.println("INTERNAL ERROR in newEntry/2: " + ex.toString());- return;- }- }-- public synchronized void notifyGCrawl(String urlHash, String initiatorHash, String executorHash) {- gcrawlResultStack.add(urlHash + initiatorHash + executorHash);- }-- public synchronized int writeCacheSize() {- if (urlIndexFile instanceof kelondroSplitTable) return ((kelondroSplitTable) urlIndexFile).writeBufferSize();- if (urlIndexFile instanceof kelondroCache) return ((kelondroCache) urlIndexFile).writeBufferSize();- return 0;- }-- public synchronized indexURLEntry load(String urlHash, indexRWIEntry searchedWord, long ranking) {- // generates an plasmaLURLEntry using the url hash- // to speed up the access, the url-hashes are buffered- // in the hash cache.- // we have two options to find the url:- // - look into the hash cache- // - look into the filed properties- // if the url cannot be found, this returns null- if (urlHash == null) return null;- try {- kelondroRow.Entry entry = urlIndexFile.get(urlHash.getBytes());- if (entry == null) return null;- return new indexURLEntry(entry, searchedWord, ranking);- } catch (IOException e) {- return null;- }- }-- public synchronized void store(indexURLEntry entry) throws IOException {- // Check if there is a more recent Entry already in the DB- indexURLEntry oldEntry;- try {- if (exists(entry.hash())) {- oldEntry = load(entry.hash(), null, 0);- } else {- oldEntry = null;- }- } catch (Exception e) {- e.printStackTrace();- oldEntry = null;- }- if ((oldEntry != null) && (entry.isOlder(oldEntry))) {- // the fetched oldEntry is better, so return its properties instead of the new ones- // this.urlHash = oldEntry.urlHash; // unnecessary, should be the same- // this.url = oldEntry.url; // unnecessary, should be the same- entry = oldEntry;- return; // this did not need to be stored, but is updated- }-- urlIndexFile.put(entry.toRowEntry(), new Date() /*entry.loaddate()*/);- }-- public synchronized indexURLEntry newEntry(String propStr) {- if (propStr != null && propStr.startsWith("{") && propStr.endsWith("}")) try {- return new indexURLEntry(serverCodings.s2p(propStr.substring(1, propStr.length() - 1)));- } catch (kelondroException e) {- // wrong format- return null;- } else {- return null;- }- }-- public synchronized int getStackSize(int stack) {- switch (stack) {- case 1: return externResultStack.size();- case 2: return searchResultStack.size();- case 3: return transfResultStack.size();- case 4: return proxyResultStack.size();- case 5: return lcrawlResultStack.size();- case 6: return gcrawlResultStack.size();- }- return -1;- }-- public synchronized String getUrlHash(int stack, int pos) {- switch (stack) {- case 1: return ((String) externResultStack.get(pos)).substring(0, yacySeedDB.commonHashLength);- case 2: return ((String) searchResultStack.get(pos)).substring(0, yacySeedDB.commonHashLength);- case 3: return ((String) transfResultStack.get(pos)).substring(0, yacySeedDB.commonHashLength);- case 4: return ((String) proxyResultStack.get(pos)).substring(0, yacySeedDB.commonHashLength);- case 5: return ((String) lcrawlResultStack.get(pos)).substring(0, yacySeedDB.commonHashLength);- case 6: return ((String) gcrawlResultStack.get(pos)).substring(0, yacySeedDB.commonHashLength);- }- return null;- }-- public synchronized String getInitiatorHash(int stack, int pos) {- switch (stack) {- case 1: return ((String) externResultStack.get(pos)).substring(yacySeedDB.commonHashLength, yacySeedDB.commonHashLength * 2);- case 2: return ((String) searchResultStack.get(pos)).substring(yacySeedDB.commonHashLength, yacySeedDB.commonHashLength * 2);- case 3: return ((String) transfResultStack.get(pos)).substring(yacySeedDB.commonHashLength, yacySeedDB.commonHashLength * 2);- case 4: return ((String) proxyResultStack.get(pos)).substring(yacySeedDB.commonHashLength, yacySeedDB.commonHashLength * 2);- case 5: return ((String) lcrawlResultStack.get(pos)).substring(yacySeedDB.commonHashLength, yacySeedDB.commonHashLength * 2);- case 6: return ((String) gcrawlResultStack.get(pos)).substring(yacySeedDB.commonHashLength, yacySeedDB.commonHashLength * 2);- }- return null;- }-- public synchronized String getExecutorHash(int stack, int pos) {- switch (stack) {- case 1: return ((String) externResultStack.get(pos)).substring(yacySeedDB.commonHashLength * 2, yacySeedDB.commonHashLength * 3);- case 2: return ((String) searchResultStack.get(pos)).substring(yacySeedDB.commonHashLength * 2, yacySeedDB.commonHashLength * 3);- case 3: return ((String) transfResultStack.get(pos)).substring(yacySeedDB.commonHashLength * 2, yacySeedDB.commonHashLength * 3);- case 4: return ((String) proxyResultStack.get(pos)).substring(yacySeedDB.commonHashLength * 2, yacySeedDB.commonHashLength * 3);- case 5: return ((String) lcrawlResultStack.get(pos)).substring(yacySeedDB.commonHashLength * 2, yacySeedDB.commonHashLength * 3);- case 6: return ((String) gcrawlResultStack.get(pos)).substring(yacySeedDB.commonHashLength * 2, yacySeedDB.commonHashLength * 3);- }- return null;- }-- public synchronized boolean removeStack(int stack, int pos) {- Object prevElement = null;- switch (stack) {- case 1: prevElement = externResultStack.remove(pos); break;- case 2: prevElement = searchResultStack.remove(pos); break;- case 3: prevElement = transfResultStack.remove(pos); break;- case 4: prevElement = proxyResultStack.remove(pos); break;- case 5: prevElement = lcrawlResultStack.remove(pos); break;- case 6: prevElement = gcrawlResultStack.remove(pos); break;- }- return prevElement != null;- }-- public synchronized void clearStack(int stack) {- switch (stack) {- case 1: externResultStack.clear(); break;- case 2: searchResultStack.clear(); break;- case 3: transfResultStack.clear(); break;- case 4: proxyResultStack.clear(); break;- case 5: lcrawlResultStack.clear(); break;- case 6: gcrawlResultStack.clear(); break;- }- }-- public synchronized boolean remove(String urlHash) {- if (urlHash == null) return false;- try {- kelondroRow.Entry r = urlIndexFile.remove(urlHash.getBytes(), false);- if (r == null) return false;- for (int stack = 1; stack <= 6; stack++) {- for (int i = getStackSize(stack) - 1; i >= 0; i--) {- if (getUrlHash(stack, i).equals(urlHash)) {- removeStack(stack, i);- return true;- }- }- }- return true;- } catch (IOException e) {- return false;- }- }-- public synchronized boolean exists(String urlHash) {- if (urlIndexFile == null) return false; // case may happen during shutdown- try {- return urlIndexFile.has(urlHash.getBytes());- } catch (IOException e) {- return false;- }- }-- public kelondroCloneableIterator<indexURLEntry> entries(boolean up, String firstHash) throws IOException {- // enumerates entry elements- return new kiter(up, firstHash);- }-- public class kiter implements kelondroCloneableIterator<indexURLEntry> {- // enumerates entry elements- private Iterator<kelondroRow.Entry> iter;- private boolean error;- boolean up;-- public kiter(boolean up, String firstHash) throws IOException {- this.up = up;- this.iter = plasmaCrawlLURL.this.urlIndexFile.rows(up, (firstHash == null) ? null : firstHash.getBytes());- this.error = false;- }-- public kiter clone(Object secondHash) {- try {- return new kiter(up, (String) secondHash);- } catch (IOException e) {- return null;- }- }-- public final boolean hasNext() {- if (this.error) return false;- if (this.iter == null) return false;- return this.iter.hasNext();- }-- public final indexURLEntry next() {- kelondroRow.Entry e = null;- if (this.iter == null) { return null; }- if (this.iter.hasNext()) { e = this.iter.next(); }- if (e == null) { return null; }- return new indexURLEntry(e, null, 0);- }-- public final void remove() {- this.iter.remove();- }- }-- /**- * Uses an Iteration over urlHash.db to detect malformed URL-Entries.- * Damaged URL-Entries will be marked in a HashSet and removed at the end of the function.- *- * @param homePath Root-Path where all information is to be found.- */- public void urldbcleanup() {- serverLog log = new serverLog("URLDBCLEANUP");- HashSet<String> damagedURLS = new HashSet<String>();- try {- Iterator<indexURLEntry> eiter = entries(true, null);- int iteratorCount = 0;- while (eiter.hasNext()) try {- eiter.next();- iteratorCount++;- } catch (RuntimeException e) {- if(e.getMessage() != null) {- String m = e.getMessage();- damagedURLS.add(m.substring(m.length() - 12));- } else {- log.logSevere("RuntimeException:", e);- }- }- try { Thread.sleep(1000); } catch (InterruptedException e) { }- log.logInfo("URLs vorher: " + size() + " Entries loaded during Iteratorloop: " + iteratorCount + " kaputte URLs: " + damagedURLS.size());-- Iterator<String> eiter2 = damagedURLS.iterator();- String urlHash;- while (eiter2.hasNext()) {- urlHash = (String) eiter2.next();-- // trying to fix the invalid URL- httpc theHttpc = null;- String oldUrlStr = null;- try {- // getting the url data as byte array- kelondroRow.Entry entry = urlIndexFile.get(urlHash.getBytes());-- // getting the wrong url string- oldUrlStr = entry.getColString(1, null).trim();-- int pos = -1;- if ((pos = oldUrlStr.indexOf("://")) != -1) {- // trying to correct the url- String newUrlStr = "http://" + oldUrlStr.substring(pos + 3);- yacyURL newUrl = new yacyURL(newUrlStr, null);-- // doing a http head request to test if the url is correct- theHttpc = new httpc(newUrl.getHost(), newUrl.getHost(), newUrl.getPort(), 30000, false, plasmaSwitchboard.getSwitchboard().remoteProxyConfig, null, null);- response res = theHttpc.HEAD(newUrl.getPath(), null);-- if (res.statusCode == 200) {- entry.setCol(1, newUrl.toString().getBytes());- urlIndexFile.put(entry);- log.logInfo("UrlDB-Entry with urlHash '" + urlHash + "' corrected\n\tURL: " + oldUrlStr + " -> " + newUrlStr);- } else {- remove(urlHash);- log.logInfo("UrlDB-Entry with urlHash '" + urlHash + "' removed\n\tURL: " + oldUrlStr + "\n\tConnection Status: " + res.status);- }- theHttpc.close();- }- } catch (Exception e) {- remove(urlHash);- log.logInfo("UrlDB-Entry with urlHash '" + urlHash + "' removed\n\tURL: " + oldUrlStr + "\n\tExecption: " + e.getMessage());- } finally {- if (theHttpc != null) try {- theHttpc.close();- } catch (Exception e) { }- }- }-- log.logInfo("URLs nachher: " + size() + " kaputte URLs: " + damagedURLS.size());- } catch (IOException e) {- log.logSevere("IOException", e);- }- }-- // The Cleaner class was provided as "UrldbCleaner" by Hydrox- public Cleaner makeCleaner() {- return new Cleaner();- }-- public class Cleaner extends Thread {-- private boolean run = true;- private boolean pause;- public int blacklistedUrls = 0;- public int totalSearchedUrls = 1;- public String lastBlacklistedUrl = "";- public String lastBlacklistedHash = "";- public String lastUrl = "";- public String lastHash = "";-- public Cleaner() {- }-- public void run() {- try {- serverLog.logInfo("URLDBCLEANER", "UrldbCleaner-Thread startet");- final Iterator<indexURLEntry> eiter = entries(true, null);- while (eiter.hasNext() && run) {- synchronized (this) {- if (this.pause) {- try {- this.wait();- } catch (InterruptedException e) {- serverLog.logWarning("URLDBCLEANER", "InterruptedException", e);- this.run = false;- return;- }- }- }- final indexURLEntry entry = eiter.next();- if (entry == null) {- serverLog.logFine("URLDBCLEANER", "entry == null");- } else if (entry.hash() == null) {- serverLog.logFine("URLDBCLEANER", ++blacklistedUrls + " blacklisted (" + ((double) blacklistedUrls / totalSearchedUrls) * 100 + "%): " + "hash == null");- } else {- final indexURLEntry.Components comp = entry.comp();- totalSearchedUrls++;- if (comp.url() == null) {- serverLog.logFine("URLDBCLEANER", ++blacklistedUrls + " blacklisted (" + ((double) blacklistedUrls / totalSearchedUrls) * 100 + "%): " + entry.hash() + "URL == null");- remove(entry.hash());- } else if (plasmaSwitchboard.urlBlacklist.isListed(plasmaURLPattern.BLACKLIST_CRAWLER, comp.url()) ||- plasmaSwitchboard.urlBlacklist.isListed(plasmaURLPattern.BLACKLIST_DHT, comp.url())) {- lastBlacklistedUrl = comp.url().toNormalform(true, true);- lastBlacklistedHash = entry.hash();- serverLog.logFine("URLDBCLEANER", ++blacklistedUrls + " blacklisted (" + ((double) blacklistedUrls / totalSearchedUrls) * 100 + "%): " + entry.hash() + " " + comp.url().toNormalform(false, true));- remove(entry.hash());- if (blacklistedUrls % 100 == 0) {- serverLog.logInfo("URLDBCLEANER", "Deleted " + blacklistedUrls + " URLs until now. Last deleted URL-Hash: " + lastBlacklistedUrl);- }- }- lastUrl = comp.url().toNormalform(true, true);- lastHash = entry.hash();- }- }- } catch (RuntimeException e) {- if (e.getMessage() != null && e.getMessage().indexOf("not found in LURL") != -1) {- serverLog.logWarning("URLDBCLEANER", "urlHash not found in LURL", e);- }- else {- serverLog.logWarning("URLDBCLEANER", "RuntimeException", e);- run = false;- }- } catch (IOException e) {- e.printStackTrace();- run = false;- }- serverLog.logInfo("URLDBCLEANER", "UrldbCleaner-Thread stopped");- }-- public void abort() {- synchronized(this) {- run = false;- this.notifyAll();- }- }-- public void pause() {- synchronized(this) {- if (!pause) {- pause = true;- serverLog.logInfo("URLDBCLEANER", "UrldbCleaner-Thread paused");- }- }- }-- public void endPause() {- synchronized(this) {- if (pause) {- pause = false;- this.notifyAll();- serverLog.logInfo("URLDBCLEANER", "UrldbCleaner-Thread resumed");- }- }- }- }-- private exportc exportthread = null;-- public boolean export(File f, String filter, int format, boolean dom) {- if ((exportthread != null) && (exportthread.isAlive())) {- serverLog.logWarning("LURL-EXPORT", "cannot start another export thread, already one running");- return false;- }- this.exportthread = new exportc(f, filter, format, dom);- this.exportthread.start();- return (this.exportthread.isAlive());- }-- public String export_failed() {- if (exportthread == null) return null;- return exportthread.failure;- }-- public int export_count() {- if (exportthread == null) return 0;- return exportthread.count();- }-- public boolean export_running() {- if (exportthread == null) return false;- return exportthread.isAlive();- }-- public File export_file() {- if (exportthread == null) return null;- return exportthread.file();- }-- public class exportc extends Thread {- File f;- String filter;- int count;- String failure;- int format;- boolean dom;- kelondroRowSet doms;-- public exportc(File f, String filter, int format, boolean dom) {- // format: 0=text, 1=html, 2=rss/xml- this.f = f;- this.filter = filter;- this.count = 0;- this.failure = null;- this.format = format;- this.dom = dom;- if ((dom) && (format == 2)) dom = false;- this.doms = new kelondroRowSet(new kelondroRow("String hash-6", kelondroBase64Order.enhancedCoder, 0), 0);- }-- public void run() {- try {- f.getParentFile().mkdirs();- PrintWriter pw = new PrintWriter(new BufferedOutputStream(new FileOutputStream(f)));- if (format == 1) {- pw.println("<html><head></head><body>");- }- if (format == 2) {- pw.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");- pw.println("<?xml-stylesheet type='text/xsl' href='/yacysearch.xsl' version='1.0'?>");- pw.println("<rss version=\"2.0\">");- pw.println("<channel>");- pw.println("<title>YaCy Peer-to-Peer - Web-Search LURL Export</title>");- pw.println("<description></description>");- pw.println("<link>http://yacy.net</link>");- }-- Iterator<indexURLEntry> i = entries(true, null); // iterates indexURLEntry objects- indexURLEntry entry;- indexURLEntry.Components comp;- String url;- loop: while (i.hasNext()) {- entry = i.next();- comp = entry.comp();- url = comp.url().toNormalform(true, false);- if (!url.matches(filter)) continue;- if (dom) {- if (doms.has(entry.hash().substring(6).getBytes())) continue loop;- doms.add(entry.hash().substring(6).getBytes());- url = comp.url().getHost();- if (format == 0) {- pw.println(url);- }- if (format == 1) {- pw.println("<a href=\"http://" + url + "\">" + url + "</a><br>");- }- } else {- if (format == 0) {- pw.println(url);- }- if (format == 1) {- pw.println("<a href=\"" + url + "\">" + htmlTools.encodeUnicode2html(comp.dc_title(), true, true) + "</a><br>");- }- if (format == 2) {- pw.println("<item>");- pw.println("<title>" + htmlTools.encodeUnicode2html(comp.dc_title(), true, true) + "</title>");- pw.println("<link>" + yacyURL.escape(url) + "</link>");- if (comp.dc_creator().length() > 0) pw.println("<author>" + htmlTools.encodeUnicode2html(comp.dc_creator(), true, true) + "</author>");- if (comp.dc_subject().length() > 0) pw.println("<description>" + htmlTools.encodeUnicode2html(comp.dc_subject(), true, true) + "</description>");- pw.println("<pubDate>" + entry.moddate().toString() + "</pubDate>");- pw.println("<guid isPermaLink=\"false\">" + entry.hash() + "</guid>");- pw.println("</item>");- }- }- count++;- }- if (format == 1) {- pw.println("</body></html>");- }- if (format == 2) {- pw.println("</channel>");- pw.println("</rss>");- }- pw.close();- } catch (IOException e) {- e.printStackTrace();- this.failure = e.getMessage();- }- // terminate process- }-- public File file() {- return this.f;- }-- public String failed() {- return this.failure;- }-- public int count() {- return this.count;- }- }-- public static void main(String[] args) {- // test-generation of url hashes for debugging- // one argument requires, will be treated as url- // returns url-hash- if (args[0].equals("-h")) try {- // arg 1 is url- System.out.println("HASH: " + (new yacyURL(args[1], null)).hash());- } catch (MalformedURLException e) {}- if (args[0].equals("-l")) try {- // arg 1 is path to URLCache- final plasmaCrawlLURL urls = new plasmaCrawlLURL(new File(args[2]), "freeworld");- final Iterator<indexURLEntry> enu = urls.entries(true, null);- while (enu.hasNext()) {- System.out.println(enu.next().toString());- }- } catch (Exception e) {- e.printStackTrace();- }- }--}diff --git a/source/de/anomic/plasma/plasmaCrawlResults.java b/source/de/anomic/plasma/plasmaCrawlResults.javanew file mode 100644index 000000000..a480d7e11--- /dev/null+++ b/source/de/anomic/plasma/plasmaCrawlResults.java@@ -0,0 +1,193 @@+// plasmaCrawlLURL.java+// -----------------------+// part of YaCy+// (C) by Michael Peter Christen; [email protected]+// first published on http://yacy.net+// Frankfurt, Germany, 2004+//+// $LastChangedDate: 2008-03-16 23:31:54 +0100 (So, 16 Mrz 2008) $+// $LastChangedRevision: 4575 $+// $LastChangedBy: orbiter $+//+// 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.++/*+ This class provides storage functions for the plasma search engine.+ - the url-specific properties, including condenser results+ - the text content of the url+ Both entities are accessed with a hash, which is based on the MD5+ algorithm. The MD5 is not encoded as a hex value, but a b64 value.+*/++package de.anomic.plasma;++import java.util.LinkedList;++import de.anomic.index.indexURLEntry;+import de.anomic.yacy.yacySeedDB;+import de.anomic.yacy.yacyURL;++public final class plasmaCrawlResults {++ // result stacks;+ // these have all entries of form+ // strings: urlHash + initiatorHash + ExecutorHash+ private final LinkedList<String> externResultStack; // 1 - remote index: retrieved by other peer+ private final LinkedList<String> searchResultStack; // 2 - partly remote/local index: result of search queries+ private final LinkedList<String> transfResultStack; // 3 - partly remote/local index: result of index transfer+ private final LinkedList<String> proxyResultStack; // 4 - local index: result of proxy fetch/prefetch+ private final LinkedList<String> lcrawlResultStack; // 5 - local index: result of local crawling+ private final LinkedList<String> gcrawlResultStack; // 6 - local index: triggered external++ public plasmaCrawlResults() {+ // init result stacks+ externResultStack = new LinkedList<String>();+ searchResultStack = new LinkedList<String>();+ transfResultStack = new LinkedList<String>();+ proxyResultStack = new LinkedList<String>();+ lcrawlResultStack = new LinkedList<String>();+ gcrawlResultStack = new LinkedList<String>();+ }++ public synchronized void stack(indexURLEntry e, String initiatorHash, String executorHash, int stackType) {+ if (e == null) { return; }+ try {+ if (initiatorHash == null) { initiatorHash = yacyURL.dummyHash; }+ if (executorHash == null) { executorHash = yacyURL.dummyHash; }+ switch (stackType) {+ case 0: break;+ case 1: externResultStack.add(e.hash() + initiatorHash + executorHash); break;+ case 2: searchResultStack.add(e.hash() + initiatorHash + executorHash); break;+ case 3: transfResultStack.add(e.hash() + initiatorHash + executorHash); break;+ case 4: proxyResultStack.add(e.hash() + initiatorHash + executorHash); break;+ case 5: lcrawlResultStack.add(e.hash() + initiatorHash + executorHash); break;+ case 6: gcrawlResultStack.add(e.hash() + initiatorHash + executorHash); break;+ }+ return;+ } catch (Exception ex) {+ System.out.println("INTERNAL ERROR in newEntry/2: " + ex.toString());+ return;+ }+ }++ public synchronized void notifyGCrawl(String urlHash, String initiatorHash, String executorHash) {+ gcrawlResultStack.add(urlHash + initiatorHash + executorHash);+ }++ public synchronized int getStackSize(int stack) {+ switch (stack) {+ case 1: return externResultStack.size();+ case 2: return searchResultStack.size();+ case 3: return transfResultStack.size();+ case 4: return proxyResultStack.size();+ case 5: return lcrawlResultStack.size();+ case 6: return gcrawlResultStack.size();+ }+ return -1;+ }++ public synchronized String getUrlHash(int stack, int pos) {+ switch (stack) {+ case 1: return ((String) externResultStack.get(pos)).substring(0, yacySeedDB.commonHashLength);+ case 2: return ((String) searchResultStack.get(pos)).substring(0, yacySeedDB.commonHashLength);+ case 3: return ((String) transfResultStack.get(pos)).substring(0, yacySeedDB.commonHashLength);+ case 4: return ((String) proxyResultStack.get(pos)).substring(0, yacySeedDB.commonHashLength);+ case 5: return ((String) lcrawlResultStack.get(pos)).substring(0, yacySeedDB.commonHashLength);+ case 6: return ((String) gcrawlResultStack.get(pos)).substring(0, yacySeedDB.commonHashLength);+ }+ return null;+ }++ public synchronized String getInitiatorHash(int stack, int pos) {+ switch (stack) {+ case 1: return ((String) externResultStack.get(pos)).substring(yacySeedDB.commonHashLength, yacySeedDB.commonHashLength * 2);+ case 2: return ((String) searchResultStack.get(pos)).substring(yacySeedDB.commonHashLength, yacySeedDB.commonHashLength * 2);+ case 3: return ((String) transfResultStack.get(pos)).substring(yacySeedDB.commonHashLength, yacySeedDB.commonHashLength * 2);+ case 4: return ((String) proxyResultStack.get(pos)).substring(yacySeedDB.commonHashLength, yacySeedDB.commonHashLength * 2);+ case 5: return ((String) lcrawlResultStack.get(pos)).substring(yacySeedDB.commonHashLength, yacySeedDB.commonHashLength * 2);+ case 6: return ((String) gcrawlResultStack.get(pos)).substring(yacySeedDB.commonHashLength, yacySeedDB.commonHashLength * 2);+ }+ return null;+ }++ public synchronized String getExecutorHash(int stack, int pos) {+ switch (stack) {+ case 1: return ((String) externResultStack.get(pos)).substring(yacySeedDB.commonHashLength * 2, yacySeedDB.commonHashLength * 3);+ case 2: return ((String) searchResultStack.get(pos)).substring(yacySeedDB.commonHashLength * 2, yacySeedDB.commonHashLength * 3);+ case 3: return ((String) transfResultStack.get(pos)).substring(yacySeedDB.commonHashLength * 2, yacySeedDB.commonHashLength * 3);+ case 4: return ((String) proxyResultStack.get(pos)).substring(yacySeedDB.commonHashLength * 2, yacySeedDB.commonHashLength * 3);+ case 5: return ((String) lcrawlResultStack.get(pos)).substring(yacySeedDB.commonHashLength * 2, yacySeedDB.commonHashLength * 3);+ case 6: return ((String) gcrawlResultStack.get(pos)).substring(yacySeedDB.commonHashLength * 2, yacySeedDB.commonHashLength * 3);+ }+ return null;+ }++ public synchronized boolean removeStack(int stack, int pos) {+ Object prevElement = null;+ switch (stack) {+ case 1: prevElement = externResultStack.remove(pos); break;+ case 2: prevElement = searchResultStack.remove(pos); break;+ case 3: prevElement = transfResultStack.remove(pos); break;+ case 4: prevElement = proxyResultStack.remove(pos); break;+ case 5: prevElement = lcrawlResultStack.remove(pos); break;+ case 6: prevElement = gcrawlResultStack.remove(pos); break;+ }+ return prevElement != null;+ }++ public synchronized void clearStack(int stack) {+ switch (stack) {+ case 1: externResultStack.clear(); break;+ case 2: searchResultStack.clear(); break;+ case 3: transfResultStack.clear(); break;+ case 4: proxyResultStack.clear(); break;+ case 5: lcrawlResultStack.clear(); break;+ case 6: gcrawlResultStack.clear(); break;+ }+ }++ public synchronized boolean remove(String urlHash) {+ if (urlHash == null) return false;+ for (int stack = 1; stack <= 6; stack++) {+ for (int i = getStackSize(stack) - 1; i >= 0; i--) {+ if (getUrlHash(stack, i).equals(urlHash)) {+ removeStack(stack, i);+ return true;+ }+ }+ }+ return true;+ }++}diff --git a/source/de/anomic/plasma/plasmaCrawlStacker.java b/source/de/anomic/plasma/plasmaCrawlStacker.javaindex d54827867..60ac46eaa 100644--- a/source/de/anomic/plasma/plasmaCrawlStacker.java+++ b/source/de/anomic/plasma/plasmaCrawlStacker.java@@ -459,7 +459,7 @@ public final class plasmaCrawlStacker extends Thread {// check if the url is double registeredString dbocc = sb.crawlQueues.urlExists(entry.url().hash());- indexURLEntry oldEntry = this.sb.wordIndex.loadedURL.load(entry.url().hash(), null, 0);+ indexURLEntry oldEntry = this.sb.wordIndex.getURL(entry.url().hash(), null, 0);boolean recrawl = (oldEntry != null) && ((System.currentTimeMillis() - oldEntry.loaddate().getTime()) > profile.recrawlIfOlder());// do double-checkif ((dbocc != null) && (!recrawl)) {diff --git a/source/de/anomic/plasma/plasmaDHTChunk.java b/source/de/anomic/plasma/plasmaDHTChunk.javaindex 2e842aebb..d1a649041 100644--- a/source/de/anomic/plasma/plasmaDHTChunk.java+++ b/source/de/anomic/plasma/plasmaDHTChunk.java@@ -64,12 +64,12 @@ import de.anomic.yacy.yacySeedDB;public class plasmaDHTChunk {- public static final int chunkStatus_UNDEFINED = -1;- public static final int chunkStatus_FAILED = 0;- public static final int chunkStatus_FILLED = 1;- public static final int chunkStatus_RUNNING = 2;- public static final int chunkStatus_INTERRUPTED = 3;- public static final int chunkStatus_COMPLETE = 4;+ public static final int chunkStatus_UNDEFINED = -1;+ public static final int chunkStatus_FAILED = 0;+ public static final int chunkStatus_FILLED = 1;+ public static final int chunkStatus_RUNNING = 2;+ public static final int chunkStatus_INTERRUPTED = 3;+ public static final int chunkStatus_COMPLETE = 4;public static final int peerRedundancy = 3;@@ -248,7 +248,7 @@ public class plasmaDHTChunk {urlIter.remove();continue;}- lurl = wordIndex.loadedURL.load(iEntry.urlHash(), iEntry, 0);+ lurl = wordIndex.getURL(iEntry.urlHash(), iEntry, 0);if ((lurl == null) || (lurl.comp() == null) || (lurl.comp().url() == null)) {//yacyCore.log.logFine("DEBUG selectTransferContainersResource: not-bound url hash '" + iEntry.urlHash() + "' for word hash " + container.getWordHash());notBoundCounter++;diff --git a/source/de/anomic/plasma/plasmaSearchEvent.java b/source/de/anomic/plasma/plasmaSearchEvent.javaindex 05efaaf83..bcd1e7d34 100644--- a/source/de/anomic/plasma/plasmaSearchEvent.java+++ b/source/de/anomic/plasma/plasmaSearchEvent.java@@ -88,14 +88,17 @@ public final class plasmaSearchEvent {TreeSet<String> snippetFetchWordHashes; // a set of word hashes that are used to match with the snippetslong urlRetrievalAllTime;long snippetComputationAllTime;+ plasmaCrawlResults crawlResults;@SuppressWarnings("unchecked")private plasmaSearchEvent(plasmaSearchQuery query,- plasmaWordIndex wordIndex,+ plasmaWordIndex wordIndex,+ plasmaCrawlResults crawlResults,TreeMap<String, String> preselectedPeerHashes,boolean generateAbstracts) {this.eventTime = System.currentTimeMillis(); // for lifetime checkthis.wordIndex = wordIndex;+ this.crawlResults = crawlResults;this.query = query;this.rcAbstracts = (query.queryHashes.size() > 1) ? new TreeMap<String, TreeMap<String, String>>() : null; // generate abstracts only for combined searchesthis.primarySearchThreads = null;@@ -141,7 +144,8 @@ public final class plasmaSearchEvent {query.displayResults(),query.maxDistance,wordIndex,- rankedCache,+ crawlResults,+ rankedCache,rcAbstracts,fetchpeers,plasmaSwitchboard.urlBlacklist,@@ -453,12 +457,13 @@ public final class plasmaSearchEvent {public static plasmaSearchEvent getEvent(plasmaSearchQuery query,plasmaSearchRankingProfile ranking,plasmaWordIndex wordIndex,+ plasmaCrawlResults crawlResults,TreeMap<String, String> preselectedPeerHashes,boolean generateAbstracts) {synchronized (lastEvents) {plasmaSearchEvent event = (plasmaSearchEvent) lastEvents.get(query.id(false));if (event == null) {- event = new plasmaSearchEvent(query, wordIndex, preselectedPeerHashes, generateAbstracts);+ event = new plasmaSearchEvent(query, wordIndex, crawlResults, preselectedPeerHashes, generateAbstracts);} else {//re-new the event time for this event, so it is not deleted next time too earlyevent.eventTime = System.currentTimeMillis();@@ -714,7 +719,7 @@ public final class plasmaSearchEvent {//System.out.println("DEBUG-INDEXABSTRACT ***: peer " + peer + " has urls: " + urls);//System.out.println("DEBUG-INDEXABSTRACT ***: peer " + peer + " from words: " + words);secondarySearchThreads[c++] = yacySearch.secondaryRemoteSearch(- words, "", urls, wordIndex, this.rankedCache, peer, plasmaSwitchboard.urlBlacklist,+ words, "", urls, wordIndex, crawlResults, this.rankedCache, peer, plasmaSwitchboard.urlBlacklist,query.ranking, query.constraint, preselectedPeerHashes);}@@ -802,7 +807,7 @@ public final class plasmaSearchEvent {" " +urlcomps.dc_title()).getBytes(), "UTF-8").keySet(),urlentry.hash());- wordIndex.loadedURL.remove(urlentry.hash()); // clean up+ wordIndex.removeURL(urlentry.hash()); // clean upthrow new RuntimeException("index void");} catch (UnsupportedEncodingException e) {throw new RuntimeException("parser failed: " + e.getMessage());diff --git a/source/de/anomic/plasma/plasmaSearchRankingProcess.java b/source/de/anomic/plasma/plasmaSearchRankingProcess.javaindex fbf08ea50..d9245fa5b 100644--- a/source/de/anomic/plasma/plasmaSearchRankingProcess.java+++ b/source/de/anomic/plasma/plasmaSearchRankingProcess.java@@ -292,7 +292,7 @@ public final class plasmaSearchRankingProcess {// returns from the current RWI list the best URL entry and removed this entry from the listwhile ((stack.size() > 0) || (size() > 0)) {kelondroSortStack<indexRWIVarEntry>.stackElement obrwi = bestRWI(skipDoubleDom);- indexURLEntry u = wordIndex.loadedURL.load(obrwi.element.urlHash(), obrwi.element, obrwi.weight.longValue());+ indexURLEntry u = wordIndex.getURL(obrwi.element.urlHash(), obrwi.element, obrwi.weight.longValue());if (u != null) {indexURLEntry.Components comp = u.comp();if (comp.url() != null) this.handover.put(u.hash(), comp.url().toNormalform(true, false)); // remember that we handed over this urldiff --git a/source/de/anomic/plasma/plasmaSnippetCache.java b/source/de/anomic/plasma/plasmaSnippetCache.javaindex ef21cad39..0eae70318 100644--- a/source/de/anomic/plasma/plasmaSnippetCache.java+++ b/source/de/anomic/plasma/plasmaSnippetCache.java@@ -898,7 +898,7 @@ public class plasmaSnippetCache {(snippet.getErrorCode() == ERROR_PARSER_FAILED) ||(snippet.getErrorCode() == ERROR_PARSER_NO_LINES)) {log.logInfo("error: '" + snippet.getError() + "', remove url = " + snippet.getUrl().toNormalform(false, true) + ", cause: " + snippet.getError());- plasmaSwitchboard.getSwitchboard().wordIndex.loadedURL.remove(urlHash);+ plasmaSwitchboard.getSwitchboard().wordIndex.removeURL(urlHash);plasmaSearchEvent event = plasmaSearchEvent.getEvent(eventID);assert plasmaSwitchboard.getSwitchboard() != null;assert plasmaSwitchboard.getSwitchboard().wordIndex != null;diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.javaindex fb682e2c1..556a52c5a 100644--- a/source/de/anomic/plasma/plasmaSwitchboard.java+++ b/source/de/anomic/plasma/plasmaSwitchboard.java@@ -195,6 +195,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<plasmaSwitchbopublic HashMap<String, String> rankingPermissions;public plasmaWordIndex wordIndex;public plasmaCrawlQueues crawlQueues;+ public plasmaCrawlResults crawlResults;public plasmaSwitchboardQueue sbQueue;public plasmaCrawlStacker crawlStacker;public messageBoard messageDB;@@ -955,6 +956,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<plasmaSwitchbolog.logConfig("Starting Indexing Management");String networkName = getConfig("network.unit.name", "");wordIndex = new plasmaWordIndex(indexPrimaryPath, indexSecondaryPath, networkName, log);+ crawlResults = new plasmaCrawlResults();// start yacy corelog.logConfig("Starting YaCy Protocol Core");@@ -1113,7 +1115,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<plasmaSwitchbo* initialize switchboard queue* ====================================================================== */// create queue- this.sbQueue = new plasmaSwitchboardQueue(this.wordIndex.loadedURL, new File(this.plasmaPath, "switchboardQueue2.stack"), this.profilesActiveCrawls);+ this.sbQueue = new plasmaSwitchboardQueue(wordIndex, new File(this.plasmaPath, "switchboardQueue2.stack"), this.profilesActiveCrawls);// create in process listthis.indexingTasksInProcess = new HashMap<String, plasmaSwitchboardQueue.Entry>();@@ -1442,12 +1444,13 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<plasmaSwitchbo// tests if hash occurrs in any database// if it exists, the name of the database is returned,// if it not exists, null is returned- if (wordIndex.loadedURL.exists(hash)) return "loaded";+ if (wordIndex.existsURL(hash)) return "loaded";return this.crawlQueues.urlExists(hash);}public void urlRemove(String hash) {- wordIndex.loadedURL.remove(hash);+ wordIndex.removeURL(hash);+ crawlResults.remove(hash);crawlQueues.urlRemove(hash);}@@ -1456,7 +1459,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<plasmaSwitchboif (urlhash.equals(yacyURL.dummyHash)) return null;yacyURL ne = crawlQueues.getURL(urlhash);if (ne != null) return ne;- indexURLEntry le = wordIndex.loadedURL.load(urlhash, null, 0);+ indexURLEntry le = wordIndex.getURL(urlhash, null, 0);if (le != null) return le.comp().url();return null;}@@ -1869,7 +1872,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<plasmaSwitchboif ((crawlQueues.delegatedURL.stackSize() > 1000)) c++;if ((crawlQueues.errorURL.stackSize() > 1000)) c++;for (int i = 1; i <= 6; i++) {- if (wordIndex.loadedURL.getStackSize(i) > 1000) c++;+ if (crawlResults.getStackSize(i) > 1000) c++;}return c;}@@ -1907,9 +1910,9 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<plasmaSwitchbo// clean up loadedURL stackfor (int i = 1; i <= 6; i++) {checkInterruption();- if (wordIndex.loadedURL.getStackSize(i) > 1000) {- log.logFine("Cleaning Loaded-URLs report stack, " + wordIndex.loadedURL.getStackSize(i) + " entries on stack " + i);- wordIndex.loadedURL.clearStack(i);+ if (crawlResults.getStackSize(i) > 1000) {+ log.logFine("Cleaning Loaded-URLs report stack, " + crawlResults.getStackSize(i) + " entries on stack " + i);+ crawlResults.clearStack(i);hasDoneSomething = true;}}@@ -2264,14 +2267,14 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<plasmaSwitchbo// STORE URL TO LOADED-URL-DBtry {- wordIndex.loadedURL.store(newEntry);+ wordIndex.putURL(newEntry);} catch (IOException e) {log.logFine("Not Indexed Resource '" + entry.url().toNormalform(false, true) + "': process case=" + processCase);addURLtoErrorDB(entry.url(), referrerURL.hash(), entry.initiator(), dc_title, "error storing url: " + e.getMessage(), new kelondroBitfield());return;}- wordIndex.loadedURL.stack(+ crawlResults.stack(newEntry, // loaded url db entryentry.initiator(), // initiator peer hashyacyCore.seedDB.mySeed().hash, // executor peer hash@@ -2374,7 +2377,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<plasmaSwitchbo// finally, delete the url entry// determine the url string- indexURLEntry entry = wordIndex.loadedURL.load(urlhash, null, 0);+ indexURLEntry entry = wordIndex.getURL(urlhash, null, 0);if (entry == null) return 0;indexURLEntry.Components comp = entry.comp();if (comp.url() == null) return 0;@@ -2402,7 +2405,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<plasmaSwitchboif (words != null) count = wordIndex.removeWordReferences(words, urlhash);// finally delete the url entry itself- wordIndex.loadedURL.remove(urlhash);+ wordIndex.removeURL(urlhash);return count;} catch (ParserException e) {return 0;@@ -2538,8 +2541,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<plasmaSwitchboif (getConfig(INDEX_DIST_ALLOW, "false").equalsIgnoreCase("false")) {return "no DHT distribution: not enabled (ser setting)";}- if (wordIndex.loadedURL.size() < 10) {- return "no DHT distribution: loadedURL.size() = " + wordIndex.loadedURL.size();+ if (wordIndex.countURL() < 10) {+ return "no DHT distribution: loadedURL.size() = " + wordIndex.countURL();}if (wordIndex.size() < 100) {return "no DHT distribution: not enough words - wordIndex.size() = " + wordIndex.size();diff --git a/source/de/anomic/plasma/plasmaSwitchboardQueue.java b/source/de/anomic/plasma/plasmaSwitchboardQueue.javaindex 885267667..fb5605028 100644--- a/source/de/anomic/plasma/plasmaSwitchboardQueue.java+++ b/source/de/anomic/plasma/plasmaSwitchboardQueue.java@@ -66,13 +66,13 @@ public class plasmaSwitchboardQueue {kelondroStack sbQueueStack;plasmaCrawlProfile profiles;- plasmaCrawlLURL lurls;+ plasmaWordIndex index;private File sbQueueStackPath;- public plasmaSwitchboardQueue(plasmaCrawlLURL lurls, File sbQueueStackPath, plasmaCrawlProfile profiles) {+ public plasmaSwitchboardQueue(plasmaWordIndex index, File sbQueueStackPath, plasmaCrawlProfile profiles) {this.sbQueueStackPath = sbQueueStackPath;this.profiles = profiles;- this.lurls = lurls;+ this.index = index;initQueueStack();}@@ -341,7 +341,7 @@ public class plasmaSwitchboardQueue {public yacyURL referrerURL() {if (referrerURL == null) {if ((referrerHash == null) || (referrerHash.equals(yacyURL.dummyHash))) return null;- indexURLEntry entry = lurls.load(referrerHash, null, 0);+ indexURLEntry entry = index.getURL(referrerHash, null, 0);if (entry == null) referrerURL = null; else referrerURL = entry.comp().url();}return referrerURL;diff --git a/source/de/anomic/plasma/plasmaWordIndex.java b/source/de/anomic/plasma/plasmaWordIndex.javaindex 4bc83b47d..c5feed5cf 100644--- a/source/de/anomic/plasma/plasmaWordIndex.java+++ b/source/de/anomic/plasma/plasmaWordIndex.java@@ -27,6 +27,7 @@package de.anomic.plasma;import java.io.File;+import java.io.IOException;import java.util.ArrayList;import java.util.Date;import java.util.HashMap;@@ -42,8 +43,11 @@ import de.anomic.index.indexContainer;import de.anomic.index.indexContainerOrder;import de.anomic.index.indexRAMRI;import de.anomic.index.indexRI;+import de.anomic.index.indexRWIEntry;import de.anomic.index.indexRWIRowEntry;+import de.anomic.index.indexRepositoryReference;import de.anomic.index.indexURLEntry;+import de.anomic.index.indexRepositoryReference.Export;import de.anomic.kelondro.kelondroBase64Order;import de.anomic.kelondro.kelondroByteOrder;import de.anomic.kelondro.kelondroCloneableIterator;@@ -61,17 +65,16 @@ import de.anomic.yacy.yacyURL;public final class plasmaWordIndex implements indexRI {// environment constants- public static final long wCacheMaxAge = 1000 * 60 * 30; // milliseconds; 30 minutes- public static final int wCacheMaxChunk = 400; // maximum number of references for each urlhash- public static final int lowcachedivisor = 320;- public static final int maxCollectionPartition = 7; // should be 7-- private final kelondroByteOrder indexOrder = kelondroBase64Order.enhancedCoder;- private final indexRAMRI dhtOutCache, dhtInCache;- private final indexCollectionRI collections; // new database structure to replace AssortmentCluster and FileCluster- public boolean busyCacheFlush; // shows if a cache flush is currently performed- private int flushsize;- public final plasmaCrawlLURL loadedURL;+ public static final long wCacheMaxAge = 1000 * 60 * 30; // milliseconds; 30 minutes+ public static final int wCacheMaxChunk = 400; // maximum number of references for each urlhash+ public static final int lowcachedivisor = 320;+ public static final int maxCollectionPartition = 7; // should be 7++ private final kelondroByteOrder indexOrder = kelondroBase64Order.enhancedCoder;+ private final indexRAMRI dhtOutCache, dhtInCache;+ private final indexCollectionRI collections; // new database structure to replace AssortmentCluster and FileCluster+ private int flushsize;+ private final indexRepositoryReference referenceURL;public plasmaWordIndex(File indexPrimaryRoot, File indexSecondaryRoot, String networkName, serverLog log) {File indexPrimaryPath = new File(indexPrimaryRoot, networkName);@@ -103,13 +106,52 @@ public final class plasmaWordIndex implements indexRI {this.collections = new indexCollectionRI(textindexcollections, "collection", maxCollectionPartition, indexRWIRowEntry.urlEntryRow);// create LURL-db- loadedURL = new plasmaCrawlLURL(indexSecondaryRoot, networkName);+ referenceURL = new indexRepositoryReference(indexSecondaryRoot, networkName);// performance settings- busyCacheFlush = false;this.flushsize = 2000;}+ public void putURL(indexURLEntry entry) throws IOException {+ this.referenceURL.store(entry);+ }++ public indexURLEntry getURL(String urlHash, indexRWIEntry searchedWord, long ranking) {+ return this.referenceURL.load(urlHash, searchedWord, ranking);+ }++ public boolean removeURL(String urlHash) {+ return this.referenceURL.remove(urlHash);+ }++ public boolean existsURL(String urlHash) {+ return this.referenceURL.exists(urlHash);+ }++ public int countURL() {+ return this.referenceURL.size();+ }++ public Export exportURL(File f, String filter, int format, boolean dom) {+ return this.referenceURL.export(f, filter, format, dom);+ }++ public Export exportURL() {+ return this.referenceURL.export();+ }++ public kelondroCloneableIterator<indexURLEntry> entriesURL(boolean up, String firstHash) throws IOException {+ return this.referenceURL.entries(up, firstHash);+ }++ public indexRepositoryReference.BlacklistCleaner getURLCleaner(plasmaURLPattern blacklist) {+ return this.referenceURL.getBlacklistCleaner(blacklist); // thread is not already started after this is called!+ }++ public int getURLwriteCacheSize() {+ return this.referenceURL.writeCacheSize();+ }+public int minMem() {return 1024*1024 /* indexing overhead */ + dhtOutCache.minMem() + dhtInCache.minMem() + collections.minMem();}@@ -234,7 +276,6 @@ public final class plasmaWordIndex implements indexRI {private int flushCache(indexRAMRI ram, int count) {if (count <= 0) return 0;- busyCacheFlush = true;String wordHash;ArrayList<indexContainer> containerList = new ArrayList<indexContainer>();count = Math.min(5000, Math.min(count, ram.size()));@@ -269,7 +310,6 @@ public final class plasmaWordIndex implements indexRI {// flush the containerscollections.addMultipleEntries(containerList);//System.out.println("DEBUG-Finished flush of " + count + " entries from RAM to DB in " + (System.currentTimeMillis() - start) + " milliseconds");- busyCacheFlush = false;return containerList.size();}@@ -458,7 +498,7 @@ public final class plasmaWordIndex implements indexRI {dhtInCache.close();dhtOutCache.close();collections.close();- loadedURL.close();+ referenceURL.close();}public indexContainer deleteContainer(String wordHash) {@@ -586,12 +626,13 @@ public final class plasmaWordIndex implements indexRI {}}+// The Cleaner class was provided as "UrldbCleaner" by Hydrox- public synchronized Cleaner makeCleaner(plasmaCrawlLURL lurl, String startHash) {- return new Cleaner(lurl, startHash);+ public synchronized ReferenceCleaner getReferenceCleaner(String startHash) {+ return new ReferenceCleaner(startHash);}- public class Cleaner extends Thread {+ public class ReferenceCleaner extends Thread {private String startHash;private boolean run = true;@@ -600,10 +641,8 @@ public final class plasmaWordIndex implements indexRI {public String wordHashNow = "";public String lastWordHash = "";public int lastDeletionCounter = 0;- private plasmaCrawlLURL lurl;- public Cleaner(plasmaCrawlLURL lurl, String startHash) {- this.lurl = lurl;+ public ReferenceCleaner(String startHash) {this.startHash = startHash;this.rwiCountAtStart = size();}@@ -625,7 +664,7 @@ public final class plasmaWordIndex implements indexRI {entry = containerIterator.next();// System.out.println("Wordhash: "+wordHash+" UrlHash:// "+entry.getUrlHash());- indexURLEntry ue = lurl.load(entry.urlHash(), entry, 0);+ indexURLEntry ue = referenceURL.load(entry.urlHash(), entry, 0);if (ue == null) {urlHashs.add(entry.urlHash());} else {diff --git a/source/de/anomic/urlRedirector/urlRedirectord.java b/source/de/anomic/urlRedirector/urlRedirectord.javaindex d157e1f92..563b6b73e 100644--- a/source/de/anomic/urlRedirector/urlRedirectord.java+++ b/source/de/anomic/urlRedirector/urlRedirectord.java@@ -191,7 +191,7 @@ public class urlRedirectord implements serverHandler {) {// first delete old entry, if existsString urlhash = reqURL.hash();- switchboard.wordIndex.loadedURL.remove(urlhash);+ switchboard.wordIndex.removeURL(urlhash);switchboard.crawlQueues.noticeURL.removeByURLHash(urlhash);switchboard.crawlQueues.errorURL.remove(urlhash);diff --git a/source/de/anomic/yacy/yacyClient.java b/source/de/anomic/yacy/yacyClient.javaindex 528410d94..d77031084 100644--- a/source/de/anomic/yacy/yacyClient.java+++ b/source/de/anomic/yacy/yacyClient.java@@ -61,6 +61,7 @@ import de.anomic.index.indexURLEntry;import de.anomic.kelondro.kelondroBase64Order;import de.anomic.kelondro.kelondroBitfield;import de.anomic.plasma.plasmaCondenser;+import de.anomic.plasma.plasmaCrawlResults;import de.anomic.plasma.plasmaSearchRankingProcess;import de.anomic.plasma.plasmaSearchRankingProfile;import de.anomic.plasma.plasmaSnippetCache;@@ -387,6 +388,7 @@ public final class yacyClient {int partitions,yacySeed target,plasmaWordIndex wordIndex,+ plasmaCrawlResults crawlResults,plasmaSearchRankingProcess containerCache,Map<String, TreeMap<String, String>> abstractCache,plasmaURLPattern blacklist,@@ -502,7 +504,7 @@ public final class yacyClient {String[] urls = new String[results];for (int n = 0; n < results; n++) {// get one single search result- urlEntry = wordIndex.loadedURL.newEntry((String) result.get("resource" + n));+ urlEntry = indexURLEntry.importEntry((String) result.get("resource" + n));if (urlEntry == null) continue;assert (urlEntry.hash().length() == 12) : "urlEntry.hash() = " + urlEntry.hash();if (urlEntry.hash().length() != 12) continue; // bad url hash@@ -533,8 +535,8 @@ public final class yacyClient {// passed all checks, store urltry {- wordIndex.loadedURL.store(urlEntry);- wordIndex.loadedURL.stack(urlEntry, yacyCore.seedDB.mySeed().hash, target.hash, 2);+ wordIndex.putURL(urlEntry);+ crawlResults.stack(urlEntry, yacyCore.seedDB.mySeed().hash, target.hash, 2);} catch (IOException e) {yacyCore.log.logSevere("could not store search result", e);continue; // db-errordiff --git a/source/de/anomic/yacy/yacyPeerActions.java b/source/de/anomic/yacy/yacyPeerActions.javaindex aad9bbebe..a64d8c9ae 100644--- a/source/de/anomic/yacy/yacyPeerActions.java+++ b/source/de/anomic/yacy/yacyPeerActions.java@@ -114,7 +114,7 @@ public class yacyPeerActions {seedDB.mySeed().put(yacySeed.RSPEED, Double.toString(sb.totalQPM /*Math.max((float) requestcdiff, 0f) * 60f / Math.max((float) uptimediff, 1f)*/ ));seedDB.mySeed().put(yacySeed.UPTIME, Long.toString(uptime/60)); // the number of minutes that the peer is up in minutes/day (moving average MA30)- seedDB.mySeed().put(yacySeed.LCOUNT, Integer.toString(sb.wordIndex.loadedURL.size())); // the number of links that the peer has stored (LURL's)+ seedDB.mySeed().put(yacySeed.LCOUNT, Integer.toString(sb.wordIndex.countURL())); // the number of links that the peer has stored (LURL's)seedDB.mySeed().put(yacySeed.NCOUNT, Integer.toString(sb.crawlQueues.noticeURL.size())); // the number of links that the peer has noticed, but not loaded (NURL's)seedDB.mySeed().put(yacySeed.RCOUNT, Integer.toString(sb.crawlQueues.noticeURL.stackSize(plasmaCrawlNURL.STACK_TYPE_LIMIT))); // the number of links that the peer provides for remote crawling (ZURL's)seedDB.mySeed().put(yacySeed.ICOUNT, Integer.toString(sb.wordIndex.size())); // the minimum number of words that the peer has indexed (as it says)diff --git a/source/de/anomic/yacy/yacySearch.java b/source/de/anomic/yacy/yacySearch.javaindex 04c448bce..705c0b13f 100644--- a/source/de/anomic/yacy/yacySearch.java+++ b/source/de/anomic/yacy/yacySearch.java@@ -52,6 +52,7 @@ import java.util.TreeMap;import de.anomic.kelondro.kelondroBitfield;import de.anomic.kelondro.kelondroMScoreCluster;+import de.anomic.plasma.plasmaCrawlResults;import de.anomic.plasma.plasmaSearchRankingProcess;import de.anomic.plasma.plasmaSearchQuery;import de.anomic.plasma.plasmaSearchRankingProfile;@@ -74,9 +75,11 @@ public class yacySearch extends Thread {final private plasmaSearchRankingProfile rankingProfile;final private String prefer, filter;final private kelondroBitfield constraint;+ plasmaCrawlResults crawlResults;public yacySearch(String wordhashes, String excludehashes, String urlhashes, String prefer, String filter, int count, int maxDistance,boolean global, int partitions, yacySeed targetPeer, plasmaWordIndex wordIndex,+ plasmaCrawlResults crawlResults,plasmaSearchRankingProcess containerCache,Map<String, TreeMap<String, String>> abstractCache,plasmaURLPattern blacklist,@@ -92,6 +95,7 @@ public class yacySearch extends Thread {this.global = global;this.partitions = partitions;this.wordIndex = wordIndex;+ this.crawlResults = crawlResults;this.containerCache = containerCache;this.abstractCache = abstractCache;this.blacklist = blacklist;@@ -106,7 +110,7 @@ public class yacySearch extends Thread {public void run() {this.urls = yacyClient.search(wordhashes, excludehashes, urlhashes, prefer, filter, count, maxDistance, global, partitions,- targetPeer, wordIndex, containerCache, abstractCache,+ targetPeer, wordIndex, crawlResults, containerCache, abstractCache,blacklist, rankingProfile, constraint);if (urls != null) {// urls is an array of url hashes. this is only used for log output@@ -248,6 +252,7 @@ public class yacySearch extends Thread {String wordhashes, String excludehashes, String urlhashes,String prefer, String filter, int count, int maxDist,plasmaWordIndex wordIndex,+ plasmaCrawlResults crawlResults,plasmaSearchRankingProcess containerCache,Map<String, TreeMap<String, String>> abstractCache,int targets,@@ -266,7 +271,7 @@ public class yacySearch extends Thread {yacySearch[] searchThreads = new yacySearch[targets];for (int i = 0; i < targets; i++) {searchThreads[i] = new yacySearch(wordhashes, excludehashes, urlhashes, prefer, filter, count, maxDist, true, targets, targetPeers[i],- wordIndex, containerCache, abstractCache, blacklist, rankingProfile, constraint);+ wordIndex, crawlResults, containerCache, abstractCache, blacklist, rankingProfile, constraint);searchThreads[i].start();//try {Thread.sleep(20);} catch (InterruptedException e) {}}@@ -275,6 +280,7 @@ public class yacySearch extends Thread {public static yacySearch secondaryRemoteSearch(String wordhashes, String excludehashes, String urlhashes,plasmaWordIndex wordIndex,+ plasmaCrawlResults crawlResults,plasmaSearchRankingProcess containerCache,String targethash, plasmaURLPattern blacklist,plasmaSearchRankingProfile rankingProfile,@@ -287,7 +293,7 @@ public class yacySearch extends Thread {if (targetPeer == null) return null;if (clusterselection != null) targetPeer.setAlternativeAddress((String) clusterselection.get(targetPeer.hash));yacySearch searchThread = new yacySearch(wordhashes, excludehashes, urlhashes, "", "", 0, 9999, true, 0, targetPeer,- wordIndex, containerCache, new TreeMap<String, TreeMap<String, String>>(), blacklist, rankingProfile, constraint);+ wordIndex, crawlResults, containerCache, new TreeMap<String, TreeMap<String, String>>(), blacklist, rankingProfile, constraint);searchThread.start();return searchThread;}diff --git a/source/yacy.java b/source/yacy.javaindex f87f8321a..bb6a35770 100644--- a/source/yacy.java+++ b/source/yacy.java@@ -70,6 +70,7 @@ import de.anomic.http.httpd;import de.anomic.index.indexContainer;import de.anomic.index.indexRWIEntry;import de.anomic.index.indexRWIRowEntry;+import de.anomic.index.indexRepositoryReference;import de.anomic.index.indexURLEntry;import de.anomic.kelondro.kelondroBase64Order;import de.anomic.kelondro.kelondroDyn;@@ -77,7 +78,6 @@ import de.anomic.kelondro.kelondroMScoreCluster;import de.anomic.kelondro.kelondroMapObjects;import de.anomic.kelondro.kelondroRowCollection;import de.anomic.plasma.plasmaCondenser;-import de.anomic.plasma.plasmaCrawlLURL;import de.anomic.plasma.plasmaSwitchboard;import de.anomic.plasma.plasmaWordIndex;import de.anomic.server.serverCore;@@ -607,10 +607,10 @@ public final class yacy {log.logInfo("STARTING URL CLEANUP");// db containing all currently loades urls- plasmaCrawlLURL currentUrlDB = new plasmaCrawlLURL(indexSecondaryRoot, networkName);+ indexRepositoryReference currentUrlDB = new indexRepositoryReference(indexSecondaryRoot, networkName);// db used to hold all neede urls- plasmaCrawlLURL minimizedUrlDB = new plasmaCrawlLURL(indexRoot2, networkName);+ indexRepositoryReference minimizedUrlDB = new indexRepositoryReference(indexRoot2, networkName);int cacheMem = (int)(serverMemory.max() - serverMemory.total());if (cacheMem < 2048000) throw new OutOfMemoryError("Not enough memory available to start clean up.");@@ -789,8 +789,8 @@ public final class yacy {File root = homePath;File indexroot = new File(root, "DATA/INDEX");try {serverLog.configureLogging(homePath, new File(homePath, "DATA/LOG/yacy.logging"));} catch (Exception e) {}- plasmaCrawlLURL currentUrlDB = new plasmaCrawlLURL(indexroot, networkName);- currentUrlDB.urldbcleanup();+ indexRepositoryReference currentUrlDB = new indexRepositoryReference(indexroot, networkName);+ currentUrlDB.deadlinkCleaner(null);currentUrlDB.close();}