Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
refactoring of plasmaWordIndex: divided that class into three parts: - the peers object is now hosted by the plasmaSwitchboard - the crawler elements are now in a new class, crawler.CrawlerSwitchboard - the index elements are core of the new segment data structure, which is a bundle of different indexes for the full text and (in the future) navigation indexes and the metadata store. The new class is now in kelondro.text.Segment
orbiter99bf0b8e416c
diff --git a/htroot/AccessTracker_p.java b/htroot/AccessTracker_p.javaindex d56630c66..3ddab339f 100644--- a/htroot/AccessTracker_p.java+++ b/htroot/AccessTracker_p.java@@ -233,7 +233,7 @@ public class AccessTracker_p {prop.put("page_list_" + entCount + "_dark", ((dark) ? 1 : 0) ); dark =! dark;prop.putHTML("page_list_" + entCount + "_host", host);if (page == 5) {- final yacySeed remotepeer = sb.webIndex.peers().lookupByIP(natLib.getInetAddress(host), true, true, true);+ final yacySeed remotepeer = sb.peers.lookupByIP(natLib.getInetAddress(host), true, true, true);prop.putHTML("page_list_" + entCount + "_peername", (remotepeer == null) ? "UNKNOWN" : remotepeer.getName());}prop.putNum("page_list_" + entCount + "_count", handles.size());diff --git a/htroot/Banner.java b/htroot/Banner.javaindex afda7aa98..75411aad0 100644--- a/htroot/Banner.java+++ b/htroot/Banner.java@@ -67,14 +67,14 @@ public class Banner {double myqph = 0;String type = "";final String network = env.getConfig(plasmaSwitchboardConstants.NETWORK_NAME, "unspecified").toUpperCase();- final int peers = sb.webIndex.peers().sizeConnected() + 1; // the '+ 1': the own peer is not included in sizeConnected()- long nlinks = sb.webIndex.peers().countActiveURL();- long nwords = sb.webIndex.peers().countActiveRWI();- final double nqpm = sb.webIndex.peers().countActiveQPM();- long nppm = sb.webIndex.peers().countActivePPM();+ final int peers = sb.peers.sizeConnected() + 1; // the '+ 1': the own peer is not included in sizeConnected()+ long nlinks = sb.peers.countActiveURL();+ long nwords = sb.peers.countActiveRWI();+ final double nqpm = sb.peers.countActiveQPM();+ long nppm = sb.peers.countActivePPM();double nqph = 0;- final yacySeed seed = sb.webIndex.peers().mySeed();+ final yacySeed seed = sb.peers.mySeed();if (seed != null){name = seed.get(yacySeed.NAME, "-").toUpperCase();links = Long.parseLong(seed.get(yacySeed.LCOUNT, "0"));@@ -82,19 +82,19 @@ public class Banner {myppm = seed.getPPM();myqph = 60d * seed.getQPM();- if (sb.webIndex.peers().mySeed().isVirgin()) {+ if (sb.peers.mySeed().isVirgin()) {type = "VIRGIN";nqph = Math.round(6000d * nqpm) / 100d;- } else if(sb.webIndex.peers().mySeed().isJunior()) {+ } else if(sb.peers.mySeed().isJunior()) {type = "JUNIOR";nqph = Math.round(6000d * nqpm) / 100d;- } else if(sb.webIndex.peers().mySeed().isSenior()) {+ } else if(sb.peers.mySeed().isSenior()) {type = "SENIOR";nlinks = nlinks + links;nwords = nwords + words;nqph = Math.round(6000d * nqpm + 100d * myqph) / 100d;nppm = nppm + myppm;- } else if(sb.webIndex.peers().mySeed().isPrincipal()) {+ } else if(sb.peers.mySeed().isPrincipal()) {type = "PRINCIPAL";nlinks = nlinks + links;nwords = nwords + words;diff --git a/htroot/BlacklistImpExp_p.java b/htroot/BlacklistImpExp_p.javaindex bd49f85fc..47a4e3201 100644--- a/htroot/BlacklistImpExp_p.java+++ b/htroot/BlacklistImpExp_p.java@@ -64,11 +64,11 @@ public class BlacklistImpExp_p {}// List known hosts for BlackList retrieval- if (sb.webIndex.peers() != null && sb.webIndex.peers().sizeConnected() > 0) { // no nullpointer error+ if (sb.peers != null && sb.peers.sizeConnected() > 0) { // no nullpointer errorint peerCount = 0;try {final TreeMap<String, String> hostList = new TreeMap<String, String>();- final Iterator<yacySeed> e = sb.webIndex.peers().seedsConnected(true, false, null, (float) 0.0);+ final Iterator<yacySeed> e = sb.peers.seedsConnected(true, false, null, (float) 0.0);while (e.hasNext()) {final yacySeed seed = e.next();if (seed != null) hostList.put(seed.get(yacySeed.NAME, "nameless"),seed.hash);diff --git a/htroot/Blog.java b/htroot/Blog.javaindex 3b7f5622e..383925cf8 100644--- a/htroot/Blog.java+++ b/htroot/Blog.java@@ -68,7 +68,7 @@ public class Blog {final boolean xml = (header.get(httpRequestHeader.CONNECTION_PROP_PATH)).endsWith(".xml");- final String address = sb.webIndex.peers().mySeed().getPublicAddress();+ final String address = sb.peers.mySeed().getPublicAddress();if(hasRights) {prop.put("mode_admin", "1");@@ -77,7 +77,7 @@ public class Blog {}if (post == null) {- prop.putHTML("peername", sb.webIndex.peers().mySeed().getName());+ prop.putHTML("peername", sb.peers.mySeed().getName());prop.put("address", address);return putBlogDefault(prop, sb, address, 0, 10, hasRights, xml);}@@ -104,10 +104,10 @@ public class Blog {StrAuthor = sb.blogDB.guessAuthor(ip);if (StrAuthor == null || StrAuthor.length() == 0) {- if (sb.webIndex.peers().mySeed() == null) {+ if (sb.peers.mySeed() == null) {StrAuthor = "anonymous";} else {- StrAuthor = sb.webIndex.peers().mySeed().get("Name", "anonymous");+ StrAuthor = sb.peers.mySeed().get("Name", "anonymous");}}}@@ -169,7 +169,7 @@ public class Blog {map.put("page", pagename);map.put("subject", StrSubject.replace(',', ' '));map.put("author", StrAuthor.replace(',', ' '));- sb.webIndex.peers().newsPool.publishMyNews(yacyNewsRecord.newRecord(sb.webIndex.peers().mySeed(), yacyNewsPool.CATEGORY_BLOG_ADD, map));+ sb.peers.newsPool.publishMyNews(yacyNewsRecord.newRecord(sb.peers.mySeed(), yacyNewsPool.CATEGORY_BLOG_ADD, map));}page = sb.blogDB.readBlogEntry(pagename); //maybe "if(page == null)"@@ -246,7 +246,7 @@ public class Blog {if(pagename.equals(DEFAULT_PAGE)) {// XXX: where are "peername" and "address" used in the template?// XXX: "clientname" is already set to the peername, no need for a new setting- prop.putHTML("peername", sb.webIndex.peers().mySeed().getName());+ prop.putHTML("peername", sb.peers.mySeed().getName());prop.put("address", address);//index all entriesputBlogDefault(prop, sb, address, start, num, hasRights, xml);diff --git a/htroot/BlogComments.java b/htroot/BlogComments.javaindex 253364847..6e71f9dfd 100644--- a/htroot/BlogComments.java+++ b/htroot/BlogComments.java@@ -91,11 +91,11 @@ public class BlogComments {StrAuthor = sb.blogDB.guessAuthor(ip);if (StrAuthor == null || StrAuthor.length() == 0) {- if (sb.webIndex.peers().mySeed() == null) {+ if (sb.peers.mySeed() == null) {StrAuthor = "anonymous";}else {- StrAuthor = sb.webIndex.peers().mySeed().get("Name", "anonymous");+ StrAuthor = sb.peers.mySeed().get("Name", "anonymous");}}}@@ -151,15 +151,15 @@ public class BlogComments {sb.messageDB.write(msgEntry = sb.messageDB.newEntry("blogComment",StrAuthor,- sb.webIndex.peers().mySeed().hash,- sb.webIndex.peers().mySeed().getName(), sb.webIndex.peers().mySeed().hash,+ sb.peers.mySeed().hash,+ sb.peers.mySeed().getName(), sb.peers.mySeed().hash,"new blog comment: " + new String(blogEntry.getSubject(),"UTF-8"), content));} catch (final UnsupportedEncodingException e1) {sb.messageDB.write(msgEntry = sb.messageDB.newEntry("blogComment",StrAuthor,- sb.webIndex.peers().mySeed().hash,- sb.webIndex.peers().mySeed().getName(), sb.webIndex.peers().mySeed().hash,+ sb.peers.mySeed().hash,+ sb.peers.mySeed().getName(), sb.peers.mySeed().hash,"new blog comment: " + new String(blogEntry.getSubject()), content));}@@ -337,7 +337,7 @@ public class BlogComments {.append(sendMailTo).append("\nFrom: ").append("yacy@")- .append(sb.webIndex.peers().mySeed().getName())+ .append(sb.peers.mySeed().getName()).append("\nSubject: [YaCy] ").append(msgEntry.subject().replace('\n', ' ')).append("\nDate: ")diff --git a/htroot/Bookmarks.java b/htroot/Bookmarks.javaindex d491ca3fd..c1584954a 100644--- a/htroot/Bookmarks.java+++ b/htroot/Bookmarks.java@@ -92,7 +92,7 @@ public class Bookmarks {*/// set peer address- final String address = sb.webIndex.peers().mySeed().getPublicAddress();+ final String address = sb.peers.mySeed().getPublicAddress();prop.put("address", address);//defaultvalues@@ -183,7 +183,7 @@ public class Bookmarks {final bookmarksDB.Bookmark bookmark = sb.bookmarksDB.getBookmark(urlHash);if (bookmark == null) {// try to get the bookmark from the LURL database- final URLMetadataRow urlentry = sb.webIndex.metadata().load(urlHash, null, 0);+ final URLMetadataRow urlentry = sb.indexSegment.metadata().load(urlHash, null, 0);plasmaParserDocument document = null;if (urlentry != null) {final URLMetadataRow.Components metadata = urlentry.metadata();@@ -432,7 +432,7 @@ public class Bookmarks {map.put("title", title.replace(',', ' '));map.put("description", description.replace(',', ' '));map.put("tags", tagsString.replace(',', ' '));- sb.webIndex.peers().newsPool.publishMyNews(yacyNewsRecord.newRecord(sb.webIndex.peers().mySeed(), yacyNewsPool.CATEGORY_BOOKMARK_ADD, map));+ sb.peers.newsPool.publishMyNews(yacyNewsRecord.newRecord(sb.peers.mySeed(), yacyNewsPool.CATEGORY_BOOKMARK_ADD, map));}}diff --git a/htroot/ConfigAppearance_p.java b/htroot/ConfigAppearance_p.javaindex 82429f029..6467c1e73 100644--- a/htroot/ConfigAppearance_p.java+++ b/htroot/ConfigAppearance_p.java@@ -177,7 +177,7 @@ public class ConfigAppearance_p {prop.put("popupStatus", 1);}- String myaddress = sb.webIndex.peers().mySeed().getPublicAddress();+ String myaddress = sb.peers.mySeed().getPublicAddress();if (myaddress == null) myaddress = "localhost:" + sb.getConfig("port", "8080");prop.put("myaddress", myaddress);return prop;diff --git a/htroot/ConfigBasic.java b/htroot/ConfigBasic.javaindex 355cd24a5..e85b11c77 100644--- a/htroot/ConfigBasic.java+++ b/htroot/ConfigBasic.java@@ -70,7 +70,7 @@ public class ConfigBasic {// starting a peer ping//boolean doPeerPing = false;- if ((sb.webIndex.peers().mySeed().isVirgin()) || (sb.webIndex.peers().mySeed().isJunior())) {+ if ((sb.peers.mySeed().isVirgin()) || (sb.peers.mySeed().isJunior())) {serverInstantBusyThread.oneTimeJob(sb.yc, "peerPing", null, 0);//doPeerPing = true;}@@ -90,7 +90,7 @@ public class ConfigBasic {}// check if peer name already exists- final yacySeed oldSeed = sb.webIndex.peers().lookupByName(peerName);+ final yacySeed oldSeed = sb.peers.lookupByName(peerName);if ((oldSeed == null) && (!(env.getConfig("peerName", "").equals(peerName)))) {// the name is newfinal boolean nameOK = Pattern.compile("[A-Za-z0-9\\-_]{3,80}").matcher(peerName).matches();@@ -190,7 +190,7 @@ public class ConfigBasic {// check if values are properfinal boolean properPassword = (sb.getConfig(httpd.ADMIN_ACCOUNT_B64MD5, "").length() > 0) || sb.getConfigBool("adminAccountForLocalhost", false);final boolean properName = (env.getConfig("peerName","").length() >= 3) && (!(yacySeed.isDefaultPeerName(env.getConfig("peerName",""))));- final boolean properPort = (sb.webIndex.peers().mySeed().isSenior()) || (sb.webIndex.peers().mySeed().isPrincipal());+ final boolean properPort = (sb.peers.mySeed().isSenior()) || (sb.peers.mySeed().isPrincipal());if ((env.getConfig("defaultFiles", "").startsWith("ConfigBasic.html,"))) {env.setConfig("defaultFiles", env.getConfig("defaultFiles", "").substring(17));diff --git a/htroot/ConfigNetwork_p.java b/htroot/ConfigNetwork_p.javaindex 5b14e1e46..a917128dd 100644--- a/htroot/ConfigNetwork_p.java+++ b/htroot/ConfigNetwork_p.java@@ -124,10 +124,10 @@ public class ConfigNetwork_p {if (indexReceive) {sb.setConfig(plasmaSwitchboardConstants.INDEX_RECEIVE_ALLOW, true);- sb.webIndex.peers().mySeed().setFlagAcceptRemoteIndex(true);+ sb.peers.mySeed().setFlagAcceptRemoteIndex(true);} else {sb.setConfig(plasmaSwitchboardConstants.INDEX_RECEIVE_ALLOW, false);- sb.webIndex.peers().mySeed().setFlagAcceptRemoteIndex(false);+ sb.peers.mySeed().setFlagAcceptRemoteIndex(false);}if (post.get("indexReceiveBlockBlacklist", "").equals("on")) {@@ -137,7 +137,7 @@ public class ConfigNetwork_p {}if (post.containsKey("peertags")) {- sb.webIndex.peers().mySeed().setPeerTags(serverCodings.string2set(normalizedList(post.get("peertags")), ","));+ sb.peers.mySeed().setPeerTags(serverCodings.string2set(normalizedList(post.get("peertags")), ","));}sb.setConfig("cluster.mode", post.get("cluster.mode", "publicpeer"));@@ -170,7 +170,7 @@ public class ConfigNetwork_p {sb.setConfig("cluster.peers.yacydomain", checkYaCyDomainList(post.get("cluster.peers.yacydomain", "")));// update the cluster hash set- sb.clusterhashes = sb.webIndex.peers().clusterHashes(sb.getConfig("cluster.peers.yacydomain", ""));+ sb.clusterhashes = sb.peers.clusterHashes(sb.getConfig("cluster.peers.yacydomain", ""));}}@@ -196,11 +196,11 @@ public class ConfigNetwork_p {prop.put("indexReceiveChecked", (indexReceive) ? "1" : "0");prop.put("indexReceiveBlockBlacklistChecked.on", (sb.getConfig("indexReceiveBlockBlacklist", "true").equals("true")) ? "1" : "0");prop.put("indexReceiveBlockBlacklistChecked.off", (sb.getConfig("indexReceiveBlockBlacklist", "true").equals("true")) ? "0" : "1");- prop.putHTML("peertags", serverCodings.set2string(sb.webIndex.peers().mySeed().getPeerTags(), ",", false));+ prop.putHTML("peertags", serverCodings.set2string(sb.peers.mySeed().getPeerTags(), ",", false));// set seed information directly- sb.webIndex.peers().mySeed().setFlagAcceptRemoteCrawl(sb.getConfigBool("crawlResponse", false));- sb.webIndex.peers().mySeed().setFlagAcceptRemoteIndex(indexReceive);+ sb.peers.mySeed().setFlagAcceptRemoteCrawl(sb.getConfigBool("crawlResponse", false));+ sb.peers.mySeed().setFlagAcceptRemoteIndex(indexReceive);// set p2p/robinson mode flags and valuesprop.put("p2p.checked", (indexDistribute || indexReceive) ? "1" : "0");diff --git a/htroot/ConfigProfile_p.java b/htroot/ConfigProfile_p.javaindex 8f1066902..737c630b5 100644--- a/htroot/ConfigProfile_p.java+++ b/htroot/ConfigProfile_p.java@@ -94,7 +94,7 @@ public class ConfigProfile_p {// generate a news messagefinal Properties news = profile;news.remove("comment");- sb.webIndex.peers().newsPool.publishMyNews(yacyNewsRecord.newRecord(sb.webIndex.peers().mySeed(), yacyNewsPool.CATEGORY_PROFILE_UPDATE, news));+ sb.peers.newsPool.publishMyNews(yacyNewsRecord.newRecord(sb.peers.mySeed(), yacyNewsPool.CATEGORY_PROFILE_UPDATE, news));//yacyCore.newsPool.publishMyNews(new yacyNewsRecord(yacyNewsRecord.CATEGORY_PROFILE_UPDATE, profile));} catch(final IOException e) {} finally {diff --git a/htroot/ConfigRobotsTxt_p.java b/htroot/ConfigRobotsTxt_p.javaindex 293882f84..381729a27 100644--- a/htroot/ConfigRobotsTxt_p.java+++ b/htroot/ConfigRobotsTxt_p.java@@ -44,7 +44,7 @@ public class ConfigRobotsTxt_p {final servletProperties prop = new servletProperties();final httpdRobotsTxtConfig rbc = ((plasmaSwitchboard)env).robotstxtConfig;- prop.put("clientname", sb.webIndex.peers().mySeed().getPublicAddress());+ prop.put("clientname", sb.peers.mySeed().getPublicAddress());if (post != null) {if (post.containsKey("save")) {diff --git a/htroot/Connections_p.java b/htroot/Connections_p.javaindex 16c69e5ae..8a1e44d73 100644--- a/htroot/Connections_p.java+++ b/htroot/Connections_p.java@@ -160,14 +160,14 @@ public final class Connections_p {commandLine = urlRedir.getURL();}- if ((dest != null) && (dest.equals(virtualHost))) dest = sb.webIndex.peers().mySeed().getName() + ".yacy";+ if ((dest != null) && (dest.equals(virtualHost))) dest = sb.peers.mySeed().getName() + ".yacy";// determining if the source is a yacy hostyacySeed seed = null;if (doNameLookup) {- seed = sb.webIndex.peers().lookupByIP(userAddress,true,false,false);+ seed = sb.peers.lookupByIP(userAddress,true,false,false);if (seed != null) {- if ((seed.hash.equals(sb.webIndex.peers().mySeed().hash)) &&+ if ((seed.hash.equals(sb.peers.mySeed().hash)) &&(!seed.get(yacySeed.PORT,"").equals(Integer.toString(userPort)))) {seed = null;}diff --git a/htroot/CrawlProfileEditor_p.java b/htroot/CrawlProfileEditor_p.javaindex 0b852a406..5a5214ae7 100644--- a/htroot/CrawlProfileEditor_p.java+++ b/htroot/CrawlProfileEditor_p.java@@ -30,10 +30,10 @@ import java.util.ArrayList;import java.util.Iterator;import de.anomic.crawler.CrawlProfile;+import de.anomic.crawler.CrawlSwitchboard;import de.anomic.crawler.CrawlProfile.entry;import de.anomic.http.httpRequestHeader;import de.anomic.plasma.plasmaSwitchboard;-import de.anomic.plasma.plasmaWordIndex;import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;import de.anomic.server.servletProperties;@@ -88,37 +88,37 @@ public class CrawlProfileEditor_p {if (post != null) {if (post.containsKey("terminate")) {// termination of a crawl: shift the crawl from active to passive- final CrawlProfile.entry entry = sb.webIndex.profilesActiveCrawls.getEntry(handle);- if (entry != null) sb.webIndex.profilesPassiveCrawls.newEntry(entry.map());- sb.webIndex.profilesActiveCrawls.removeEntry(handle);+ final CrawlProfile.entry entry = sb.crawler.profilesActiveCrawls.getEntry(handle);+ if (entry != null) sb.crawler.profilesPassiveCrawls.newEntry(entry.map());+ sb.crawler.profilesActiveCrawls.removeEntry(handle);// delete all entries from the crawl queue that are deleted heresb.crawlQueues.noticeURL.removeByProfileHandle(handle, 10000);}if (post.containsKey("delete")) {// deletion of a terminated crawl profile- sb.webIndex.profilesPassiveCrawls.removeEntry(handle);+ sb.crawler.profilesPassiveCrawls.removeEntry(handle);}if (post.containsKey("deleteTerminatedProfiles")) {- Iterator<CrawlProfile.entry> profiles = sb.webIndex.profilesPassiveCrawls.profiles(false);+ Iterator<CrawlProfile.entry> profiles = sb.crawler.profilesPassiveCrawls.profiles(false);while (profiles.hasNext()) {profiles.next();profiles.remove();- profiles = sb.webIndex.profilesPassiveCrawls.profiles(false);+ profiles = sb.crawler.profilesPassiveCrawls.profiles(false);}}}// generate handle listint count = 0;- Iterator<CrawlProfile.entry> it = sb.webIndex.profilesActiveCrawls.profiles(true);+ Iterator<CrawlProfile.entry> it = sb.crawler.profilesActiveCrawls.profiles(true);entry selentry;while (it.hasNext()) {selentry = it.next();- if (selentry.name().equals(plasmaWordIndex.CRAWL_PROFILE_SURROGATE) ||- selentry.name().equals(plasmaWordIndex.CRAWL_PROFILE_PROXY) ||- selentry.name().equals(plasmaWordIndex.CRAWL_PROFILE_REMOTE) /*||- selentry.name().equals(plasmaSwitchboard.CRAWL_PROFILE_SNIPPET_TEXT) ||- selentry.name().equals(plasmaSwitchboard.CRAWL_PROFILE_SNIPPET_MEDIA)*/)+ if (selentry.name().equals(CrawlSwitchboard.CRAWL_PROFILE_SURROGATE) ||+ selentry.name().equals(CrawlSwitchboard.CRAWL_PROFILE_PROXY) ||+ selentry.name().equals(CrawlSwitchboard.CRAWL_PROFILE_REMOTE) /*||+ selentry.name().equals(CrawlSwitchboard.CRAWL_PROFILE_SNIPPET_TEXT) ||+ selentry.name().equals(CrawlSwitchboard.CRAWL_PROFILE_SNIPPET_MEDIA)*/)continue;prop.put("profiles_" + count + "_name", selentry.name());prop.put("profiles_" + count + "_handle", selentry.handle());@@ -127,7 +127,7 @@ public class CrawlProfileEditor_p {count++;}prop.put("profiles", count);- selentry = sb.webIndex.profilesActiveCrawls.getEntry(handle);+ selentry = sb.crawler.profilesActiveCrawls.getEntry(handle);// read post for change submitif ((post != null) && (selentry != null)) {@@ -139,7 +139,7 @@ public class CrawlProfileEditor_p {tee = lit.next();final String cval = selentry.map().get(tee.name);final String val = (tee.type == eentry.BOOLEAN) ? Boolean.toString(post.containsKey(tee.name)) : post.get(tee.name, cval);- if (!cval.equals(val)) sb.webIndex.profilesActiveCrawls.changeEntry(selentry, tee.name, val);+ if (!cval.equals(val)) sb.crawler.profilesActiveCrawls.changeEntry(selentry, tee.name, val);}} catch (final IOException ex) {prop.put("error", "1");@@ -154,7 +154,7 @@ public class CrawlProfileEditor_p {final int domlistlength = (post == null) ? 160 : post.getInt("domlistlength", 160);CrawlProfile.entry profile;// put active crawls into list- it = sb.webIndex.profilesActiveCrawls.profiles(true);+ it = sb.crawler.profilesActiveCrawls.profiles(true);while (it.hasNext()) {profile = it.next();putProfileEntry(prop, profile, true, dark, count, domlistlength);@@ -163,7 +163,7 @@ public class CrawlProfileEditor_p {}// put passive crawls into listboolean existPassiveCrawls = false;- it = sb.webIndex.profilesPassiveCrawls.profiles(true);+ it = sb.crawler.profilesPassiveCrawls.profiles(true);while (it.hasNext()) {profile = it.next();putProfileEntry(prop, profile, false, dark, count, domlistlength);diff --git a/htroot/CrawlResults.java b/htroot/CrawlResults.javaindex ce8df5eb2..f58c359c3 100644--- a/htroot/CrawlResults.java+++ b/htroot/CrawlResults.java@@ -104,7 +104,7 @@ public class CrawlResults {final String hash = post.get("hash", null);if (hash != null) {// delete from database- sb.webIndex.metadata().remove(hash);+ sb.indexSegment.metadata().remove(hash);}}@@ -114,7 +114,7 @@ public class CrawlResults {if (hashpart != null) {// delete all urls for this domain from databasetry {- sb.webIndex.metadata().deleteDomain(hashpart);+ sb.indexSegment.metadata().deleteDomain(hashpart);sb.crawlResults.deleteDomain(tabletype, domain, hashpart);} catch (IOException e) {e.printStackTrace();@@ -178,7 +178,7 @@ public class CrawlResults {executorHash = sb.crawlResults.getExecutorHash(tabletype, i);urlHash = sb.crawlResults.getUrlHash(tabletype, i);try {- urle = sb.webIndex.metadata().load(urlHash, null, 0);+ urle = sb.indexSegment.metadata().load(urlHash, null, 0);if(urle == null) {Log.logWarning("PLASMA", "CrawlResults: URL not in index for crawl result "+ i +" with hash "+ urlHash);urlstr = null;@@ -189,8 +189,8 @@ public class CrawlResults {urlstr = metadata.url().toNormalform(false, true);urltxt = nxTools.shortenURLString(urlstr, 72); // shorten the string text like a URL}- initiatorSeed = sb.webIndex.peers().getConnected(initiatorHash);- executorSeed = sb.webIndex.peers().getConnected(executorHash);+ initiatorSeed = sb.peers.getConnected(initiatorHash);+ executorSeed = sb.peers.getConnected(executorHash);prop.put("table_indexed_" + cnt + "_dark", (dark) ? "1" : "0");prop.put("table_indexed_" + cnt + "_feedbackpage", "CrawlResults.html");diff --git a/htroot/CrawlStart_p.java b/htroot/CrawlStart_p.javaindex 4896c9f63..ee52d04e7 100644--- a/htroot/CrawlStart_p.java+++ b/htroot/CrawlStart_p.java@@ -39,7 +39,7 @@ public class CrawlStart_p {final serverObjects prop = new serverObjects();// define visible variables- String a = sb.webIndex.peers().mySeed().getPublicAddress();+ String a = sb.peers.mySeed().getPublicAddress();boolean intranet = sb.getConfig(plasmaSwitchboardConstants.NETWORK_NAME, "").equals("intranet");String repository = "http://" + ((a == null) ? "localhost:" + sb.getConfig("port", "8080") : a) + "/repository/";prop.put("starturl", (intranet) ? repository : "http://");diff --git a/htroot/IndexCleaner_p.java b/htroot/IndexCleaner_p.javaindex fd75a20e7..ae425c38b 100755--- a/htroot/IndexCleaner_p.java+++ b/htroot/IndexCleaner_p.java@@ -26,14 +26,14 @@import de.anomic.http.httpRequestHeader;import de.anomic.kelondro.text.MetadataRepository;+import de.anomic.kelondro.text.Segment;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 MetadataRepository.BlacklistCleaner urldbCleanerThread = null;- private static plasmaWordIndex.ReferenceCleaner indexCleanerThread = null;+ private static Segment.ReferenceCleaner indexCleanerThread = null;public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch<?> env) {final serverObjects prop = new serverObjects();@@ -43,7 +43,7 @@ public class IndexCleaner_p {//prop.putHTML("bla", "post!=null");if (post.get("action").equals("ustart")) {if (urldbCleanerThread==null || !urldbCleanerThread.isAlive()) {- urldbCleanerThread = sb.webIndex.metadata().getBlacklistCleaner(plasmaSwitchboard.urlBlacklist);+ urldbCleanerThread = sb.indexSegment.metadata().getBlacklistCleaner(plasmaSwitchboard.urlBlacklist);urldbCleanerThread.start();}else {@@ -58,7 +58,7 @@ public class IndexCleaner_p {}else if (post.get("action").equals("rstart")) {if (indexCleanerThread==null || !indexCleanerThread.isAlive()) {- indexCleanerThread = sb.webIndex.getReferenceCleaner(post.get("wordHash","AAAAAAAAAAAA").getBytes());+ indexCleanerThread = sb.indexSegment.getReferenceCleaner(post.get("wordHash","AAAAAAAAAAAA").getBytes());indexCleanerThread.start();}else {@@ -77,7 +77,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.webIndex.metadata().size())*100);+ prop.putNum("urldb_percentUrls", ((double)urldbCleanerThread.totalSearchedUrls/sb.indexSegment.metadata().size())*100);prop.putNum("urldb_blacklisted", urldbCleanerThread.blacklistedUrls);prop.putNum("urldb_total", urldbCleanerThread.totalSearchedUrls);prop.putHTML("urldb_lastBlacklistedUrl", urldbCleanerThread.lastBlacklistedUrl);@@ -94,7 +94,7 @@ public class IndexCleaner_p {prop.put("rwidb_threadAlive", indexCleanerThread.isAlive() + "");prop.put("rwidb_threadToString", indexCleanerThread.toString());prop.putNum("rwidb_RWIcountstart", indexCleanerThread.rwiCountAtStart);- prop.putNum("rwidb_RWIcountnow", sb.webIndex.index().size());+ prop.putNum("rwidb_RWIcountnow", sb.indexSegment.index().size());prop.put("rwidb_wordHashNow", (indexCleanerThread.wordHashNow == null) ? "NULL" : new String(indexCleanerThread.wordHashNow));prop.put("rwidb_lastWordHash", (indexCleanerThread.lastWordHash == null) ? "null" : new String(indexCleanerThread.lastWordHash));prop.putNum("rwidb_lastDeletionCounter", indexCleanerThread.lastDeletionCounter);diff --git a/htroot/IndexControlRWIs_p.java b/htroot/IndexControlRWIs_p.javaindex 4e9d97754..f37db9bf1 100644--- a/htroot/IndexControlRWIs_p.java+++ b/htroot/IndexControlRWIs_p.java@@ -41,13 +41,13 @@ import de.anomic.kelondro.order.Bitfield;import de.anomic.kelondro.text.Reference;import de.anomic.kelondro.text.ReferenceContainer;import de.anomic.kelondro.text.ReferenceContainerCache;+import de.anomic.kelondro.text.Segment;import de.anomic.kelondro.text.metadataPrototype.URLMetadataRow;import de.anomic.kelondro.text.referencePrototype.WordReference;import de.anomic.plasma.plasmaSearchAPI;import de.anomic.plasma.plasmaSearchEvent;import de.anomic.plasma.plasmaSearchRankingProcess;import de.anomic.plasma.plasmaSwitchboard;-import de.anomic.plasma.plasmaWordIndex;import de.anomic.plasma.parser.Word;import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;@@ -109,7 +109,7 @@ public class IndexControlRWIs_p {// delete everythingif (post.containsKey("deletecomplete") && post.containsKey("confirmDelete")) {- sb.webIndex.clear();+ sb.indexSegment.clear();sb.crawlQueues.clear();sb.crawlStacker.clear();try {@@ -125,7 +125,7 @@ public class IndexControlRWIs_p {if (delurl || delurlref) {// generate an urlx arrayReferenceContainer<WordReference> index = null;- index = sb.webIndex.index().get(keyhash, null);+ index = sb.indexSegment.index().get(keyhash, null);final Iterator<WordReference> en = index.entries();int i = 0;urlx = new String[index.size()];@@ -142,7 +142,7 @@ public class IndexControlRWIs_p {sb.urlRemove(urlx[i]);}}- sb.webIndex.index().delete(keyhash);+ sb.indexSegment.index().delete(keyhash);post.remove("keyhashdeleteall");post.put("urllist", "generated");} catch (IOException e) {@@ -161,7 +161,7 @@ public class IndexControlRWIs_p {}final Set<String> urlHashes = new HashSet<String>();for (int i = 0; i < urlx.length; i++) urlHashes.add(urlx[i]);- sb.webIndex.index().remove(keyhash, urlHashes);+ sb.indexSegment.index().remove(keyhash, urlHashes);// this shall lead to a presentation of the list; so handle that the remaining program// thinks that it was called for a list presentationpost.remove("keyhashdelete");@@ -192,20 +192,20 @@ public class IndexControlRWIs_p {if (host.length() != 0) {if (host.length() == 12) {// the host string is a peer hash- seed = sb.webIndex.peers().getConnected(host);+ seed = sb.peers.getConnected(host);} else {// the host string can be a host name- seed = sb.webIndex.peers().lookupByName(host);+ seed = sb.peers.lookupByName(host);}} else {host = post.get("hostHash", ""); // if input field is empty, get from select box- seed = sb.webIndex.peers().getConnected(host);+ seed = sb.peers.getConnected(host);}// prepare indexReferenceContainer<WordReference> index;final long starttime = System.currentTimeMillis();- index = sb.webIndex.index().get(keyhash, null);+ index = sb.indexSegment.index().get(keyhash, null);// built urlCachefinal Iterator<WordReference> urlIter = index.entries();final HashMap<String, URLMetadataRow> knownURLs = new HashMap<String, URLMetadataRow>();@@ -214,7 +214,7 @@ public class IndexControlRWIs_p {URLMetadataRow lurl;while (urlIter.hasNext()) {iEntry = urlIter.next();- lurl = sb.webIndex.metadata().load(iEntry.metadataHash(), null, 0);+ lurl = sb.indexSegment.metadata().load(iEntry.metadataHash(), null, 0);if (lurl == null) {unknownURLEntries.add(iEntry.metadataHash());urlIter.remove();@@ -224,7 +224,7 @@ public class IndexControlRWIs_p {}// make an indexContainerCache- ReferenceContainerCache<WordReference> icc = new ReferenceContainerCache<WordReference>(plasmaWordIndex.wordReferenceFactory, index.rowdef, plasmaWordIndex.wordOrder);+ ReferenceContainerCache<WordReference> icc = new ReferenceContainerCache<WordReference>(Segment.wordReferenceFactory, index.rowdef, Segment.wordOrder);icc.add(index);// transport to other peer@@ -244,7 +244,7 @@ public class IndexControlRWIs_p {// generate listif (post.containsKey("keyhashsimilar")) try {- final Iterator<ReferenceContainer<WordReference>> containerIt = sb.webIndex.index().references(keyhash, true, 256, false).iterator();+ final Iterator<ReferenceContainer<WordReference>> containerIt = sb.indexSegment.index().references(keyhash, true, 256, false).iterator();ReferenceContainer<WordReference> container;int i = 0;int rows = 0, cols = 0;@@ -278,8 +278,8 @@ public class IndexControlRWIs_p {yacyURL url;for (int i=0; i<urlx.length; i++) {urlHashes.add(urlx[i]);- final URLMetadataRow e = sb.webIndex.metadata().load(urlx[i], null, 0);- sb.webIndex.metadata().remove(urlx[i]);+ final URLMetadataRow e = sb.indexSegment.metadata().load(urlx[i], null, 0);+ sb.indexSegment.metadata().remove(urlx[i]);if (e != null) {url = e.metadata().url();pw.println(url.getHost() + "/" + url.getFile());@@ -306,8 +306,8 @@ public class IndexControlRWIs_p {yacyURL url;for (int i=0; i<urlx.length; i++) {urlHashes.add(urlx[i]);- final URLMetadataRow e = sb.webIndex.metadata().load(urlx[i], null, 0);- sb.webIndex.metadata().remove(urlx[i]);+ final URLMetadataRow e = sb.indexSegment.metadata().load(urlx[i], null, 0);+ sb.indexSegment.metadata().remove(urlx[i]);if (e != null) {url = e.metadata().url();pw.println(url.getHost() + "/.*");@@ -325,7 +325,7 @@ public class IndexControlRWIs_p {}}try {- sb.webIndex.index().remove(keyhash, urlHashes);+ sb.indexSegment.index().remove(keyhash, urlHashes);} catch (IOException e) {e.printStackTrace();}@@ -336,7 +336,7 @@ public class IndexControlRWIs_p {// insert constants- prop.putNum("wcount", sb.webIndex.index().size());+ prop.putNum("wcount", sb.indexSegment.index().size());// return rewrite propertiesreturn prop;}diff --git a/htroot/IndexControlURLs_p.java b/htroot/IndexControlURLs_p.javaindex 79229aa1c..7e7095d69 100644--- a/htroot/IndexControlURLs_p.java+++ b/htroot/IndexControlURLs_p.java@@ -52,7 +52,7 @@ public class IndexControlURLs_p {prop.put("urlstring", "");prop.put("urlhash", "");prop.put("result", "");- prop.put("ucount", Integer.toString(sb.webIndex.metadata().size()));+ prop.put("ucount", Integer.toString(sb.indexSegment.metadata().size()));prop.put("otherHosts", "");prop.put("genUrlProfile", 0);prop.put("statistics", 1);@@ -61,7 +61,7 @@ public class IndexControlURLs_p {prop.put("reload", 0);// show export messages- final MetadataRepository.Export export = sb.webIndex.metadata().export();+ final MetadataRepository.Export export = sb.indexSegment.metadata().export();if ((export != null) && (export.isAlive())) {// there is currently a running exportprop.put("lurlexport", 2);@@ -115,7 +115,7 @@ public class IndexControlURLs_p {}if (post.containsKey("urlhashdelete")) {- final URLMetadataRow entry = sb.webIndex.metadata().load(urlhash, null, 0);+ final URLMetadataRow entry = sb.indexSegment.metadata().load(urlhash, null, 0);if (entry == null) {prop.putHTML("result", "No Entry for URL hash " + urlhash + "; nothing deleted.");} else {@@ -149,7 +149,7 @@ public class IndexControlURLs_p {final yacyURL url = new yacyURL(urlstring, null);urlhash = url.hash();prop.put("urlhash", urlhash);- final URLMetadataRow entry = sb.webIndex.metadata().load(urlhash, null, 0);+ final URLMetadataRow entry = sb.indexSegment.metadata().load(urlhash, null, 0);if (entry == null) {prop.putHTML("urlstring", "unknown url: " + urlstring);prop.put("urlhash", "");@@ -166,7 +166,7 @@ public class IndexControlURLs_p {}if (post.containsKey("urlhashsearch")) {- final URLMetadataRow entry = sb.webIndex.metadata().load(urlhash, null, 0);+ final URLMetadataRow entry = sb.indexSegment.metadata().load(urlhash, null, 0);if (entry == null) {prop.putHTML("result", "No Entry for URL hash " + urlhash);} else {@@ -181,7 +181,7 @@ public class IndexControlURLs_p {// generate listif (post.containsKey("urlhashsimilar")) {try {- final Iterator<URLMetadataRow> entryIt = new RotateIterator<URLMetadataRow>(sb.webIndex.metadata().entries(true, urlhash), new String(Base64Order.zero((urlhash == null ? 0 : urlhash.length()))), sb.webIndex.index().size());+ final Iterator<URLMetadataRow> entryIt = new RotateIterator<URLMetadataRow>(sb.indexSegment.metadata().entries(true, urlhash), new String(Base64Order.zero((urlhash == null ? 0 : urlhash.length()))), sb.indexSegment.index().size());final StringBuilder result = new StringBuilder("Sequential List of URL-Hashes:<br />");URLMetadataRow entry;int i = 0;@@ -228,7 +228,7 @@ public class IndexControlURLs_p {final File f = new File(s);f.getParentFile().mkdirs();final String filter = post.get("exportfilter", ".*");- final MetadataRepository.Export running = sb.webIndex.metadata().export(f, filter, null, format, dom);+ final MetadataRepository.Export running = sb.indexSegment.metadata().export(f, filter, null, format, dom);prop.put("lurlexport_exportfile", s);prop.put("lurlexport_urlcount", running.count());@@ -241,7 +241,7 @@ public class IndexControlURLs_p {if (post.containsKey("deletedomain")) {String hp = post.get("hashpart");try {- sb.webIndex.metadata().deleteDomain(hp);+ sb.indexSegment.metadata().deleteDomain(hp);} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();@@ -257,7 +257,7 @@ public class IndexControlURLs_p {prop.put("statistics_lines", count);int cnt = 0;try {- statsiter = sb.webIndex.metadata().statistics(count);+ statsiter = sb.indexSegment.metadata().statistics(count);boolean dark = true;MetadataRepository.hostStat hs;while (statsiter.hasNext() && cnt < count) {@@ -280,7 +280,7 @@ public class IndexControlURLs_p {}// insert constants- prop.putNum("ucount", sb.webIndex.metadata().size());+ prop.putNum("ucount", sb.indexSegment.metadata().size());// return rewrite propertiesreturn prop;}@@ -293,7 +293,7 @@ public class IndexControlURLs_p {return prop;}final URLMetadataRow.Components metadata = entry.metadata();- final URLMetadataRow le = ((entry.referrerHash() == null) || (entry.referrerHash().length() != yacySeedDB.commonHashLength)) ? null : switchboard.webIndex.metadata().load(entry.referrerHash(), null, 0);+ final URLMetadataRow le = ((entry.referrerHash() == null) || (entry.referrerHash().length() != yacySeedDB.commonHashLength)) ? null : switchboard.indexSegment.metadata().load(entry.referrerHash(), null, 0);if (metadata.url() == null) {prop.put("genUrlProfile", "1");prop.put("genUrlProfile_urlhash", urlhash);diff --git a/htroot/IndexCreateIndexingQueue_p.java b/htroot/IndexCreateIndexingQueue_p.javaindex d1ae875cc..137194c25 100644--- a/htroot/IndexCreateIndexingQueue_p.java+++ b/htroot/IndexCreateIndexingQueue_p.java@@ -63,20 +63,20 @@ public class IndexCreateIndexingQueue_p {}if (post.containsKey("clearIndexingQueue")) {try {- synchronized (sb.webIndex.queuePreStack) {+ synchronized (sb.crawler.queuePreStack) {IndexingStack.QueueEntry entry = null;- while ((entry = sb.webIndex.queuePreStack.pop()) != null) {+ while ((entry = sb.crawler.queuePreStack.pop()) != null) {if ((entry != null) && (entry.profile() != null) && (!(entry.profile().storeHTCache()))) {plasmaHTCache.deleteFromCache(entry.url());}}- sb.webIndex.queuePreStack.clear(); // reset file to clean up content completely+ sb.crawler.queuePreStack.clear(); // reset file to clean up content completely}} catch (final Exception e) {}} else if (post.containsKey("deleteEntry")) {final String urlHash = post.get("deleteEntry");try {- sb.webIndex.queuePreStack.remove(urlHash);+ sb.crawler.queuePreStack.remove(urlHash);} catch (final Exception e) {}prop.put("LOCATION","");return prop;@@ -86,7 +86,7 @@ public class IndexCreateIndexingQueue_p {yacySeed initiator;boolean dark;- if ((sb.webIndex.queuePreStack.size() == 0) && (sb.webIndex.queuePreStack.getActiveQueueSize() == 0)) {+ if ((sb.crawler.queuePreStack.size() == 0) && (sb.crawler.queuePreStack.getActiveQueueSize() == 0)) {prop.put("indexing-queue", "0"); //is empty} else {prop.put("indexing-queue", "1"); // there are entries in the queue or in process@@ -98,12 +98,12 @@ public class IndexCreateIndexingQueue_p {// getting all entries that are currently in processfinal ArrayList<IndexingStack.QueueEntry> entryList = new ArrayList<IndexingStack.QueueEntry>();- entryList.addAll(sb.webIndex.queuePreStack.getActiveQueueEntries());+ entryList.addAll(sb.crawler.queuePreStack.getActiveQueueEntries());final int inProcessCount = entryList.size();// getting all enqueued entries- if ((sb.webIndex.queuePreStack.size() > 0)) {- final Iterator<IndexingStack.QueueEntry> i = sb.webIndex.queuePreStack.entryIterator(false);+ if ((sb.crawler.queuePreStack.size() > 0)) {+ final Iterator<IndexingStack.QueueEntry> i = sb.crawler.queuePreStack.entryIterator(false);while (i.hasNext()) entryList.add(i.next());}@@ -116,7 +116,7 @@ public class IndexCreateIndexingQueue_p {if ((pcentry != null)&&(pcentry.url() != null)) {final long entrySize = pcentry.size();totalSize += entrySize;- initiator = sb.webIndex.peers().getConnected(pcentry.initiator());+ initiator = sb.peers.getConnected(pcentry.initiator());prop.put("indexing-queue_list_"+entryCount+"_dark", inProcess ? "2" : (dark ? "1" : "0"));prop.putHTML("indexing-queue_list_"+entryCount+"_initiator", ((initiator == null) ? "proxy" : initiator.getName()));prop.put("indexing-queue_list_"+entryCount+"_depth", pcentry.depth());@@ -163,8 +163,8 @@ public class IndexCreateIndexingQueue_p {initiatorHash = entry.initiator();executorHash = entry.executor();- initiatorSeed = sb.webIndex.peers().getConnected(initiatorHash);- executorSeed = sb.webIndex.peers().getConnected(executorHash);+ initiatorSeed = sb.peers.getConnected(initiatorHash);+ executorSeed = sb.peers.getConnected(executorHash);prop.putHTML("rejected_list_"+j+"_initiator", ((initiatorSeed == null) ? "proxy" : initiatorSeed.getName()));prop.putHTML("rejected_list_"+j+"_executor", ((executorSeed == null) ? "proxy" : executorSeed.getName()));prop.putHTML("rejected_list_"+j+"_url", url.toNormalform(false, true));diff --git a/htroot/IndexCreateLoaderQueue_p.java b/htroot/IndexCreateLoaderQueue_p.javaindex 6ba003506..52f3d536d 100644--- a/htroot/IndexCreateLoaderQueue_p.java+++ b/htroot/IndexCreateLoaderQueue_p.java@@ -50,7 +50,7 @@ public class IndexCreateLoaderQueue_p {for (int i = 0; i < w.length; i++) {if (w[i] == null) continue;- initiator = sb.webIndex.peers().getConnected(w[i].initiator());+ initiator = sb.peers.getConnected(w[i].initiator());prop.put("loader-set_list_"+count+"_dark", dark ? "1" : "0");prop.putHTML("loader-set_list_"+count+"_initiator", ((initiator == null) ? "proxy" : initiator.getName()));prop.put("loader-set_list_"+count+"_depth", w[i].depth());diff --git a/htroot/IndexCreateWWWGlobalQueue_p.java b/htroot/IndexCreateWWWGlobalQueue_p.javaindex b805709bf..108546738 100644--- a/htroot/IndexCreateWWWGlobalQueue_p.java+++ b/htroot/IndexCreateWWWGlobalQueue_p.java@@ -96,9 +96,9 @@ public class IndexCreateWWWGlobalQueue_p {for (i = 0; (i < crawlerList.size()) && (showNum < showLimit); i++) {urle = crawlerList.get(i);if ((urle != null)&&(urle.url()!=null)) {- initiator = sb.webIndex.peers().getConnected(urle.initiator());+ initiator = sb.peers.getConnected(urle.initiator());profileHandle = urle.profileHandle();- profileEntry = (profileHandle == null) ? null : sb.webIndex.profilesActiveCrawls.getEntry(profileHandle);+ profileEntry = (profileHandle == null) ? null : sb.crawler.profilesActiveCrawls.getEntry(profileHandle);prop.put("crawler-queue_list_"+showNum+"_dark", dark ? "1" : "0");prop.putHTML("crawler-queue_list_"+showNum+"_initiator", ((initiator == null) ? "proxy" : initiator.getName()) );prop.put("crawler-queue_list_"+showNum+"_profile", ((profileEntry == null) ? "unknown" : profileEntry.name()));diff --git a/htroot/IndexCreateWWWLocalQueue_p.java b/htroot/IndexCreateWWWLocalQueue_p.javaindex a72759b06..e6e958cd1 100644--- a/htroot/IndexCreateWWWLocalQueue_p.java+++ b/htroot/IndexCreateWWWLocalQueue_p.java@@ -38,7 +38,7 @@ import de.anomic.crawler.CrawlProfile;import de.anomic.crawler.NoticedURL;import de.anomic.http.httpRequestHeader;import de.anomic.plasma.plasmaSwitchboard;-import de.anomic.plasma.plasmaWordIndex;+import de.anomic.crawler.CrawlSwitchboard;import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;import de.anomic.yacy.yacySeed;@@ -90,21 +90,21 @@ public class IndexCreateWWWLocalQueue_p {if (option == PROFILE) {// search and delete the crawl profile (_much_ faster, independant of queue size)// XXX: what to do about the annoying LOST PROFILE messages in the log?- final Iterator<CrawlProfile.entry> it = sb.webIndex.profilesActiveCrawls.profiles(true);+ final Iterator<CrawlProfile.entry> it = sb.crawler.profilesActiveCrawls.profiles(true);CrawlProfile.entry entry;while (it.hasNext()) {entry = it.next();final String name = entry.name();- if (name.equals(plasmaWordIndex.CRAWL_PROFILE_PROXY) ||- name.equals(plasmaWordIndex.CRAWL_PROFILE_REMOTE) ||- name.equals(plasmaWordIndex.CRAWL_PROFILE_SNIPPET_LOCAL_TEXT) ||- name.equals(plasmaWordIndex.CRAWL_PROFILE_SNIPPET_GLOBAL_TEXT) ||- name.equals(plasmaWordIndex.CRAWL_PROFILE_SNIPPET_LOCAL_MEDIA) ||- name.equals(plasmaWordIndex.CRAWL_PROFILE_SNIPPET_GLOBAL_MEDIA) ||- name.equals(plasmaWordIndex.CRAWL_PROFILE_SURROGATE))+ if (name.equals(CrawlSwitchboard.CRAWL_PROFILE_PROXY) ||+ name.equals(CrawlSwitchboard.CRAWL_PROFILE_REMOTE) ||+ name.equals(CrawlSwitchboard.CRAWL_PROFILE_SNIPPET_LOCAL_TEXT) ||+ name.equals(CrawlSwitchboard.CRAWL_PROFILE_SNIPPET_GLOBAL_TEXT) ||+ name.equals(CrawlSwitchboard.CRAWL_PROFILE_SNIPPET_LOCAL_MEDIA) ||+ name.equals(CrawlSwitchboard.CRAWL_PROFILE_SNIPPET_GLOBAL_MEDIA) ||+ name.equals(CrawlSwitchboard.CRAWL_PROFILE_SURROGATE))continue;if (compiledPattern.matcher(name).find()) {- sb.webIndex.profilesActiveCrawls.removeEntry(entry.handle());+ sb.crawler.profilesActiveCrawls.removeEntry(entry.handle());}}} else {@@ -165,9 +165,9 @@ public class IndexCreateWWWLocalQueue_p {for (i = 0; (i < crawlerList.size()) && (showNum < showLimit); i++) {urle = crawlerList.get(i);if ((urle != null)&&(urle.url()!=null)) {- initiator = sb.webIndex.peers().getConnected(urle.initiator());+ initiator = sb.peers.getConnected(urle.initiator());profileHandle = urle.profileHandle();- profileEntry = (profileHandle == null) ? null : sb.webIndex.profilesActiveCrawls.getEntry(profileHandle);+ profileEntry = (profileHandle == null) ? null : sb.crawler.profilesActiveCrawls.getEntry(profileHandle);prop.put("crawler-queue_list_"+showNum+"_dark", dark ? "1" : "0");prop.putHTML("crawler-queue_list_"+showNum+"_initiator", ((initiator == null) ? "proxy" : initiator.getName()) );prop.put("crawler-queue_list_"+showNum+"_profile", ((profileEntry == null) ? "unknown" : profileEntry.name()));diff --git a/htroot/IndexCreateWWWRemoteQueue_p.java b/htroot/IndexCreateWWWRemoteQueue_p.javaindex f7c6a2c45..77c4dcc6a 100644--- a/htroot/IndexCreateWWWRemoteQueue_p.java+++ b/htroot/IndexCreateWWWRemoteQueue_p.java@@ -96,9 +96,9 @@ public class IndexCreateWWWRemoteQueue_p {for (i = 0; (i < crawlerList.size()) && (showNum < showLimit); i++) {urle = crawlerList.get(i);if (urle != null && urle.url() != null) {- initiator = sb.webIndex.peers().getConnected(urle.initiator());+ initiator = sb.peers.getConnected(urle.initiator());profileHandle = urle.profileHandle();- profileEntry = (profileHandle == null) ? null : sb.webIndex.profilesActiveCrawls.getEntry(profileHandle);+ profileEntry = (profileHandle == null) ? null : sb.crawler.profilesActiveCrawls.getEntry(profileHandle);prop.put("crawler-queue_list_" + showNum + "_dark", dark ? "1" : "0");prop.putHTML("crawler-queue_list_" + showNum + "_initiator", ((initiator == null) ? "proxy" : initiator.getName()));prop.put("crawler-queue_list_" + showNum + "_profile", ((profileEntry == null) ? "unknown" : profileEntry.name()));diff --git a/htroot/IndexImport_p.java b/htroot/IndexImport_p.javaindex c6421d385..f048721dd 100644--- a/htroot/IndexImport_p.java+++ b/htroot/IndexImport_p.java@@ -55,7 +55,7 @@ public final class IndexImport_p {try {final boolean startImport = true;if (startImport) {- final Importer importerThread = new NoticeURLImporter(switchboard.plasmaPath, switchboard.crawlQueues, switchboard.webIndex.profilesActiveCrawls, switchboard.dbImportManager);+ final Importer importerThread = new NoticeURLImporter(switchboard.plasmaPath, switchboard.crawlQueues, switchboard.crawler.profilesActiveCrawls, switchboard.dbImportManager);if (importerThread != null) {importerThread.setJobID(switchboard.dbImportManager.generateUniqueJobID());@@ -106,8 +106,8 @@ public final class IndexImport_p {}}- prop.putNum("wcount", switchboard.webIndex.index().size());- prop.putNum("ucount", switchboard.webIndex.metadata().size());+ prop.putNum("wcount", switchboard.indexSegment.index().size());+ prop.putNum("ucount", switchboard.indexSegment.metadata().size());/** Loop over all currently running jobsdiff --git a/htroot/IndexShare_p.java b/htroot/IndexShare_p.javaindex eede204b5..f80099ea1 100644--- a/htroot/IndexShare_p.java+++ b/htroot/IndexShare_p.java@@ -55,8 +55,8 @@ public class IndexShare_p {prop.put("wordfreq", switchboard.getConfigLong("defaultWordReceiveFrequency",10));prop.put("dtable", "");prop.put("rtable", "");- prop.putNum("wcount", switchboard.webIndex.index().size());- prop.putNum("ucount", switchboard.webIndex.metadata().size());+ prop.putNum("wcount", switchboard.indexSegment.index().size());+ prop.putNum("ucount", switchboard.indexSegment.metadata().size());return prop; // be save}@@ -68,8 +68,8 @@ public class IndexShare_p {}// insert constants- prop.putNum("wcount", switchboard.webIndex.index().size());- prop.putNum("ucount", switchboard.webIndex.metadata().size());+ prop.putNum("wcount", switchboard.indexSegment.index().size());+ prop.putNum("ucount", switchboard.indexSegment.metadata().size());// return rewrite propertiesreturn prop;diff --git a/htroot/MessageSend_p.java b/htroot/MessageSend_p.javaindex 883b53741..5bb5008d6 100644--- a/htroot/MessageSend_p.java+++ b/htroot/MessageSend_p.java@@ -67,14 +67,14 @@ public class MessageSend_p {// open an editor page for the message// first ask if the other peer is online, and also what kind of document it accepts- final HashMap<String, String> result = yacyClient.permissionMessage(sb.webIndex.peers(), hash);+ final HashMap<String, String> result = yacyClient.permissionMessage(sb.peers, hash);//System.out.println("DEBUG: permission request result = " + result.toString());String peerName;yacySeed targetPeer = null;- if (hash.equals(sb.webIndex.peers().mySeed().hash)) {- peerName = sb.webIndex.peers().mySeed().get(yacySeed.NAME,"nameless");+ if (hash.equals(sb.peers.mySeed().hash)) {+ peerName = sb.peers.mySeed().get(yacySeed.NAME,"nameless");} else {- targetPeer = sb.webIndex.peers().getConnected(hash);+ targetPeer = sb.peers.getConnected(hash);if (targetPeer == null)peerName = "nameless";else@@ -88,7 +88,7 @@ public class MessageSend_p {prop.put("mode_permission", "0");if (targetPeer != null) {- sb.webIndex.peers().peerActions.peerDeparture(targetPeer, "peer responded upon message send request: " + response);+ sb.peers.peerActions.peerDeparture(targetPeer, "peer responded upon message send request: " + response);}} else {prop.put("mode_permission", "1");@@ -131,7 +131,7 @@ public class MessageSend_p {} catch (final UnsupportedEncodingException e) {mb = message.getBytes();}- final HashMap<String, String> result = yacyClient.postMessage(sb.webIndex.peers(), hash, subject, mb);+ final HashMap<String, String> result = yacyClient.postMessage(sb.peers, hash, subject, mb);//message has been sentprop.put("mode_status_response", result.get("response"));diff --git a/htroot/Messages_p.java b/htroot/Messages_p.javaindex dbc3974c5..e262bc2e3 100644--- a/htroot/Messages_p.java+++ b/htroot/Messages_p.java@@ -55,18 +55,18 @@ public class Messages_p {final serverObjects prop = new serverObjects();// set peer address / name- final String peerAddress = sb.webIndex.peers().mySeed().getPublicAddress();- final String peerName = sb.webIndex.peers().mySeed().getName();+ final String peerAddress = sb.peers.mySeed().getPublicAddress();+ final String peerName = sb.peers.mySeed().getName();prop.put("peerAddress", peerAddress);prop.putXML("peerName", peerName);// List known hosts for message sending (from Blacklist_p.java)- if (sb.webIndex.peers() != null && sb.webIndex.peers().sizeConnected() > 0) {+ if (sb.peers != null && sb.peers.sizeConnected() > 0) {prop.put("peersKnown", "1");int peerCount = 0;try {final TreeMap<String, String> hostList = new TreeMap<String, String>();- final Iterator<yacySeed> e = sb.webIndex.peers().seedsConnected(true, false, null, (float) 0.0);+ final Iterator<yacySeed> e = sb.peers.seedsConnected(true, false, null, (float) 0.0);while (e.hasNext()) {final yacySeed seed = e.next();if (seed != null) hostList.put(seed.get(yacySeed.NAME, "nameless"),seed.hash);diff --git a/htroot/Network.java b/htroot/Network.javaindex d8dde98d7..ca2816114 100644--- a/htroot/Network.java+++ b/htroot/Network.java@@ -66,30 +66,30 @@ public class Network {prop.putHTML("page_networkName", sb.getConfig(plasmaSwitchboardConstants.NETWORK_NAME, "unspecified"));final boolean overview = (post == null) || (post.get("page", "0").equals("0"));- final String mySeedType = sb.webIndex.peers().mySeed().get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_VIRGIN);+ final String mySeedType = sb.peers.mySeed().get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_VIRGIN);final boolean iAmActive = (mySeedType.equals(yacySeed.PEERTYPE_SENIOR) || mySeedType.equals(yacySeed.PEERTYPE_PRINCIPAL));if (overview) {- long accActLinks = sb.webIndex.peers().countActiveURL();- long accActWords = sb.webIndex.peers().countActiveRWI();- final long accPassLinks = sb.webIndex.peers().countPassiveURL();- final long accPassWords = sb.webIndex.peers().countPassiveRWI();- long accPotLinks = sb.webIndex.peers().countPotentialURL();- long accPotWords = sb.webIndex.peers().countPotentialRWI();+ long accActLinks = sb.peers.countActiveURL();+ long accActWords = sb.peers.countActiveRWI();+ final long accPassLinks = sb.peers.countPassiveURL();+ final long accPassWords = sb.peers.countPassiveRWI();+ long accPotLinks = sb.peers.countPotentialURL();+ long accPotWords = sb.peers.countPotentialRWI();- int conCount = sb.webIndex.peers().sizeConnected();- final int disconCount = sb.webIndex.peers().sizeDisconnected();- int potCount = sb.webIndex.peers().sizePotential();+ int conCount = sb.peers.sizeConnected();+ final int disconCount = sb.peers.sizeDisconnected();+ int potCount = sb.peers.sizePotential();// final boolean complete = ((post == null) ? false : post.get("links", "false").equals("true"));- final long otherppm = sb.webIndex.peers().countActivePPM();- final double otherqpm = sb.webIndex.peers().countActiveQPM();+ final long otherppm = sb.peers.countActivePPM();+ final double otherqpm = sb.peers.countActiveQPM();long myppm = 0;double myqph = 0d;// create own peer info- final yacySeed seed = sb.webIndex.peers().mySeed();- if (sb.webIndex.peers().mySeed() != null){ //our Peer+ final yacySeed seed = sb.peers.mySeed();+ if (sb.peers.mySeed() != null){ //our Peer// update seed infosb.updateMySeed();@@ -105,17 +105,17 @@ public class Network {// my-infoprop.putHTML("table_my-name", seed.get(yacySeed.NAME, "-") );prop.put("table_my-hash", seed.hash );- if (sb.webIndex.peers().mySeed().isVirgin()) {+ if (sb.peers.mySeed().isVirgin()) {prop.put("table_my-info", 0);- } else if(sb.webIndex.peers().mySeed().isJunior()) {+ } else if(sb.peers.mySeed().isJunior()) {prop.put("table_my-info", 1);accPotLinks += LCount;accPotWords += ICount;- } else if(sb.webIndex.peers().mySeed().isSenior()) {+ } else if(sb.peers.mySeed().isSenior()) {prop.put("table_my-info", 2);accActLinks += LCount;accActWords += ICount;- } else if(sb.webIndex.peers().mySeed().isPrincipal()) {+ } else if(sb.peers.mySeed().isPrincipal()) {prop.put("table_my-info", 3);accActLinks += LCount;accActWords += ICount;@@ -186,13 +186,13 @@ public class Network {yacySeed peer = new yacySeed(post.get("peerHash"),map);sb.updateMySeed();- final int added = yacyClient.publishMySeed(sb.webIndex.peers().mySeed(), sb.webIndex.peers().peerActions, peer.getPublicAddress(), peer.hash);+ final int added = yacyClient.publishMySeed(sb.peers.mySeed(), sb.peers.peerActions, peer.getPublicAddress(), peer.hash);if (added <= 0) {prop.put("table_comment",1);prop.putHTML("table_comment_status","publish: disconnected peer '" + peer.getName() + "/" + post.get("peerHash") + "' from " + peer.getPublicAddress());} else {- peer = sb.webIndex.peers().getConnected(peer.hash);+ peer = sb.peers.getConnected(peer.hash);if (peer == null) {prop.put("table_comment",1);prop.putHTML("table_comment_status","publish: disconnected peer 'UNKNOWN/" + post.get("peerHash") + "' from UNKNOWN");@@ -218,14 +218,14 @@ public class Network {final int page = (post == null ? 1 : Integer.parseInt(post.get("page", "1")));final int maxCount = (post == null ? 300 : Integer.parseInt(post.get("maxCount", "300")));int conCount = 0;- if (sb.webIndex.peers() == null) {+ if (sb.peers == null) {prop.put("table", 0);//no remote senior/principal proxies known"} else {int size = 0;switch (page) {- case 1 : size = sb.webIndex.peers().sizeConnected(); break;- case 2 : size = sb.webIndex.peers().sizeDisconnected(); break;- case 3 : size = sb.webIndex.peers().sizePotential(); break;+ case 1 : size = sb.peers.sizeConnected(); break;+ case 2 : size = sb.peers.sizeDisconnected(); break;+ case 3 : size = sb.peers.sizePotential(); break;default: break;}if (size == 0) {@@ -234,7 +234,7 @@ public class Network {// add temporary the own seed to the databaseif (iAmActive) {sb.updateMySeed();- sb.webIndex.peers().addConnected(sb.webIndex.peers().mySeed());+ sb.peers.addConnected(sb.peers.mySeed());}// find updated Information using YaCyNews@@ -243,7 +243,7 @@ public class Network {final HashMap<String, Map<String, String>> updatedBlog = new HashMap<String, Map<String, String>>();final HashMap<String, String> isCrawling = new HashMap<String, String>();yacyNewsRecord record;- final Iterator<yacyNewsRecord> recordIterator = sb.webIndex.peers().newsPool.recordIterator(yacyNewsPool.INCOMING_DB, true);+ final Iterator<yacyNewsRecord> recordIterator = sb.peers.newsPool.recordIterator(yacyNewsPool.INCOMING_DB, true);while (recordIterator.hasNext()) {record = recordIterator.next();if (record == null) {@@ -266,9 +266,9 @@ public class Network {final boolean order = (post != null && post.get("order", "down").equals("up"));final String sort = (post == null ? null : post.get("sort", null));switch (page) {- case 1 : e = sb.webIndex.peers().seedsSortedConnected(order, (sort == null ? yacySeed.LCOUNT : sort)); break;- case 2 : e = sb.webIndex.peers().seedsSortedDisconnected(order, (sort == null ? yacySeed.LASTSEEN : sort)); break;- case 3 : e = sb.webIndex.peers().seedsSortedPotential(order, (sort == null ? yacySeed.LASTSEEN : sort)); break;+ case 1 : e = sb.peers.seedsSortedConnected(order, (sort == null ? yacySeed.LCOUNT : sort)); break;+ case 2 : e = sb.peers.seedsSortedDisconnected(order, (sort == null ? yacySeed.LASTSEEN : sort)); break;+ case 3 : e = sb.peers.seedsSortedPotential(order, (sort == null ? yacySeed.LASTSEEN : sort)); break;default: break;}String startURL;@@ -309,7 +309,7 @@ public class Network {prop.put(STR_TABLE_LIST + conCount + "_updatedBlog", 0);prop.put(STR_TABLE_LIST + conCount + "_isCrawling", 0);if (conCount >= maxCount) { break; }- if (sb.webIndex.peers() != null && sb.webIndex.peers().mySeed() != null && seed.hash != null && seed.hash.equals(sb.webIndex.peers().mySeed().hash)) {+ if (sb.peers != null && sb.peers.mySeed() != null && seed.hash != null && seed.hash.equals(sb.peers.mySeed().hash)) {prop.put(STR_TABLE_LIST + conCount + "_dark", 2);} else {prop.put(STR_TABLE_LIST + conCount + "_dark", ((dark) ? 1 : 0) ); dark=!dark;@@ -347,11 +347,11 @@ public class Network {prop.putHTML(STR_TABLE_LIST + conCount + "_shortname", shortname);prop.putHTML(STR_TABLE_LIST + conCount + "_fullname", seed.get(yacySeed.NAME, "deadlink"));userAgent = null;- if (seed.hash != null && seed.hash.equals(sb.webIndex.peers().mySeed().hash)) {+ if (seed.hash != null && seed.hash.equals(sb.peers.mySeed().hash)) {userAgent = HTTPLoader.yacyUserAgent;location = httpClient.generateLocation();} else {- userAgent = sb.webIndex.peers().peerActions.getUserAgent(seed.getIP());+ userAgent = sb.peers.peerActions.getUserAgent(seed.getIP());location = parseLocationInUserAgent(userAgent);}prop.put(STR_TABLE_LIST + conCount + "_location", location);@@ -439,7 +439,7 @@ public class Network {} // seed != null} // while}- if (iAmActive) { sb.webIndex.peers().removeMySeed(); }+ if (iAmActive) { sb.peers.removeMySeed(); }prop.putNum("table_list", conCount);prop.put("table", 1);prop.putNum("table_num", conCount);diff --git a/htroot/NetworkPicture.java b/htroot/NetworkPicture.javaindex 4fd73f2d1..819ec9967 100644--- a/htroot/NetworkPicture.java+++ b/htroot/NetworkPicture.java@@ -64,7 +64,7 @@ public class NetworkPicture {if (passiveLimit > 1000000) passiveLimit = 1000000;if (potentialLimit > 1000000) potentialLimit = 1000000;if (maxCount > 1000) maxCount = 1000;- return plasmaGrafics.getNetworkPicture(sb.webIndex.peers(), 10000, width, height, passiveLimit, potentialLimit, maxCount, corona, env.getConfig(plasmaSwitchboardConstants.NETWORK_NAME, "unspecified"), env.getConfig("network.unit.description", "unspecified"), bgcolor);+ return plasmaGrafics.getNetworkPicture(sb.peers, 10000, width, height, passiveLimit, potentialLimit, maxCount, corona, env.getConfig(plasmaSwitchboardConstants.NETWORK_NAME, "unspecified"), env.getConfig("network.unit.description", "unspecified"), bgcolor);}}diff --git a/htroot/News.java b/htroot/News.javaindex 6d65f3e8f..444a192b4 100644--- a/htroot/News.java+++ b/htroot/News.java@@ -62,7 +62,7 @@ public class News {if ((check.startsWith("del_")) && (post.get(check, "off").equals("on"))) {id = check.substring(4);try {- sb.webIndex.peers().newsPool.moveOff(tableID, id);+ sb.peers.newsPool.moveOff(tableID, id);} catch (final IOException ee) {ee.printStackTrace();}}}@@ -75,9 +75,9 @@ public class News {}try {if ((tableID == yacyNewsPool.PROCESSED_DB) || (tableID == yacyNewsPool.PUBLISHED_DB)) {- sb.webIndex.peers().newsPool.clear(tableID);+ sb.peers.newsPool.clear(tableID);} else {- sb.webIndex.peers().newsPool.moveOffAll(tableID);+ sb.peers.newsPool.moveOffAll(tableID);}} catch (final IOException e) {e.printStackTrace();@@ -90,19 +90,19 @@ public class News {// show overviewprop.put("table", "0");prop.put("page", "0");- prop.putNum("table_insize", sb.webIndex.peers().newsPool.size(yacyNewsPool.INCOMING_DB));- prop.putNum("table_prsize", sb.webIndex.peers().newsPool.size(yacyNewsPool.PROCESSED_DB));- prop.putNum("table_ousize", sb.webIndex.peers().newsPool.size(yacyNewsPool.OUTGOING_DB));- prop.putNum("table_pusize", sb.webIndex.peers().newsPool.size(yacyNewsPool.PUBLISHED_DB));+ prop.putNum("table_insize", sb.peers.newsPool.size(yacyNewsPool.INCOMING_DB));+ prop.putNum("table_prsize", sb.peers.newsPool.size(yacyNewsPool.PROCESSED_DB));+ prop.putNum("table_ousize", sb.peers.newsPool.size(yacyNewsPool.OUTGOING_DB));+ prop.putNum("table_pusize", sb.peers.newsPool.size(yacyNewsPool.PUBLISHED_DB));} else {// generate tableprop.put("table", "1");prop.put("page", tableID + 1);prop.put("table_page", tableID + 1);- if (sb.webIndex.peers() != null) {- final int maxCount = Math.min(1000, sb.webIndex.peers().newsPool.size(tableID));- final Iterator<yacyNewsRecord> recordIterator = sb.webIndex.peers().newsPool.recordIterator(tableID, false);+ if (sb.peers != null) {+ final int maxCount = Math.min(1000, sb.peers.newsPool.size(tableID));+ final Iterator<yacyNewsRecord> recordIterator = sb.peers.newsPool.recordIterator(tableID, false);yacyNewsRecord record;yacySeed seed;int i = 0;@@ -110,8 +110,8 @@ public class News {record = recordIterator.next();if (record == null) continue;- seed = sb.webIndex.peers().getConnected(record.originator());- if (seed == null) seed = sb.webIndex.peers().getDisconnected(record.originator());+ seed = sb.peers.getConnected(record.originator());+ if (seed == null) seed = sb.peers.getDisconnected(record.originator());final String category = record.category();prop.put("table_list_" + i + "_id", record.id());prop.putHTML("table_list_" + i + "_ori", (seed == null) ? record.originator() : seed.getName());@@ -179,7 +179,7 @@ public class News {}// adding the peer address- prop.put("address", sb.webIndex.peers().mySeed().getPublicAddress());+ prop.put("address", sb.peers.mySeed().getPublicAddress());// return rewrite propertiesreturn prop;diff --git a/htroot/PerformanceGraph.java b/htroot/PerformanceGraph.javaindex da0b4b393..b2eb052b1 100644--- a/htroot/PerformanceGraph.java+++ b/htroot/PerformanceGraph.java@@ -41,7 +41,7 @@ public class PerformanceGraph {final int width = post.getInt("width", 660);final int height = post.getInt("height", 240);- return plasmaProfiling.performanceGraph(width, height, sb.webIndex.metadata().size() + " URLS / " + sb.webIndex.index().getBackendSize() + " WORDS IN INDEX / " + sb.webIndex.index().getBufferSize() + " WORDS IN CACHE");+ return plasmaProfiling.performanceGraph(width, height, sb.indexSegment.metadata().size() + " URLS / " + sb.indexSegment.index().getBackendSize() + " WORDS IN INDEX / " + sb.indexSegment.index().getBufferSize() + " WORDS IN CACHE");}}\ No newline at end of filediff --git a/htroot/PerformanceQueues_p.java b/htroot/PerformanceQueues_p.javaindex 7601a5829..be8ec0192 100644--- a/htroot/PerformanceQueues_p.java+++ b/htroot/PerformanceQueues_p.java@@ -199,7 +199,7 @@ public class PerformanceQueues_p {// disallow setting of memprereq for indexer to prevent db from throwing OOMsprop.put("table_" + c + "_disabled", /*(threadName.endsWith("_indexing")) ? 1 :*/ "0");prop.put("table_" + c + "_recommendation", threadName.endsWith("_indexing") ? "1" : "0");- prop.putNum("table_" + c + "_recommendation_value", threadName.endsWith("_indexing") ? (switchboard.webIndex.index().minMem() / 1024) : 0);+ prop.putNum("table_" + c + "_recommendation_value", threadName.endsWith("_indexing") ? (switchboard.indexSegment.index().minMem() / 1024) : 0);c++;}prop.put("table", c);@@ -229,7 +229,7 @@ public class PerformanceQueues_p {if ((post != null) && (post.containsKey("cacheSizeSubmit"))) {final int wordCacheMaxCount = post.getInt("wordCacheMaxCount", 20000);switchboard.setConfig(plasmaSwitchboardConstants.WORDCACHE_MAX_COUNT, Integer.toString(wordCacheMaxCount));- switchboard.webIndex.index().setBufferMaxWordCount(wordCacheMaxCount);+ switchboard.indexSegment.index().setBufferMaxWordCount(wordCacheMaxCount);}if ((post != null) && (post.containsKey("poolConfig"))) {@@ -284,12 +284,12 @@ public class PerformanceQueues_p {prop.put("minimumGlobalDelta", switchboard.crawlQueues.noticeURL.getMinimumGlobalDelta());// table cache settings- prop.putNum("urlCacheSize", switchboard.webIndex.metadata().writeCacheSize());- prop.putNum("wordCacheSize", switchboard.webIndex.index().getBufferSize());- prop.putNum("wordCacheSizeKBytes", switchboard.webIndex.index().getBufferSizeBytes()/1024);- prop.putNum("maxURLinCache", switchboard.webIndex.index().getBufferMaxReferences());- prop.putNum("maxAgeOfCache", switchboard.webIndex.index().getBufferMaxAge() / 1000 / 60); // minutes- prop.putNum("minAgeOfCache", switchboard.webIndex.index().getBufferMinAge() / 1000 / 60); // minutes+ prop.putNum("urlCacheSize", switchboard.indexSegment.metadata().writeCacheSize());+ prop.putNum("wordCacheSize", switchboard.indexSegment.index().getBufferSize());+ prop.putNum("wordCacheSizeKBytes", switchboard.indexSegment.index().getBufferSizeBytes()/1024);+ prop.putNum("maxURLinCache", switchboard.indexSegment.index().getBufferMaxReferences());+ prop.putNum("maxAgeOfCache", switchboard.indexSegment.index().getBufferMaxAge() / 1000 / 60); // minutes+ prop.putNum("minAgeOfCache", switchboard.indexSegment.index().getBufferMinAge() / 1000 / 60); // minutesprop.putNum("maxWaitingWordFlush", switchboard.getConfigLong("maxWaitingWordFlush", 180));prop.put("wordCacheMaxCount", switchboard.getConfigLong(plasmaSwitchboardConstants.WORDCACHE_MAX_COUNT, 20000));prop.put("crawlPauseProxy", switchboard.getConfigLong(plasmaSwitchboardConstants.PROXY_ONLINE_CAUTION_DELAY, 30000));diff --git a/htroot/ProxyIndexingMonitor_p.java b/htroot/ProxyIndexingMonitor_p.javaindex f45af7607..e7f7917c4 100644--- a/htroot/ProxyIndexingMonitor_p.java+++ b/htroot/ProxyIndexingMonitor_p.java@@ -96,15 +96,15 @@ public class ProxyIndexingMonitor_p {plasmaHTCache.setCacheSize(Long.parseLong(newProxyCacheSize) * 1024 * 1024);// implant these settings also into the crawling profile for the proxy- if (sb.webIndex.defaultProxyProfile == null) {+ if (sb.crawler.defaultProxyProfile == null) {prop.put("info", "1"); //delete DATA/PLASMADB/crawlProfiles0.db} else {try {- sb.webIndex.profilesActiveCrawls.changeEntry(sb.webIndex.defaultProxyProfile, "generalDepth", Integer.toString(newProxyPrefetchDepth));- sb.webIndex.profilesActiveCrawls.changeEntry(sb.webIndex.defaultProxyProfile, "storeHTCache", (proxyStoreHTCache) ? "true": "false");- sb.webIndex.profilesActiveCrawls.changeEntry(sb.webIndex.defaultProxyProfile, "remoteIndexing",proxyIndexingRemote ? "true":"false");- sb.webIndex.profilesActiveCrawls.changeEntry(sb.webIndex.defaultProxyProfile, "indexText",proxyIndexingLocalText ? "true":"false");- sb.webIndex.profilesActiveCrawls.changeEntry(sb.webIndex.defaultProxyProfile, "indexMedia",proxyIndexingLocalMedia ? "true":"false");+ sb.crawler.profilesActiveCrawls.changeEntry(sb.crawler.defaultProxyProfile, "generalDepth", Integer.toString(newProxyPrefetchDepth));+ sb.crawler.profilesActiveCrawls.changeEntry(sb.crawler.defaultProxyProfile, "storeHTCache", (proxyStoreHTCache) ? "true": "false");+ sb.crawler.profilesActiveCrawls.changeEntry(sb.crawler.defaultProxyProfile, "remoteIndexing",proxyIndexingRemote ? "true":"false");+ sb.crawler.profilesActiveCrawls.changeEntry(sb.crawler.defaultProxyProfile, "indexText",proxyIndexingLocalText ? "true":"false");+ sb.crawler.profilesActiveCrawls.changeEntry(sb.crawler.defaultProxyProfile, "indexMedia",proxyIndexingLocalMedia ? "true":"false");prop.put("info", "2");//new proxyPrefetchdepthprop.put("info_message", newProxyPrefetchDepth);diff --git a/htroot/QuickCrawlLink_p.java b/htroot/QuickCrawlLink_p.javaindex 74607c5bb..b602edcec 100644--- a/htroot/QuickCrawlLink_p.java+++ b/htroot/QuickCrawlLink_p.java@@ -122,14 +122,14 @@ public class QuickCrawlLink_p {}final String urlhash = crawlingStartURL.hash();- sb.webIndex.metadata().remove(urlhash);+ sb.indexSegment.metadata().remove(urlhash);sb.crawlQueues.noticeURL.removeByURLHash(urlhash);sb.crawlQueues.errorURL.remove(urlhash);// create crawling profileCrawlProfile.entry pe = null;try {- pe = sb.webIndex.profilesActiveCrawls.newEntry(+ pe = sb.crawler.profilesActiveCrawls.newEntry(crawlingStartURL.getHost(),crawlingStartURL,CrawlProfile.KEYWORDS_USER,@@ -160,7 +160,7 @@ public class QuickCrawlLink_p {// stack URLString reasonString = null;reasonString = sb.crawlStacker.stackCrawl(new CrawlEntry(- sb.webIndex.peers().mySeed().hash,+ sb.peers.mySeed().hash,crawlingStartURL,null,(title==null)?"CRAWLING-ROOT":title,diff --git a/htroot/SearchEventPicture.java b/htroot/SearchEventPicture.javaindex a0a3bed8c..238137d44 100644--- a/htroot/SearchEventPicture.java+++ b/htroot/SearchEventPicture.java@@ -41,7 +41,7 @@ public class SearchEventPicture {final plasmaSwitchboard sb = (plasmaSwitchboard) env;final String eventID = (String) header.get("event", plasmaSearchEvent.lastEventID);if (eventID == null) return null;- final ymageMatrix yp = plasmaGrafics.getSearchEventPicture(sb.webIndex.peers(), eventID);+ final ymageMatrix yp = plasmaGrafics.getSearchEventPicture(sb.peers, eventID);if (yp == null) return new ymageMatrix(1, 1, ymageMatrix.MODE_SUB, "000000"); // empty imagereturn yp;diff --git a/htroot/SettingsAck_p.java b/htroot/SettingsAck_p.javaindex 9353e988a..d0996bc6a 100644--- a/htroot/SettingsAck_p.java+++ b/htroot/SettingsAck_p.java@@ -234,7 +234,7 @@ public class SettingsAck_p {} else {serverCore.useStaticIP = true;}- if (yacySeed.isProperIP(staticIP) == null) sb.webIndex.peers().mySeed().setIP(staticIP);+ if (yacySeed.isProperIP(staticIP) == null) sb.peers.mySeed().setIP(staticIP);env.setConfig("staticIP", staticIP);// server access data@@ -352,7 +352,7 @@ public class SettingsAck_p {// getting the currently used uploading methodfinal String oldSeedUploadMethod = env.getConfig("seedUploadMethod","none");final String newSeedUploadMethod = post.get("seedUploadMethod");- final String oldSeedURLStr = sb.webIndex.peers().mySeed().get(yacySeed.SEEDLIST, "");+ final String oldSeedURLStr = sb.peers.mySeed().get(yacySeed.SEEDLIST, "");final String newSeedURLStr = post.get("seedURL");final boolean seedUrlChanged = !oldSeedURLStr.equals(newSeedURLStr);@@ -363,7 +363,7 @@ public class SettingsAck_p {if (seedUrlChanged || uploadMethodChanged) {env.setConfig("seedUploadMethod", newSeedUploadMethod);- sb.webIndex.peers().mySeed().put(yacySeed.SEEDLIST, newSeedURLStr);+ sb.peers.mySeed().put(yacySeed.SEEDLIST, newSeedURLStr);// try an uploadString error;diff --git a/htroot/Settings_p.java b/htroot/Settings_p.javaindex d20d626b5..4593a71f2 100644--- a/htroot/Settings_p.java+++ b/htroot/Settings_p.java@@ -205,7 +205,7 @@ public final class Settings_p {}// general settings- prop.put("seedURL", sb.webIndex.peers().mySeed().get(yacySeed.SEEDLIST, ""));+ prop.put("seedURL", sb.peers.mySeed().get(yacySeed.SEEDLIST, ""));/** Message forwarding configurationdiff --git a/htroot/Status.java b/htroot/Status.javaindex a0d98ca7d..269ddbcd3 100644--- a/htroot/Status.java+++ b/htroot/Status.java@@ -180,31 +180,31 @@ public class Status {// peer informationString thisHash = "";final String thisName = sb.getConfig("peerName", "<nameless>");- if (sb.webIndex.peers().mySeed() == null) {+ if (sb.peers.mySeed() == null) {thisHash = "not assigned";prop.put("peerAddress", "0"); // not assignedprop.put("peerStatistics", "0"); // unknown} else {- final long uptime = 60000 * Long.parseLong(sb.webIndex.peers().mySeed().get(yacySeed.UPTIME, "0"));+ final long uptime = 60000 * Long.parseLong(sb.peers.mySeed().get(yacySeed.UPTIME, "0"));prop.put("peerStatistics", "1");prop.put("peerStatistics_uptime", DateFormatter.formatInterval(uptime));- prop.putNum("peerStatistics_pagesperminute", sb.webIndex.peers().mySeed().getPPM());- prop.putNum("peerStatistics_queriesperhour", Math.round(6000d * sb.webIndex.peers().mySeed().getQPM()) / 100d);- prop.putNum("peerStatistics_links", sb.webIndex.peers().mySeed().getLinkCount());- prop.put("peerStatistics_words", Formatter.number(sb.webIndex.peers().mySeed().get(yacySeed.ICOUNT, "0")));- prop.putNum("peerStatistics_disconnects", sb.webIndex.peers().peerActions.disconnects);- prop.put("peerStatistics_connects", Formatter.number(sb.webIndex.peers().mySeed().get(yacySeed.CCOUNT, "0")));- thisHash = sb.webIndex.peers().mySeed().hash;- if (sb.webIndex.peers().mySeed().getPublicAddress() == null) {+ prop.putNum("peerStatistics_pagesperminute", sb.peers.mySeed().getPPM());+ prop.putNum("peerStatistics_queriesperhour", Math.round(6000d * sb.peers.mySeed().getQPM()) / 100d);+ prop.putNum("peerStatistics_links", sb.peers.mySeed().getLinkCount());+ prop.put("peerStatistics_words", Formatter.number(sb.peers.mySeed().get(yacySeed.ICOUNT, "0")));+ prop.putNum("peerStatistics_disconnects", sb.peers.peerActions.disconnects);+ prop.put("peerStatistics_connects", Formatter.number(sb.peers.mySeed().get(yacySeed.CCOUNT, "0")));+ thisHash = sb.peers.mySeed().hash;+ if (sb.peers.mySeed().getPublicAddress() == null) {prop.put("peerAddress", "0"); // not assigned + instructionsprop.put("warningGoOnline", "1");} else {prop.put("peerAddress", "1"); // Address- prop.put("peerAddress_address", sb.webIndex.peers().mySeed().getPublicAddress());+ prop.put("peerAddress_address", sb.peers.mySeed().getPublicAddress());prop.putXML("peerAddress_peername", sb.getConfig("peerName", "<nameless>").toLowerCase());}}- final String peerStatus = ((sb.webIndex.peers().mySeed() == null) ? yacySeed.PEERTYPE_VIRGIN : sb.webIndex.peers().mySeed().get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_VIRGIN));+ final String peerStatus = ((sb.peers.mySeed() == null) ? yacySeed.PEERTYPE_VIRGIN : sb.peers.mySeed().get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_VIRGIN));if (peerStatus.equals(yacySeed.PEERTYPE_VIRGIN) && sb.getConfig(plasmaSwitchboardConstants.NETWORK_NAME, "").equals("freeworld")) {prop.put(PEERSTATUS, "0");prop.put("urgentStatusVirgin", "1");@@ -217,7 +217,7 @@ public class Status {} else if (peerStatus.equals(yacySeed.PEERTYPE_PRINCIPAL)) {prop.put(PEERSTATUS, "3");prop.put("hintStatusPrincipal", "1");- prop.put("hintStatusPrincipal_seedURL", sb.webIndex.peers().mySeed().get(yacySeed.SEEDLIST, "?"));+ prop.put("hintStatusPrincipal_seedURL", sb.peers.mySeed().get(yacySeed.SEEDLIST, "?"));}prop.putHTML("peerName", thisName);prop.put("hash", thisHash);@@ -246,14 +246,14 @@ public class Status {prop.putHTML("seedServer_seedFile", sb.getConfig("seedFilePath", ""));}prop.put("seedServer_lastUpload",- DateFormatter.formatInterval(System.currentTimeMillis() - sb.webIndex.peers().lastSeedUpload_timeStamp));+ DateFormatter.formatInterval(System.currentTimeMillis() - sb.peers.lastSeedUpload_timeStamp));} else {prop.put(SEEDSERVER, "0"); // disabled}- if (sb.webIndex.peers() != null && sb.webIndex.peers().sizeConnected() > 0){+ if (sb.peers != null && sb.peers.sizeConnected() > 0){prop.put("otherPeers", "1");- prop.putNum("otherPeers_num", sb.webIndex.peers().sizeConnected());+ prop.putNum("otherPeers_num", sb.peers.sizeConnected());}else{prop.put("otherPeers", "0"); // not online}@@ -287,7 +287,7 @@ public class Status {prop.putNum("connectionsMax", httpd.getMaxSessionCount());// Queue information- final int indexingJobCount = sb.getThread("80_indexing").getJobCount() + sb.webIndex.queuePreStack.getActiveQueueSize();+ final int indexingJobCount = sb.getThread("80_indexing").getJobCount() + sb.crawler.queuePreStack.getActiveQueueSize();final int indexingMaxCount = (int) sb.getConfigLong(plasmaSwitchboardConstants.INDEXER_SLOTS, 30);final int indexingPercent = (indexingMaxCount==0)?0:indexingJobCount*100/indexingMaxCount;prop.putNum("indexingQueueSize", indexingJobCount);diff --git a/htroot/Supporter.java b/htroot/Supporter.javaindex 311b9c651..675b011b4 100644--- a/htroot/Supporter.java+++ b/htroot/Supporter.java@@ -78,7 +78,7 @@ public class Supporter {map.put("urlhash", hash);map.put("vote", "negative");map.put("refid", post.get("refid", ""));- sb.webIndex.peers().newsPool.publishMyNews(yacyNewsRecord.newRecord(sb.webIndex.peers().mySeed(), yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, map));+ sb.peers.newsPool.publishMyNews(yacyNewsRecord.newRecord(sb.peers.mySeed(), yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, map));}if ((post != null) && ((hash = post.get("votePositive", null)) != null)) {if (!sb.verifyAuthentication(header, false)) {@@ -94,7 +94,7 @@ public class Supporter {map.put("vote", "positive");map.put("refid", post.get("refid", ""));map.put("comment", post.get("comment", ""));- sb.webIndex.peers().newsPool.publishMyNews(new yacyNewsRecord(sb.webIndex.peers().mySeed(), yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, map));+ sb.peers.newsPool.publishMyNews(new yacyNewsRecord(sb.peers.mySeed(), yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, map));}// create Supporter@@ -131,8 +131,8 @@ public class Supporter {description = row.getColString(2,"UTF-8");if ((url == null) || (title == null) || (description == null)) continue;refid = row.getColString(3, null);- voted = (sb.webIndex.peers().newsPool.getSpecific(yacyNewsPool.OUTGOING_DB, yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, "refid", refid) != null) ||- (sb.webIndex.peers().newsPool.getSpecific(yacyNewsPool.PUBLISHED_DB, yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, "refid", refid) != null);+ voted = (sb.peers.newsPool.getSpecific(yacyNewsPool.OUTGOING_DB, yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, "refid", refid) != null) ||+ (sb.peers.newsPool.getSpecific(yacyNewsPool.PUBLISHED_DB, yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, "refid", refid) != null);prop.put("supporter_results_" + i + "_authorized", authenticated ? "1" : "0");prop.put("supporter_results_" + i + "_authorized_recommend", voted ? "0" : "1");@@ -168,9 +168,9 @@ public class Supporter {}private static void accumulateVotes(final plasmaSwitchboard sb, final HashMap<String, Integer> negativeHashes, final HashMap<String, Integer> positiveHashes, final int dbtype) {- final int maxCount = Math.min(1000, sb.webIndex.peers().newsPool.size(dbtype));+ final int maxCount = Math.min(1000, sb.peers.newsPool.size(dbtype));yacyNewsRecord record;- final Iterator<yacyNewsRecord> recordIterator = sb.webIndex.peers().newsPool.recordIterator(dbtype, true);+ final Iterator<yacyNewsRecord> recordIterator = sb.peers.newsPool.recordIterator(dbtype, true);int j = 0;while ((recordIterator.hasNext()) && (j++ < maxCount)) {record = recordIterator.next();@@ -198,9 +198,9 @@ public class Supporter {final plasmaSwitchboard sb,final HashMap<String, Entry> Supporter, final ScoreCluster<String> ranking, final Row rowdef,final HashMap<String, Integer> negativeHashes, final HashMap<String, Integer> positiveHashes, final int dbtype) {- final int maxCount = Math.min(1000, sb.webIndex.peers().newsPool.size(dbtype));+ final int maxCount = Math.min(1000, sb.peers.newsPool.size(dbtype));yacyNewsRecord record;- final Iterator<yacyNewsRecord> recordIterator = sb.webIndex.peers().newsPool.recordIterator(dbtype, true);+ final Iterator<yacyNewsRecord> recordIterator = sb.peers.newsPool.recordIterator(dbtype, true);int j = 0;String url = "", urlhash;Row.Entry entry;@@ -213,7 +213,7 @@ public class Supporter {entry = null;if ((record.category().equals(yacyNewsPool.CATEGORY_PROFILE_UPDATE)) &&- ((seed = sb.webIndex.peers().getConnected(record.originator())) != null)) try {+ ((seed = sb.peers.getConnected(record.originator())) != null)) try {url = record.attribute("homepage", "");if (url.length() < 12) continue;entry = rowdef.newEntry(new byte[][]{@@ -226,7 +226,7 @@ public class Supporter {} catch (final IOException e) {}if ((record.category().equals(yacyNewsPool.CATEGORY_PROFILE_BROADCAST)) &&- ((seed = sb.webIndex.peers().getConnected(record.originator())) != null)) try {+ ((seed = sb.peers.getConnected(record.originator())) != null)) try {url = record.attribute("homepage", "");if (url.length() < 12) continue;entry = rowdef.newEntry(new byte[][]{diff --git a/htroot/Surftips.java b/htroot/Surftips.javaindex 53a9fd834..d28270172 100644--- a/htroot/Surftips.java+++ b/htroot/Surftips.java@@ -86,7 +86,7 @@ public class Surftips {map.put("urlhash", hash);map.put("vote", "negative");map.put("refid", post.get("refid", ""));- sb.webIndex.peers().newsPool.publishMyNews(yacyNewsRecord.newRecord(sb.webIndex.peers().mySeed(), yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, map));+ sb.peers.newsPool.publishMyNews(yacyNewsRecord.newRecord(sb.peers.mySeed(), yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, map));}if ((post != null) && ((hash = post.get("votePositive", null)) != null)) {if (!sb.verifyAuthentication(header, false)) {@@ -102,7 +102,7 @@ public class Surftips {map.put("vote", "positive");map.put("refid", post.get("refid", ""));map.put("comment", post.get("comment", ""));- sb.webIndex.peers().newsPool.publishMyNews(new yacyNewsRecord(sb.webIndex.peers().mySeed(), yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, map));+ sb.peers.newsPool.publishMyNews(new yacyNewsRecord(sb.peers.mySeed(), yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, map));}// create surftips@@ -140,8 +140,8 @@ public class Surftips {description = row.getColString(2,"UTF-8");if ((url == null) || (title == null) || (description == null)) continue;refid = row.getColString(3, null);- voted = (sb.webIndex.peers().newsPool.getSpecific(yacyNewsPool.OUTGOING_DB, yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, "refid", refid) != null) ||- (sb.webIndex.peers().newsPool.getSpecific(yacyNewsPool.PUBLISHED_DB, yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, "refid", refid) != null);+ voted = (sb.peers.newsPool.getSpecific(yacyNewsPool.OUTGOING_DB, yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, "refid", refid) != null) ||+ (sb.peers.newsPool.getSpecific(yacyNewsPool.PUBLISHED_DB, yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, "refid", refid) != null);prop.put("surftips_results_" + i + "_authorized", (authenticated) ? "1" : "0");prop.put("surftips_results_" + i + "_authorized_recommend", (voted) ? "0" : "1");@@ -177,9 +177,9 @@ public class Surftips {}private static void accumulateVotes(final plasmaSwitchboard sb, final HashMap<String, Integer> negativeHashes, final HashMap<String, Integer> positiveHashes, final int dbtype) {- final int maxCount = Math.min(1000, sb.webIndex.peers().newsPool.size(dbtype));+ final int maxCount = Math.min(1000, sb.peers.newsPool.size(dbtype));yacyNewsRecord record;- final Iterator<yacyNewsRecord> recordIterator = sb.webIndex.peers().newsPool.recordIterator(dbtype, true);+ final Iterator<yacyNewsRecord> recordIterator = sb.peers.newsPool.recordIterator(dbtype, true);int j = 0;while ((recordIterator.hasNext()) && (j++ < maxCount)) {record = recordIterator.next();@@ -207,9 +207,9 @@ public class Surftips {final plasmaSwitchboard sb,final HashMap<String, Entry> surftips, final ScoreCluster<String> ranking, final Row rowdef,final HashMap<String, Integer> negativeHashes, final HashMap<String, Integer> positiveHashes, final int dbtype) {- final int maxCount = Math.min(1000, sb.webIndex.peers().newsPool.size(dbtype));+ final int maxCount = Math.min(1000, sb.peers.newsPool.size(dbtype));yacyNewsRecord record;- final Iterator<yacyNewsRecord> recordIterator = sb.webIndex.peers().newsPool.recordIterator(dbtype, true);+ final Iterator<yacyNewsRecord> recordIterator = sb.peers.newsPool.recordIterator(dbtype, true);int j = 0;String url = "", urlhash;Row.Entry entry;@@ -271,8 +271,8 @@ public class Surftips {} catch (final IOException e) {}if (record.category().equals(yacyNewsPool.CATEGORY_WIKI_UPDATE)) try {- yacySeed seed = sb.webIndex.peers().getConnected(record.originator());- if (seed == null) seed = sb.webIndex.peers().getDisconnected(record.originator());+ yacySeed seed = sb.peers.getConnected(record.originator());+ if (seed == null) seed = sb.peers.getDisconnected(record.originator());if (seed != null) {url = "http://" + seed.getPublicAddress() + "/Wiki.html?page=" + record.attribute("page", "");entry = rowdef.newEntry(new byte[][]{@@ -286,8 +286,8 @@ public class Surftips {} catch (final IOException e) {}if (record.category().equals(yacyNewsPool.CATEGORY_BLOG_ADD)) try {- yacySeed seed = sb.webIndex.peers().getConnected(record.originator());- if (seed == null) seed = sb.webIndex.peers().getDisconnected(record.originator());+ yacySeed seed = sb.peers.getConnected(record.originator());+ if (seed == null) seed = sb.peers.getDisconnected(record.originator());if (seed != null) {url = "http://" + seed.getPublicAddress() + "/Blog.html?page=" + record.attribute("page", "");entry = rowdef.newEntry(new byte[][]{diff --git a/htroot/ViewFile.java b/htroot/ViewFile.javaindex a2e4c8772..94e598133 100644--- a/htroot/ViewFile.java+++ b/htroot/ViewFile.java@@ -95,7 +95,7 @@ public class ViewFile {if (urlHash.length() > 0) {// getting the urlEntry that belongs to the url hashURLMetadataRow urlEntry = null;- urlEntry = sb.webIndex.metadata().load(urlHash, null, 0);+ urlEntry = sb.indexSegment.metadata().load(urlHash, null, 0);if (urlEntry == null) {prop.put("error", "2");prop.put("viewMode",VIEW_MODE_NO_TEXT);diff --git a/htroot/ViewProfile.java b/htroot/ViewProfile.javaindex 8b2256c98..a71a25393 100644--- a/htroot/ViewProfile.java+++ b/htroot/ViewProfile.java@@ -58,7 +58,7 @@ public class ViewProfile {prop.put("display", display);final String hash = (post == null) ? null : (String) post.get("hash");- if ((hash == null) || (sb.webIndex.peers() == null)) {+ if ((hash == null) || (sb.peers == null)) {// wrong accessprop.put("success", "0");return prop;@@ -81,19 +81,19 @@ public class ViewProfile {profile.putAll(p);prop.put("success", "3"); // everything okprop.put("localremotepeer", "0");- prop.putHTML("success_peername", sb.webIndex.peers().mySeed().getName());- prop.put("success_peerhash", sb.webIndex.peers().mySeed().hash);+ prop.putHTML("success_peername", sb.peers.mySeed().getName());+ prop.put("success_peerhash", sb.peers.mySeed().hash);} else {// read the profile from remote peer- yacySeed seed = sb.webIndex.peers().getConnected(hash);- if (seed == null) seed = sb.webIndex.peers().getDisconnected(hash);+ yacySeed seed = sb.peers.getConnected(hash);+ if (seed == null) seed = sb.peers.getDisconnected(hash);if (seed == null) {prop.put("success", "1"); // peer unknown} else {// process news if existenttry {- final yacyNewsRecord record = sb.webIndex.peers().newsPool.getByOriginator(yacyNewsPool.INCOMING_DB, yacyNewsPool.CATEGORY_PROFILE_UPDATE, seed.hash);- if (record != null) sb.webIndex.peers().newsPool.moveOff(yacyNewsPool.INCOMING_DB, record.id());+ final yacyNewsRecord record = sb.peers.newsPool.getByOriginator(yacyNewsPool.INCOMING_DB, yacyNewsPool.CATEGORY_PROFILE_UPDATE, seed.hash);+ if (record != null) sb.peers.newsPool.moveOff(yacyNewsPool.INCOMING_DB, record.id());} catch (final IOException e) {}// try to get the profile from remote peerdiff --git a/htroot/WatchCrawler_p.java b/htroot/WatchCrawler_p.javaindex 21fb9753f..e06f42330 100644--- a/htroot/WatchCrawler_p.java+++ b/htroot/WatchCrawler_p.java@@ -119,7 +119,7 @@ public class WatchCrawler_p {if (post.containsKey("crawlingstart")) {// init crawl- if (sb.webIndex.peers() == null) {+ if (sb.peers == null) {prop.put("info", "3");} else {// set new properties@@ -209,13 +209,13 @@ public class WatchCrawler_p {// first delete old entry, if existsfinal yacyURL url = new yacyURL(crawlingStart, null);final String urlhash = url.hash();- sb.webIndex.metadata().remove(urlhash);+ sb.indexSegment.metadata().remove(urlhash);sb.crawlQueues.noticeURL.removeByURLHash(urlhash);sb.crawlQueues.errorURL.remove(urlhash);// stack url- sb.webIndex.profilesPassiveCrawls.removeEntry(crawlingStartURL.hash()); // if there is an old entry, delete it- final CrawlProfile.entry pe = sb.webIndex.profilesActiveCrawls.newEntry(+ sb.crawler.profilesPassiveCrawls.removeEntry(crawlingStartURL.hash()); // if there is an old entry, delete it+ final CrawlProfile.entry pe = sb.crawler.profilesActiveCrawls.newEntry(crawlingStartURL.getHost(),crawlingStartURL,CrawlProfile.KEYWORDS_USER,@@ -227,7 +227,7 @@ public class WatchCrawler_p {indexText, indexMedia,storeHTCache, true, crawlOrder, xsstopw, xdstopw, xpstopw);final String reasonString = sb.crawlStacker.stackCrawl(new CrawlEntry(- sb.webIndex.peers().mySeed().hash,+ sb.peers.mySeed().hash,url,null,"CRAWLING-ROOT",@@ -272,7 +272,7 @@ public class WatchCrawler_p {m.remove("generalFilter");m.remove("specificFilter");m.put("intention", post.get("intention", "").replace(',', '/'));- sb.webIndex.peers().newsPool.publishMyNews(yacyNewsRecord.newRecord(sb.webIndex.peers().mySeed(), yacyNewsPool.CATEGORY_CRAWL_START, m));+ sb.peers.newsPool.publishMyNews(yacyNewsRecord.newRecord(sb.peers.mySeed(), yacyNewsPool.CATEGORY_CRAWL_START, m));}} else {prop.put("info", "5"); //Crawling failed@@ -281,7 +281,7 @@ public class WatchCrawler_p {final ZURL.Entry ee = sb.crawlQueues.errorURL.newEntry(new CrawlEntry(- sb.webIndex.peers().mySeed().hash,+ sb.peers.mySeed().hash,crawlingStartURL,"","",@@ -291,7 +291,7 @@ public class WatchCrawler_p {0,0,0),- sb.webIndex.peers().mySeed().hash,+ sb.peers.mySeed().hash,new Date(),1,reasonString);@@ -337,7 +337,7 @@ public class WatchCrawler_p {// creating a crawler profilefinal yacyURL crawlURL = new yacyURL("file://" + file.toString(), null);- final CrawlProfile.entry profile = sb.webIndex.profilesActiveCrawls.newEntry(+ final CrawlProfile.entry profile = sb.crawler.profilesActiveCrawls.newEntry(fileName, crawlURL, CrawlProfile.KEYWORDS_USER,newcrawlingMustMatch,CrawlProfile.MATCH_NEVER,@@ -366,7 +366,7 @@ public class WatchCrawler_p {// enqueuing the url for crawlingsb.crawlStacker.enqueueEntry(new CrawlEntry(- sb.webIndex.peers().mySeed().hash,+ sb.peers.mySeed().hash,nexturl,"",e.getValue(),@@ -401,7 +401,7 @@ public class WatchCrawler_p {final yacyURL sitemapURL = new yacyURL(sitemapURLStr, null);// create a new profile- final CrawlProfile.entry pe = sb.webIndex.profilesActiveCrawls.newEntry(+ final CrawlProfile.entry pe = sb.crawler.profilesActiveCrawls.newEntry(sitemapURLStr, sitemapURL, CrawlProfile.KEYWORDS_USER,newcrawlingMustMatch,CrawlProfile.MATCH_NEVER,diff --git a/htroot/WatchWebStructure_p.java b/htroot/WatchWebStructure_p.javaindex 1d16b7247..a3fbcb9d5 100644--- a/htroot/WatchWebStructure_p.java+++ b/htroot/WatchWebStructure_p.java@@ -4,7 +4,7 @@ import java.util.Iterator;import de.anomic.crawler.CrawlProfile.entry;import de.anomic.http.httpRequestHeader;import de.anomic.plasma.plasmaSwitchboard;-import de.anomic.plasma.plasmaWordIndex;+import de.anomic.crawler.CrawlSwitchboard;import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;@@ -32,17 +32,17 @@ public class WatchWebStructure_p {if (host.equals("auto")) {// try to find the host from the crawl profiles- final Iterator<entry> it = sb.webIndex.profilesActiveCrawls.profiles(true);+ final Iterator<entry> it = sb.crawler.profilesActiveCrawls.profiles(true);entry e;while (it.hasNext()) {e = it.next();- if (e.name().equals(plasmaWordIndex.CRAWL_PROFILE_PROXY) ||- e.name().equals(plasmaWordIndex.CRAWL_PROFILE_REMOTE) ||- e.name().equals(plasmaWordIndex.CRAWL_PROFILE_SNIPPET_LOCAL_TEXT) ||- e.name().equals(plasmaWordIndex.CRAWL_PROFILE_SNIPPET_GLOBAL_TEXT) ||- e.name().equals(plasmaWordIndex.CRAWL_PROFILE_SNIPPET_LOCAL_MEDIA) ||- e.name().equals(plasmaWordIndex.CRAWL_PROFILE_SNIPPET_GLOBAL_MEDIA) ||- e.name().equals(plasmaWordIndex.CRAWL_PROFILE_SURROGATE))+ if (e.name().equals(CrawlSwitchboard.CRAWL_PROFILE_PROXY) ||+ e.name().equals(CrawlSwitchboard.CRAWL_PROFILE_REMOTE) ||+ e.name().equals(CrawlSwitchboard.CRAWL_PROFILE_SNIPPET_LOCAL_TEXT) ||+ e.name().equals(CrawlSwitchboard.CRAWL_PROFILE_SNIPPET_GLOBAL_TEXT) ||+ e.name().equals(CrawlSwitchboard.CRAWL_PROFILE_SNIPPET_LOCAL_MEDIA) ||+ e.name().equals(CrawlSwitchboard.CRAWL_PROFILE_SNIPPET_GLOBAL_MEDIA) ||+ e.name().equals(CrawlSwitchboard.CRAWL_PROFILE_SURROGATE))continue;host = e.name();break; // take the first onediff --git a/htroot/Wiki.java b/htroot/Wiki.javaindex f8393c9e8..9a9138b9b 100644--- a/htroot/Wiki.java+++ b/htroot/Wiki.java@@ -73,8 +73,8 @@ public class Wiki {if (author.equals("anonymous")) {author = wikiBoard.guessAuthor(ip);if (author == null) {- if (sb.webIndex.peers().mySeed() == null) author = "anonymous";- else author = sb.webIndex.peers().mySeed().get("Name", "anonymous");+ if (sb.peers.mySeed() == null) author = "anonymous";+ else author = sb.peers.mySeed().get("Name", "anonymous");}}@@ -116,7 +116,7 @@ public class Wiki {map.put("page", pagename);map.put("author", author.replace(',', ' '));if (post.get("content", "").trim().length() > 0 && !page.page().equals(content))- sb.webIndex.peers().newsPool.publishMyNews(yacyNewsRecord.newRecord(sb.webIndex.peers().mySeed(), yacyNewsPool.CATEGORY_WIKI_UPDATE, map));+ sb.peers.newsPool.publishMyNews(yacyNewsRecord.newRecord(sb.peers.mySeed(), yacyNewsPool.CATEGORY_WIKI_UPDATE, map));page = newEntry;prop.putHTML("LOCATION", "/Wiki.html?page=" + pagename);}diff --git a/htroot/YaCySearchPluginFF.java b/htroot/YaCySearchPluginFF.javaindex 5a86018e6..1f4057320 100644--- a/htroot/YaCySearchPluginFF.java+++ b/htroot/YaCySearchPluginFF.java@@ -54,7 +54,7 @@ public class YaCySearchPluginFF {prop.put("host", host);prop.put("port", port);- prop.putHTML("name", sb.webIndex.peers().mySeed().getName());+ prop.putHTML("name", sb.peers.mySeed().getName());return prop;}diff --git a/htroot/api/bookmarks/get_bookmarks.java b/htroot/api/bookmarks/get_bookmarks.javaindex 9a9778a6a..6595c6aae 100644--- a/htroot/api/bookmarks/get_bookmarks.java+++ b/htroot/api/bookmarks/get_bookmarks.java@@ -50,8 +50,8 @@ public class get_bookmarks {prop.putHTML("display_user", username);// set peer address- prop.put("display_address", sb.webIndex.peers().mySeed().getPublicAddress());- prop.put("display_peer", sb.webIndex.peers().mySeed().getName());+ prop.put("display_address", sb.peers.mySeed().getPublicAddress());+ prop.put("display_peer", sb.peers.mySeed().getName());int rp = MAXRESULTS; // items per pageint page = 1; // pagediff --git a/htroot/api/bookmarks/get_folders.java b/htroot/api/bookmarks/get_folders.javaindex d57526c48..5b713d919 100644--- a/htroot/api/bookmarks/get_folders.java+++ b/htroot/api/bookmarks/get_folders.java@@ -31,8 +31,8 @@ public class get_folders {prop.putHTML("display_user", username);// set peer address- prop.put("display_address", sb.webIndex.peers().mySeed().getPublicAddress());- prop.put("display_peer", sb.webIndex.peers().mySeed().getName());+ prop.put("display_address", sb.peers.mySeed().getPublicAddress());+ prop.put("display_peer", sb.peers.mySeed().getName());String root = "/";String[] foldername = null;diff --git a/htroot/api/bookmarks/posts/add_p.java b/htroot/api/bookmarks/posts/add_p.javaindex 0f52dba30..e633c7269 100755--- a/htroot/api/bookmarks/posts/add_p.java+++ b/htroot/api/bookmarks/posts/add_p.java@@ -82,6 +82,6 @@ public class add_p {map.put("title", title.replace(',', ' '));map.put("description", description.replace(',', ' '));map.put("tags", tagsString.replace(',', ' '));- sb.webIndex.peers().newsPool.publishMyNews(yacyNewsRecord.newRecord(sb.webIndex.peers().mySeed(), yacyNewsPool.CATEGORY_BOOKMARK_ADD, map));+ sb.peers.newsPool.publishMyNews(yacyNewsRecord.newRecord(sb.peers.mySeed(), yacyNewsPool.CATEGORY_BOOKMARK_ADD, map));}}\ No newline at end of filediff --git a/htroot/api/queues_p.java b/htroot/api/queues_p.javaindex 573b25833..9a68459a7 100755--- a/htroot/api/queues_p.java+++ b/htroot/api/queues_p.java@@ -39,11 +39,11 @@ public class queues_p {yacySeed initiator;//indexing queue- prop.putNum("indexingSize", sb.getThread(plasmaSwitchboardConstants.INDEXER).getJobCount() + sb.webIndex.queuePreStack.getActiveQueueSize());+ prop.putNum("indexingSize", sb.getThread(plasmaSwitchboardConstants.INDEXER).getJobCount() + sb.crawler.queuePreStack.getActiveQueueSize());prop.putNum("indexingMax", (int) sb.getConfigLong(plasmaSwitchboardConstants.INDEXER_SLOTS, 30));- prop.putNum("urlpublictextSize", sb.webIndex.metadata().size());- prop.putNum("rwipublictextSize", sb.webIndex.index().size());- if ((sb.webIndex.queuePreStack.size() == 0) && (sb.webIndex.queuePreStack.getActiveQueueSize() == 0)) {+ prop.putNum("urlpublictextSize", sb.indexSegment.metadata().size());+ prop.putNum("rwipublictextSize", sb.indexSegment.index().size());+ if ((sb.crawler.queuePreStack.size() == 0) && (sb.crawler.queuePreStack.getActiveQueueSize() == 0)) {prop.put("list", "0"); //is empty} else {IndexingStack.QueueEntry pcentry;@@ -52,12 +52,12 @@ public class queues_p {// getting all entries that are currently in processfinal ArrayList<IndexingStack.QueueEntry> entryList = new ArrayList<IndexingStack.QueueEntry>();- entryList.addAll(sb.webIndex.queuePreStack.getActiveQueueEntries());+ entryList.addAll(sb.crawler.queuePreStack.getActiveQueueEntries());final int inProcessCount = entryList.size();// getting all enqueued entries- if ((sb.webIndex.queuePreStack.size() > 0)) {- final Iterator<IndexingStack.QueueEntry> i1 = sb.webIndex.queuePreStack.entryIterator(false);+ if ((sb.crawler.queuePreStack.size() > 0)) {+ final Iterator<IndexingStack.QueueEntry> i1 = sb.crawler.queuePreStack.entryIterator(false);while (i1.hasNext()) try {entryList.add(i1.next());} catch (kelondroException e) {@@ -75,7 +75,7 @@ public class queues_p {if ((pcentry != null) && (pcentry.url() != null)) {final long entrySize = pcentry.size();totalSize += entrySize;- initiator = sb.webIndex.peers().getConnected(pcentry.initiator());+ initiator = sb.peers.getConnected(pcentry.initiator());prop.put("list-indexing_"+i+"_profile", (pcentry.profile() != null) ? pcentry.profile().name() : "deleted");prop.putHTML("list-indexing_"+i+"_initiator", ((initiator == null) ? "proxy" : initiator.getName()));prop.put("list-indexing_"+i+"_depth", pcentry.depth());@@ -102,7 +102,7 @@ public class queues_p {for (int i = 0; i < w.length; i++) {if (w[i] == null) continue;prop.put("list-loader_"+count+"_profile", w[i].profileHandle());- initiator = sb.webIndex.peers().getConnected(w[i].initiator());+ initiator = sb.peers.getConnected(w[i].initiator());prop.putHTML("list-loader_"+count+"_initiator", ((initiator == null) ? "proxy" : initiator.getName()));prop.put("list-loader_"+count+"_depth", w[i].depth());prop.putXML("list-loader_"+count+"_url", w[i].url().toString());@@ -146,7 +146,7 @@ public class queues_p {for (int i = 0; i < crawlerList.size(); i++) {urle = crawlerList.get(i);if ((urle != null) && (urle.url() != null)) {- initiator = sb.webIndex.peers().getConnected(urle.initiator());+ initiator = sb.peers.getConnected(urle.initiator());prop.put(tableName + "_" + showNum + "_profile", urle.profileHandle());prop.put(tableName + "_" + showNum + "_initiator", ((initiator == null) ? "proxy" : initiator.getName()));prop.put(tableName + "_" + showNum + "_depth", urle.depth());diff --git a/htroot/api/status_p.java b/htroot/api/status_p.javaindex c1c6f7be7..5ee381341 100644--- a/htroot/api/status_p.java+++ b/htroot/api/status_p.java@@ -23,8 +23,8 @@ public class status_p {sb.updateMySeed();final int cacheMaxSize = (int) sb.getConfigLong(plasmaSwitchboardConstants.WORDCACHE_MAX_COUNT, 10000);prop.putNum("ppm", sb.currentPPM());- prop.putNum("qpm", sb.webIndex.peers().mySeed().getQPM());- prop.put("wordCacheSize", Integer.toString(sb.webIndex.index().getBufferSize()));+ prop.putNum("qpm", sb.peers.mySeed().getQPM());+ prop.put("wordCacheSize", Integer.toString(sb.indexSegment.index().getBufferSize()));prop.put("wordCacheMaxSize", Integer.toString(cacheMaxSize));//// memory usage and system attributesdiff --git a/htroot/api/timeline.java b/htroot/api/timeline.javaindex d5c6238a4..3f2a9d4e5 100644--- a/htroot/api/timeline.java+++ b/htroot/api/timeline.java@@ -31,11 +31,11 @@ import java.util.TreeSet;import de.anomic.http.httpRequestHeader;import de.anomic.kelondro.text.ReferenceContainer;+import de.anomic.kelondro.text.Segment;import de.anomic.kelondro.text.referencePrototype.WordReference;import de.anomic.kelondro.util.DateFormatter;import de.anomic.plasma.plasmaSearchQuery;import de.anomic.plasma.plasmaSwitchboard;-import de.anomic.plasma.plasmaWordIndex;import de.anomic.plasma.parser.Word;import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;@@ -80,10 +80,10 @@ public final class timeline {//yacyCore.log.logInfo("INIT TIMELINE SEARCH: " + plasmaSearchQuery.anonymizedQueryHashes(query[0]) + " - " + count + " links");// get the index container with the result vector- HashMap<byte[], ReferenceContainer<WordReference>>[] localSearchContainerMaps = sb.webIndex.index().searchTerm(q, Word.words2hashes(query[1]), null);+ HashMap<byte[], ReferenceContainer<WordReference>>[] localSearchContainerMaps = sb.indexSegment.index().searchTerm(q, Word.words2hashes(query[1]), null);final ReferenceContainer<WordReference> index =ReferenceContainer.joinExcludeContainers(- plasmaWordIndex.wordReferenceFactory,+ Segment.wordReferenceFactory,localSearchContainerMaps[0].values(),localSearchContainerMaps[1].values(),maxdist);diff --git a/htroot/api/util/ynetSearch.java b/htroot/api/util/ynetSearch.javaindex 87a111ebe..d5a0d94e1 100755--- a/htroot/api/util/ynetSearch.java+++ b/htroot/api/util/ynetSearch.java@@ -32,7 +32,7 @@ public class ynetSearch {String searchaddress = post.get("url");if (!searchaddress.startsWith("http://")) {// a relative path .. this addresses the local peer- searchaddress = "http://" + switchboard.webIndex.peers().mySeed().getPublicAddress() + (searchaddress.startsWith("/") ? "" : "/") + searchaddress;+ searchaddress = "http://" + switchboard.peers.mySeed().getPublicAddress() + (searchaddress.startsWith("/") ? "" : "/") + searchaddress;}post.remove("url");post.remove("login");diff --git a/htroot/api/yacydoc.java b/htroot/api/yacydoc.javaindex 2ad240e12..1acbe9549 100644--- a/htroot/api/yacydoc.java+++ b/htroot/api/yacydoc.java@@ -68,14 +68,14 @@ public class yacydoc {}if (urlhash == null || urlhash.length() == 0) return prop;- final URLMetadataRow entry = sb.webIndex.metadata().load(urlhash, null, 0);+ final URLMetadataRow entry = sb.indexSegment.metadata().load(urlhash, null, 0);if (entry == null) return prop;final URLMetadataRow.Components metadata = entry.metadata();if (metadata.url() == null) {return prop;}- final URLMetadataRow le = ((entry.referrerHash() == null) || (entry.referrerHash().length() != yacySeedDB.commonHashLength)) ? null : sb.webIndex.metadata().load(entry.referrerHash(), null, 0);+ final URLMetadataRow le = ((entry.referrerHash() == null) || (entry.referrerHash().length() != yacySeedDB.commonHashLength)) ? null : sb.indexSegment.metadata().load(entry.referrerHash(), null, 0);prop.putXML("dc_title", metadata.dc_title());prop.putXML("dc_creator", metadata.dc_creator());diff --git a/htroot/opensearchdescription.java b/htroot/opensearchdescription.javaindex f887cc66f..8c03eaa9d 100644--- a/htroot/opensearchdescription.java+++ b/htroot/opensearchdescription.java@@ -51,7 +51,7 @@ public class opensearchdescription {prop.putXML("compareyacy_thisaddress", thisaddress);prop.putXML("thisaddress", thisaddress);prop.putXML("SearchPageGreeting", promoteSearchPageGreeting);- prop.putXML("clientname", sb.webIndex.peers().mySeed().getName());+ prop.putXML("clientname", sb.peers.mySeed().getName());// return rewrite propertiesreturn prop;diff --git a/htroot/rct_p.java b/htroot/rct_p.javaindex 185e9f6f3..0fcf276c8 100644--- a/htroot/rct_p.java+++ b/htroot/rct_p.java@@ -53,8 +53,8 @@ public class rct_p {if (post != null) {if (post.containsKey("retrieve")) {final String peerhash = post.get("peer", null);- final yacySeed seed = (peerhash == null) ? null : sb.webIndex.peers().getConnected(peerhash);- final RSSFeed feed = (seed == null) ? null : yacyClient.queryRemoteCrawlURLs(sb.webIndex.peers(), seed, 20, 60000);+ final yacySeed seed = (peerhash == null) ? null : sb.peers.getConnected(peerhash);+ final RSSFeed feed = (seed == null) ? null : yacyClient.queryRemoteCrawlURLs(sb.peers, seed, 20, 60000);if (feed != null) {for (final RSSMessage item: feed) {//System.out.println("URL=" + item.getLink() + ", desc=" + item.getDescription() + ", pubDate=" + item.getPubDate());@@ -84,7 +84,7 @@ public class rct_p {"REMOTE-CRAWLING",null,loaddate,- sb.webIndex.defaultRemoteProfile.handle(),+ sb.crawler.defaultRemoteProfile.handle(),0,0,0@@ -115,8 +115,8 @@ public class rct_p {// list known hostsyacySeed seed;int hc = 0;- if (sb.webIndex.peers() != null && sb.webIndex.peers().sizeConnected() > 0) {- final Iterator<yacySeed> e = PeerSelection.getProvidesRemoteCrawlURLs(sb.webIndex.peers());+ if (sb.peers != null && sb.peers.sizeConnected() > 0) {+ final Iterator<yacySeed> e = PeerSelection.getProvidesRemoteCrawlURLs(sb.peers);while (e.hasNext()) {seed = e.next();if (seed != null) {diff --git a/htroot/sharedBlacklist_p.java b/htroot/sharedBlacklist_p.javaindex 793714c58..9751e9da8 100644--- a/htroot/sharedBlacklist_p.java+++ b/htroot/sharedBlacklist_p.java@@ -116,8 +116,8 @@ public class sharedBlacklist_p {// generate the download URLString downloadURLOld = null;- if( sb.webIndex.peers() != null ){ //no nullpointer error..- final yacySeed seed = sb.webIndex.peers().getConnected(Hash);+ if( sb.peers != null ){ //no nullpointer error..+ final yacySeed seed = sb.peers.getConnected(Hash);if (seed != null) {final String IP = seed.getIP();final String Port = seed.get(yacySeed.PORT, "8080");diff --git a/htroot/www/welcome.java b/htroot/www/welcome.javaindex 4eede09b2..4f0e956bf 100644--- a/htroot/www/welcome.java+++ b/htroot/www/welcome.java@@ -53,7 +53,7 @@ public class welcome {prop.putHTML("peername", env.getConfig("peerName", "<nameless>"));prop.putHTML("peerdomain", env.getConfig("peerName", "<nameless>").toLowerCase());- prop.putHTML("peeraddress", sb.webIndex.peers().mySeed().getPublicAddress());+ prop.putHTML("peeraddress", sb.peers.mySeed().getPublicAddress());prop.put("hostname", serverDomains.myPublicIP());try{prop.put("hostip", InetAddress.getByName(serverDomains.myPublicIP()).getHostAddress());@@ -63,7 +63,7 @@ public class welcome {prop.put("port", serverCore.getPortNr(env.getConfig("port","8080")));prop.put("clientip", (String) header.get(httpRequestHeader.CONNECTION_PROP_CLIENTIP, ""));- final String peertype = (sb.webIndex.peers().mySeed() == null) ? yacySeed.PEERTYPE_JUNIOR : sb.webIndex.peers().mySeed().get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_VIRGIN);+ final String peertype = (sb.peers.mySeed() == null) ? yacySeed.PEERTYPE_JUNIOR : sb.peers.mySeed().get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_VIRGIN);final boolean senior = (peertype.equals(yacySeed.PEERTYPE_SENIOR)) || (peertype.equals(yacySeed.PEERTYPE_PRINCIPAL));if (senior) { prop.put("couldcan", "can"); } else { prop.put("couldcan", "could"); }if (senior) { prop.put("seniorinfo", "This peer runs in senior mode which means that your peer can be accessed using the addresses shown above."); } else { prop.putHTML("seniorinfo", "<b>Nobody can access your peer from the outside of your intranet. You must open your firewall and/or set a 'virtual server' in the settings of your router to enable access to the addresses as shown below.</b>"); }diff --git a/htroot/yacy/crawlReceipt.java b/htroot/yacy/crawlReceipt.javaindex 4af85dc01..70adb1d9a 100644--- a/htroot/yacy/crawlReceipt.java+++ b/htroot/yacy/crawlReceipt.java@@ -91,10 +91,10 @@ public final class crawlReceipt {*/- final yacySeed otherPeer = sb.webIndex.peers().get(iam);+ final yacySeed otherPeer = sb.peers.get(iam);final String otherPeerName = iam + ":" + ((otherPeer == null) ? "NULL" : (otherPeer.getName() + "/" + otherPeer.getVersion()));- if ((sb.webIndex.peers().mySeed() == null) || (!(sb.webIndex.peers().mySeed().hash.equals(youare)))) {+ if ((sb.peers.mySeed() == null) || (!(sb.peers.mySeed().hash.equals(youare)))) {// no yacy connection / unknown peersprop.put("delay", "3600");return prop;@@ -136,7 +136,7 @@ public final class crawlReceipt {if (result.equals("fill")) try {// put new entry into database- sb.webIndex.metadata().store(entry);+ sb.indexSegment.metadata().store(entry);sb.crawlResults.stack(entry, youare, iam, 1);sb.crawlQueues.delegatedURL.remove(entry.hash()); // the delegated work has been donelog.logInfo("crawlReceipt: RECEIVED RECEIPT from " + otherPeerName + " for URL " + entry.hash() + ":" + metadata.url().toNormalform(false, true));diff --git a/htroot/yacy/hello.java b/htroot/yacy/hello.javaindex e255d2386..f61aaa2d7 100644--- a/htroot/yacy/hello.java+++ b/htroot/yacy/hello.java@@ -159,17 +159,17 @@ public final class hello {remoteSeed.put(yacySeed.PEERTYPE, yacySeed.PEERTYPE_SENIOR);}// connect the seed- sb.webIndex.peers().peerActions.peerArrival(remoteSeed, true);+ sb.peers.peerActions.peerArrival(remoteSeed, true);} else {prop.put(yacySeed.YOURTYPE, yacySeed.PEERTYPE_JUNIOR);remoteSeed.put(yacySeed.PEERTYPE, yacySeed.PEERTYPE_JUNIOR);yacyCore.log.logInfo("hello: responded remote junior peer '" + remoteSeed.getName() + "' from " + reportedip);// no connection here, instead store junior in connection cacheif ((remoteSeed.hash != null) && (remoteSeed.isProper(false) == null)) {- sb.webIndex.peers().peerActions.peerPing(remoteSeed);+ sb.peers.peerActions.peerPing(remoteSeed);}}- sb.webIndex.peers().peerActions.setUserAgent(clientip, userAgent);+ sb.peers.peerActions.setUserAgent(clientip, userAgent);if (!(prop.get(yacySeed.YOURTYPE)).equals(reportedPeerType)) {yacyCore.log.logInfo("hello: changing remote peer '" + remoteSeed.getName() +"' [" + reportedip +@@ -180,15 +180,15 @@ public final class hello {serverCore.checkInterruption();final StringBuilder seeds = new StringBuilder(768);// attach some more seeds, as requested- if (sb.webIndex.peers().sizeConnected() > 0) {- if (count > sb.webIndex.peers().sizeConnected()) { count = sb.webIndex.peers().sizeConnected(); }+ if (sb.peers.sizeConnected() > 0) {+ if (count > sb.peers.sizeConnected()) { count = sb.peers.sizeConnected(); }if (count > 100) { count = 100; }// latest seeds- final Map<String, yacySeed> ySeeds = PeerSelection.seedsByAge(sb.webIndex.peers(), true, count); // peerhash/yacySeed relation+ final Map<String, yacySeed> ySeeds = PeerSelection.seedsByAge(sb.peers, true, count); // peerhash/yacySeed relation// attach also my own seed- seeds.append("seed0=").append(sb.webIndex.peers().mySeed().genSeedStr(key)).append(serverCore.CRLF_STRING);+ seeds.append("seed0=").append(sb.peers.mySeed().genSeedStr(key)).append(serverCore.CRLF_STRING);count = 1;// attach other seeds@@ -212,7 +212,7 @@ public final class hello {}} else {// attach also my own seed- seeds.append("seed0=").append(sb.webIndex.peers().mySeed().genSeedStr(key)).append(serverCore.CRLF_STRING);+ seeds.append("seed0=").append(sb.peers.mySeed().genSeedStr(key)).append(serverCore.CRLF_STRING);}prop.put("seedlist", seeds.toString());diff --git a/htroot/yacy/list.java b/htroot/yacy/list.javaindex 327377075..6a728baf0 100644--- a/htroot/yacy/list.java+++ b/htroot/yacy/list.java@@ -57,7 +57,7 @@ public final class list {String otherPeerName = null;if (post.containsKey("iam")) {- final yacySeed bla = sb.webIndex.peers().get(post.get("iam", ""));+ final yacySeed bla = sb.peers.get(post.get("iam", ""));if (bla != null) otherPeerName = bla.getName();}if (otherPeerName == null) otherPeerName = header.get(httpRequestHeader.CONNECTION_PROP_CLIENTIP);diff --git a/htroot/yacy/message.java b/htroot/yacy/message.javaindex 493f23ae3..5d832abf4 100644--- a/htroot/yacy/message.java+++ b/htroot/yacy/message.java@@ -73,7 +73,7 @@ public final class message {final String youare = post.get("youare", ""); // seed hash of the target peer, needed for network stability// check if we are the right target and requester has correct information about this peer- if ((sb.webIndex.peers().mySeed() == null) || (!(sb.webIndex.peers().mySeed().hash.equals(youare)))) {+ if ((sb.peers.mySeed() == null) || (!(sb.peers.mySeed().hash.equals(youare)))) {// this request has a wrong targetprop.put("response", "-1"); // request rejectedreturn prop;@@ -133,7 +133,7 @@ public final class message {sb.messageDB.write(msgEntry = sb.messageDB.newEntry("remote",otherSeed.get(yacySeed.NAME, "anonymous"), otherSeed.hash,- sb.webIndex.peers().mySeed().getName(), sb.webIndex.peers().mySeed().hash,+ sb.peers.mySeed().getName(), sb.peers.mySeed().hash,subject, mb));messageForwardingViaEmail(sb, msgEntry);@@ -179,7 +179,7 @@ public final class message {.append(sendMailTo).append("\nFrom: ").append("yacy@")- .append(sb.webIndex.peers().mySeed().getName())+ .append(sb.peers.mySeed().getName()).append("\nSubject: [YaCy] ").append(msgEntry.subject().replace('\n', ' ')).append("\nDate: ")diff --git a/htroot/yacy/query.java b/htroot/yacy/query.javaindex 56ecdda12..cfa8f1d3d 100644--- a/htroot/yacy/query.java+++ b/htroot/yacy/query.java@@ -74,7 +74,7 @@ public final class query {prop.put("mytime", DateFormatter.formatShortSecond());// check if we are the right target and requester has correct information about this peer- if (sb.webIndex.peers().mySeed() == null || !sb.webIndex.peers().mySeed().hash.equals(youare)) {+ if (sb.peers.mySeed() == null || !sb.peers.mySeed().hash.equals(youare)) {// this request has a wrong targetprop.put("response", "-1"); // request rejectedreturn prop;@@ -84,7 +84,7 @@ public final class query {if (obj.equals("rwiurlcount")) try {// the total number of different urls in the rwi is returned// <env> shall contain a word hash, the number of assigned lurls to this hash is returned- prop.put("response", sb.webIndex.index().get(env.getBytes(), null).size());+ prop.put("response", sb.indexSegment.index().get(env.getBytes(), null).size());return prop;} catch (IOException e) {e.printStackTrace();@@ -92,13 +92,13 @@ public final class query {if (obj.equals("rwicount")) {// return the total number of available word indexes- prop.put("response", sb.webIndex.index().size());+ prop.put("response", sb.indexSegment.index().size());return prop;}if (obj.equals("lurlcount")) {// return the number of all available l-url's- prop.put("response", sb.webIndex.metadata().size());+ prop.put("response", sb.indexSegment.metadata().size());return prop;}diff --git a/htroot/yacy/search.java b/htroot/yacy/search.javaindex 84bc74db1..2ff34c8b7 100644--- a/htroot/yacy/search.java+++ b/htroot/yacy/search.java@@ -159,10 +159,10 @@ public final class search {// store accessing peerfinal yacySeed remoteSeed = yacySeed.genRemoteSeed(oseed, key, false);- if (sb.webIndex.peers() == null) {+ if (sb.peers == null) {yacyCore.log.logSevere("yacy.search: seed cache not initialized");} else {- sb.webIndex.peers().peerActions.peerArrival(remoteSeed, true);+ sb.peers.peerActions.peerArrival(remoteSeed, true);}// prepare search@@ -209,7 +209,7 @@ public final class search {yacyCore.log.logInfo("INIT HASH SEARCH (abstracts only): " + plasmaSearchQuery.anonymizedQueryHashes(theQuery.queryHashes) + " - " + theQuery.displayResults() + " links");final long timer = System.currentTimeMillis();- final Map<byte[], ReferenceContainer<WordReference>>[] containers = sb.webIndex.index().searchTerm(theQuery.queryHashes, theQuery.excludeHashes, plasmaSearchQuery.hashes2StringSet(urls));+ final Map<byte[], ReferenceContainer<WordReference>>[] containers = sb.indexSegment.index().searchTerm(theQuery.queryHashes, theQuery.excludeHashes, plasmaSearchQuery.hashes2StringSet(urls));serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(theQuery.id(true), plasmaSearchEvent.COLLECTION, containers[0].size(), System.currentTimeMillis() - timer), false);if (containers != null) {@@ -260,7 +260,7 @@ public final class search {RSSFeed.channels(RSSFeed.REMOTESEARCH).addMessage(new RSSMessage("Remote Search Request from " + ((remoteSeed == null) ? "unknown" : remoteSeed.getName()), plasmaSearchQuery.anonymizedQueryHashes(theQuery.queryHashes), ""));// make event- theSearch = plasmaSearchEvent.getEvent(theQuery, rankingProfile, sb.webIndex, sb.crawlResults, null, true);+ theSearch = plasmaSearchEvent.getEvent(theQuery, rankingProfile, sb.indexSegment, sb.peers, sb.crawlResults, null, true);// set statistic details of search result and find best result index setif (theSearch.getRankingResult().getLocalResourceSize() == 0) {@@ -362,7 +362,7 @@ public final class search {prop.put("fwrec", ""); // peers that would have helped to construct this result (recommendations)// prepare search statistics- theQuery.remotepeer = sb.webIndex.peers().lookupByIP(natLib.getInetAddress(client), true, false, false);+ theQuery.remotepeer = sb.peers.lookupByIP(natLib.getInetAddress(client), true, false, false);theQuery.resultcount = (theSearch == null) ? 0 : theSearch.getRankingResult().getLocalResourceSize() + theSearch.getRankingResult().getRemoteResourceSize();theQuery.searchtime = System.currentTimeMillis() - timestamp;theQuery.urlretrievaltime = (theSearch == null) ? 0 : theSearch.getURLRetrievalTime();@@ -384,8 +384,8 @@ public final class search {prop.put("searchtime", System.currentTimeMillis() - timestamp);final int links = Integer.parseInt(prop.get("linkcount","0"));- sb.webIndex.peers().mySeed().incSI(links);- sb.webIndex.peers().mySeed().incSU(links);+ sb.peers.mySeed().incSI(links);+ sb.peers.mySeed().incSU(links);return prop;}diff --git a/htroot/yacy/transfer.java b/htroot/yacy/transfer.javaindex 066def75a..9d5defbf7 100644--- a/htroot/yacy/transfer.java+++ b/htroot/yacy/transfer.java@@ -66,7 +66,7 @@ public final class transfer {return prop;}- final yacySeed otherseed = sb.webIndex.peers().get(otherpeer);+ final yacySeed otherseed = sb.peers.get(otherpeer);if ((otherseed == null) || (filename.indexOf("..") >= 0)) {// reject unknown peers: this does not appear fair, but anonymous senders are dangerous// reject paths that contain '..' because they are dangerous@@ -88,7 +88,7 @@ public final class transfer {final String access = Base64Order.enhancedCoder.encode(Digest.encodeMD5Raw(otherpeer + ":" + filename)) + ":" + Base64Order.enhancedCoder.encode(Digest.encodeMD5Raw("" + System.currentTimeMillis()));prop.put("response", "ok");prop.put("process_access", access);- prop.put("process_address", sb.webIndex.peers().mySeed().getPublicAddress());+ prop.put("process_address", sb.peers.mySeed().getPublicAddress());prop.put("process_protocol", "http");prop.put("process_path", ""); // currently empty; the store process will find a pathprop.put("process_maxsize", "-1"); // if response is too big we return the size of the filediff --git a/htroot/yacy/transferRWI.java b/htroot/yacy/transferRWI.javaindex 153645661..2979962d8 100644--- a/htroot/yacy/transferRWI.java+++ b/htroot/yacy/transferRWI.java@@ -84,7 +84,7 @@ public final class transferRWI {boolean granted = sb.getConfig("allowReceiveIndex", "false").equals("true");final boolean blockBlacklist = sb.getConfig("indexReceiveBlockBlacklist", "false").equals("true");final long cachelimit = sb.getConfigLong(plasmaSwitchboardConstants.WORDCACHE_MAX_COUNT, 100000);- final yacySeed otherPeer = sb.webIndex.peers().get(iam);+ final yacySeed otherPeer = sb.peers.get(iam);final String otherPeerName = iam + ":" + ((otherPeer == null) ? "NULL" : (otherPeer.getName() + "/" + otherPeer.getVersion()));// response values@@ -92,8 +92,8 @@ public final class transferRWI {String result = "ok";final StringBuilder unknownURLs = new StringBuilder();- if ((youare == null) || (!youare.equals(sb.webIndex.peers().mySeed().hash))) {- sb.getLog().logInfo("Rejecting RWIs from peer " + otherPeerName + ". Wrong target. Wanted peer=" + youare + ", iam=" + sb.webIndex.peers().mySeed().hash);+ if ((youare == null) || (!youare.equals(sb.peers.mySeed().hash))) {+ sb.getLog().logInfo("Rejecting RWIs from peer " + otherPeerName + ". Wrong target. Wanted peer=" + youare + ", iam=" + sb.peers.mySeed().hash);result = "wrong_target";pause = 0;} else if (otherPeer == null) {@@ -111,9 +111,9 @@ public final class transferRWI {sb.getLog().logInfo("Rejecting RWIs from peer " + otherPeerName + ". Not granted. This peer is in robinson mode");result = "not_granted";pause = 60000;- } else if (sb.webIndex.index().getBufferSize() > cachelimit) {+ } else if (sb.indexSegment.index().getBufferSize() > cachelimit) {// we are too busy to receive indexes- sb.getLog().logInfo("Rejecting RWIs from peer " + otherPeerName + ". We are too busy (buffersize=" + sb.webIndex.index().getBufferSize() + ").");+ sb.getLog().logInfo("Rejecting RWIs from peer " + otherPeerName + ". We are too busy (buffersize=" + sb.indexSegment.index().getBufferSize() + ").");granted = false; // don't accept more words if there are too many words to flushresult = "busy";pause = 60000;@@ -183,7 +183,7 @@ public final class transferRWI {// learn entrytry {- sb.webIndex.index().add(wordHash.getBytes(), iEntry);+ sb.indexSegment.index().add(wordHash.getBytes(), iEntry);} catch (IOException e) {e.printStackTrace();}@@ -191,7 +191,7 @@ public final class transferRWI {// check if we need to ask for the corresponding URLif (!(knownURL.contains(urlHash)||unknownURL.contains(urlHash))) try {- if (sb.webIndex.metadata().exists(urlHash)) {+ if (sb.indexSegment.metadata().exists(urlHash)) {knownURL.add(urlHash);} else {unknownURL.add(urlHash);@@ -204,7 +204,7 @@ public final class transferRWI {}received++;}- sb.webIndex.peers().mySeed().incRI(received);+ sb.peers.mySeed().incRI(received);// finally compose the unknownURL hash listfinal Iterator<String> it = unknownURL.iterator();@@ -216,13 +216,13 @@ public final class transferRWI {if ((wordhashes.length == 0) || (received == 0)) {sb.getLog().logInfo("Received 0 RWIs from " + otherPeerName + ", processed in " + (System.currentTimeMillis() - startProcess) + " milliseconds, requesting " + unknownURL.size() + " URLs, blocked " + blocked + " RWIs");} else {- final long avdist = (FlatWordPartitionScheme.std.dhtDistance(wordhashes[0].getBytes(), null, sb.webIndex.peers().mySeed()) + FlatWordPartitionScheme.std.dhtDistance(wordhashes[received - 1].getBytes(), null, sb.webIndex.peers().mySeed())) / 2;+ final long avdist = (FlatWordPartitionScheme.std.dhtDistance(wordhashes[0].getBytes(), null, sb.peers.mySeed()) + FlatWordPartitionScheme.std.dhtDistance(wordhashes[received - 1].getBytes(), null, sb.peers.mySeed())) / 2;sb.getLog().logInfo("Received " + received + " Entries " + wordc + " Words [" + wordhashes[0] + " .. " + wordhashes[received - 1] + "]/" + avdist + " from " + otherPeerName + ", processed in " + (System.currentTimeMillis() - startProcess) + " milliseconds, requesting " + unknownURL.size() + "/" + receivedURL + " URLs, blocked " + blocked + " RWIs");RSSFeed.channels(RSSFeed.INDEXRECEIVE).addMessage(new RSSMessage("Received " + received + " RWIs [" + wordhashes[0] + " .. " + wordhashes[received - 1] + "]/" + avdist + " from " + otherPeerName + ", requesting " + unknownURL.size() + " URLs, blocked " + blocked, "", ""));}result = "ok";- pause = (int) (sb.webIndex.index().getBufferSize() * 20000 / sb.getConfigLong(plasmaSwitchboardConstants.WORDCACHE_MAX_COUNT, 100000)); // estimation of necessary pause time+ pause = (int) (sb.indexSegment.index().getBufferSize() * 20000 / sb.getConfigLong(plasmaSwitchboardConstants.WORDCACHE_MAX_COUNT, 100000)); // estimation of necessary pause time}prop.put("unknownURL", unknownURLs.toString());diff --git a/htroot/yacy/transferURL.java b/htroot/yacy/transferURL.javaindex 0d5747abe..be7f29750 100644--- a/htroot/yacy/transferURL.java+++ b/htroot/yacy/transferURL.java@@ -69,11 +69,11 @@ public final class transferURL {String result = "";String doublevalues = "0";- final yacySeed otherPeer = sb.webIndex.peers().get(iam);+ final yacySeed otherPeer = sb.peers.get(iam);final String otherPeerName = iam + ":" + ((otherPeer == null) ? "NULL" : (otherPeer.getName() + "/" + otherPeer.getVersion()));- if ((youare == null) || (!youare.equals(sb.webIndex.peers().mySeed().hash))) {- sb.getLog().logInfo("Rejecting URLs from peer " + otherPeerName + ". Wrong target. Wanted peer=" + youare + ", iam=" + sb.webIndex.peers().mySeed().hash);+ if ((youare == null) || (!youare.equals(sb.peers.mySeed().hash))) {+ sb.getLog().logInfo("Rejecting URLs from peer " + otherPeerName + ". Wrong target. Wanted peer=" + youare + ", iam=" + sb.peers.mySeed().hash);result = "wrong_target";} else if ((!granted) || (sb.isRobinsonMode())) {sb.getLog().logInfo("Rejecting URLs from peer " + otherPeerName + ". Not granted.");@@ -81,7 +81,7 @@ public final class transferURL {} else {int received = 0;int blocked = 0;- final int sizeBefore = sb.webIndex.metadata().size();+ final int sizeBefore = sb.indexSegment.metadata().size();// read the urls from the other properties and storeString urls;URLMetadataRow lEntry;@@ -138,7 +138,7 @@ public final class transferURL {// write entry to databasetry {- sb.webIndex.metadata().store(lEntry);+ sb.indexSegment.metadata().store(lEntry);sb.crawlResults.stack(lEntry, iam, iam, 3);if (yacyCore.log.isFine()) yacyCore.log.logFine("transferURL: received URL '" + metadata.url().toNormalform(false, true) + "' from peer " + otherPeerName);received++;@@ -147,10 +147,10 @@ public final class transferURL {}}- sb.webIndex.peers().mySeed().incRU(received);+ sb.peers.mySeed().incRU(received);// return rewrite properties- final int more = sb.webIndex.metadata().size() - sizeBefore;+ final int more = sb.indexSegment.metadata().size() - sizeBefore;doublevalues = Integer.toString(received - more);sb.getLog().logInfo("Received " + received + " URLs from peer " + otherPeerName + " in " + (System.currentTimeMillis() - start) + " ms, blocked " + blocked + " URLs");RSSFeed.channels(RSSFeed.INDEXRECEIVE).addMessage(new RSSMessage("Received " + received + " URLs from peer " + otherPeerName + ", blocked " + blocked, "", ""));diff --git a/htroot/yacy/urls.java b/htroot/yacy/urls.javaindex b40a3e667..f2b36d546 100644--- a/htroot/yacy/urls.java+++ b/htroot/yacy/urls.java@@ -45,7 +45,7 @@ public class urls {// insert default valuesfinal serverObjects prop = new serverObjects();- prop.put("iam", sb.webIndex.peers().mySeed().hash);+ prop.put("iam", sb.peers.mySeed().hash);prop.put("response", "rejected - insufficient call parameters");prop.put("channel_title", "");prop.put("channel_description", "");@@ -68,7 +68,7 @@ public class urls {(System.currentTimeMillis() < timeout) &&(sb.crawlQueues.noticeURL.stackSize(stackType) > 0)) {try {- entry = sb.crawlQueues.noticeURL.pop(stackType, false, sb.webIndex.profilesActiveCrawls);+ entry = sb.crawlQueues.noticeURL.pop(stackType, false, sb.crawler.profilesActiveCrawls);} catch (final IOException e) {break;}@@ -81,7 +81,7 @@ public class urls {sb.crawlQueues.delegatedURL.push(sb.crawlQueues.delegatedURL.newEntry(entry,- sb.webIndex.peers().mySeed().hash,+ sb.peers.mySeed().hash,new Date(),0,"client=____________")@@ -112,7 +112,7 @@ public class urls {URLMetadataRow.Components metadata;yacyURL referrer;for (int i = 0; i < count; i++) {- entry = sb.webIndex.metadata().load(urlhashes.substring(12 * i, 12 * (i + 1)), null, 0);+ entry = sb.indexSegment.metadata().load(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/yacysearch.java b/htroot/yacysearch.javaindex 537d6c430..3f4b7dc24 100644--- a/htroot/yacysearch.java+++ b/htroot/yacysearch.java@@ -224,7 +224,7 @@ public class yacysearch {// check available memory and clean up if necessaryif (!MemoryControl.request(8000000L, false)) {- sb.webIndex.metadata().clearCache();+ sb.indexSegment.metadata().clearCache();plasmaSearchEvent.cleanupEvents(true);}@@ -333,14 +333,14 @@ public class yacysearch {// delete the index entry locallyfinal String delHash = post.get("deleteref", ""); // urlhash- sb.webIndex.index().remove(Word.words2hashes(query[0]), delHash);+ sb.indexSegment.index().remove(Word.words2hashes(query[0]), delHash);// make new news message with negative votingfinal HashMap<String, String> map = new HashMap<String, String>();map.put("urlhash", delHash);map.put("vote", "negative");map.put("refid", "");- sb.webIndex.peers().newsPool.publishMyNews(yacyNewsRecord.newRecord(sb.webIndex.peers().mySeed(), yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, map));+ sb.peers.newsPool.publishMyNews(yacyNewsRecord.newRecord(sb.peers.mySeed(), yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, map));} catch (IOException e) {e.printStackTrace();}@@ -352,7 +352,7 @@ public class yacysearch {return prop;}final String recommendHash = post.get("recommendref", ""); // urlhash- final URLMetadataRow urlentry = sb.webIndex.metadata().load(recommendHash, null, 0);+ final URLMetadataRow urlentry = sb.indexSegment.metadata().load(recommendHash, null, 0);if (urlentry != null) {final URLMetadataRow.Components metadata = urlentry.metadata();plasmaParserDocument document;@@ -365,7 +365,7 @@ public class yacysearch {map.put("description", document.dc_title().replace(',', ' '));map.put("author", document.dc_creator());map.put("tags", document.dc_subject(' '));- sb.webIndex.peers().newsPool.publishMyNews(yacyNewsRecord.newRecord(sb.webIndex.peers().mySeed(), yacyNewsPool.CATEGORY_SURFTIPP_ADD, map));+ sb.peers.newsPool.publishMyNews(yacyNewsRecord.newRecord(sb.peers.mySeed(), yacyNewsPool.CATEGORY_SURFTIPP_ADD, map));document.close();}}@@ -419,7 +419,7 @@ public class yacysearch {theQuery.setOffset(0); // in case that this is a new search, always start without a offsetoffset = 0;}- final plasmaSearchEvent theSearch = plasmaSearchEvent.getEvent(theQuery, ranking, sb.webIndex, sb.crawlResults, (sb.isRobinsonMode()) ? sb.clusterhashes : null, false);+ final plasmaSearchEvent theSearch = plasmaSearchEvent.getEvent(theQuery, ranking, sb.indexSegment, sb.peers, sb.crawlResults, (sb.isRobinsonMode()) ? sb.clusterhashes : null, false);// generate result object//serverLog.logFine("LOCAL_SEARCH", "SEARCH TIME AFTER ORDERING OF SEARCH RESULTS: " + (System.currentTimeMillis() - timestamp) + " ms");diff --git a/htroot/yacysearchitem.java b/htroot/yacysearchitem.javaindex aec533f4a..be555599e 100644--- a/htroot/yacysearchitem.java+++ b/htroot/yacysearchitem.java@@ -108,7 +108,7 @@ public class yacysearchitem {prop.put("content", 1); // switch on specific contentprop.put("content_authorized", authenticated ? "1" : "0");- prop.put("content_authorized_recommend", (sb.webIndex.peers().newsPool.getSpecific(yacyNewsPool.OUTGOING_DB, yacyNewsPool.CATEGORY_SURFTIPP_ADD, "url", result.urlstring()) == null) ? "1" : "0");+ prop.put("content_authorized_recommend", (sb.peers.newsPool.getSpecific(yacyNewsPool.OUTGOING_DB, yacyNewsPool.CATEGORY_SURFTIPP_ADD, "url", result.urlstring()) == null) ? "1" : "0");prop.putHTML("content_authorized_recommend_deletelink", "/yacysearch.html?search=" + theQuery.queryString + "&Enter=Search&count=" + theQuery.displayResults() + "&offset=" + (theQuery.neededResults() - theQuery.displayResults()) + "&order=" + crypt.simpleEncode(theQuery.ranking.toExternalString()) + "&resource=local&time=3&deleteref=" + result.hash() + "&urlmaskfilter=.*");prop.putHTML("content_authorized_recommend_recommendlink", "/yacysearch.html?search=" + theQuery.queryString + "&Enter=Search&count=" + theQuery.displayResults() + "&offset=" + (theQuery.neededResults() - theQuery.displayResults()) + "&order=" + crypt.simpleEncode(theQuery.ranking.toExternalString()) + "&resource=local&time=3&recommendref=" + result.hash() + "&urlmaskfilter=.*");prop.put("content_authorized_urlhash", result.hash());diff --git a/source/de/anomic/crawler/CrawlQueues.java b/source/de/anomic/crawler/CrawlQueues.javaindex 66053e208..6a3887c9e 100644--- a/source/de/anomic/crawler/CrawlQueues.java+++ b/source/de/anomic/crawler/CrawlQueues.java@@ -186,7 +186,7 @@ public class CrawlQueues {// move some tasks to the core crawl job so we have something to dofinal int toshift = Math.min(10, limitCrawlJobSize()); // this cannot be a big number because the balancer makes a forced waiting if it cannot balancefor (int i = 0; i < toshift; i++) {- noticeURL.shift(NoticedURL.STACK_TYPE_LIMIT, NoticedURL.STACK_TYPE_CORE, sb.webIndex.profilesActiveCrawls);+ noticeURL.shift(NoticedURL.STACK_TYPE_LIMIT, NoticedURL.STACK_TYPE_CORE, sb.crawler.profilesActiveCrawls);}log.logInfo("shifted " + toshift + " jobs from global crawl to local crawl (coreCrawlJobSize()=" + coreCrawlJobSize() +", limitCrawlJobSize()=" + limitCrawlJobSize() + ", cluster.mode=" + sb.getConfig(plasmaSwitchboardConstants.CLUSTER_MODE, "") +@@ -202,7 +202,7 @@ public class CrawlQueues {while (urlEntry == null && noticeURL.stackSize(NoticedURL.STACK_TYPE_CORE) > 0) {final String stats = "LOCALCRAWL[" + noticeURL.stackSize(NoticedURL.STACK_TYPE_CORE) + ", " + noticeURL.stackSize(NoticedURL.STACK_TYPE_LIMIT) + ", " + noticeURL.stackSize(NoticedURL.STACK_TYPE_OVERHANG) + ", " + noticeURL.stackSize(NoticedURL.STACK_TYPE_REMOTE) + "]";try {- urlEntry = noticeURL.pop(NoticedURL.STACK_TYPE_CORE, true, sb.webIndex.profilesActiveCrawls);+ urlEntry = noticeURL.pop(NoticedURL.STACK_TYPE_CORE, true, sb.crawler.profilesActiveCrawls);if (urlEntry == null) continue;final String profileHandle = urlEntry.profileHandle();// System.out.println("DEBUG plasmaSwitchboard.processCrawling:@@ -230,7 +230,7 @@ public class CrawlQueues {* @return*/private void generateCrawl(CrawlEntry urlEntry, final String stats, final String profileHandle) {- final CrawlProfile.entry profile = sb.webIndex.profilesActiveCrawls.getEntry(profileHandle);+ final CrawlProfile.entry profile = sb.crawler.profilesActiveCrawls.getEntry(profileHandle);if (profile != null) {// check if the protocol is supported@@ -246,7 +246,7 @@ public class CrawlQueues {+ ", crawlDepth=" + profile.depth()+ ", must-match=" + profile.mustMatchPattern().toString()+ ", must-not-match=" + profile.mustNotMatchPattern().toString()- + ", permission=" + ((sb.webIndex.peers() == null) ? "undefined" : (((sb.webIndex.peers().mySeed().isSenior()) || (sb.webIndex.peers().mySeed().isPrincipal())) ? "true" : "false")));+ + ", permission=" + ((sb.peers == null) ? "undefined" : (((sb.peers.mySeed().isSenior()) || (sb.peers.mySeed().isPrincipal())) ? "true" : "false")));processLocalCrawling(urlEntry, stats);} else {@@ -292,9 +292,9 @@ public class CrawlQueues {}value = (int) sb.getConfigLong(plasmaSwitchboardConstants.INDEXER_SLOTS, 30);- if (sb.webIndex.queuePreStack.size() >= value) {+ if (sb.crawler.queuePreStack.size() >= value) {if (this.log.isFine()) {- log.logFine(type + "Crawl: too many processes in indexing queue, dismissed (" + "sbQueueSize=" + sb.webIndex.queuePreStack.size() + ")");+ log.logFine(type + "Crawl: too many processes in indexing queue, dismissed (" + "sbQueueSize=" + sb.crawler.queuePreStack.size() + ")");}return false;}@@ -322,19 +322,19 @@ public class CrawlQueues {public boolean remoteCrawlLoaderJob() {// check if we are allowed to crawl urls provided by other peers- if (!sb.webIndex.peers().mySeed().getFlagAcceptRemoteCrawl()) {+ if (!sb.peers.mySeed().getFlagAcceptRemoteCrawl()) {//this.log.logInfo("remoteCrawlLoaderJob: not done, we are not allowed to do that");return false;}// check if we are a senior peer- if (!sb.webIndex.peers().mySeed().isActive()) {+ if (!sb.peers.mySeed().isActive()) {//this.log.logInfo("remoteCrawlLoaderJob: not done, this should be a senior or principal peer");return false;}- if (sb.webIndex.queuePreStack.size() >= (int) sb.getConfigLong(plasmaSwitchboardConstants.INDEXER_SLOTS, 30) / 2) {- if (this.log.isFine()) log.logFine("remoteCrawlLoaderJob: too many processes in indexing queue, dismissed (" + "sbQueueSize=" + sb.webIndex.queuePreStack.size() + ")");+ if (sb.crawler.queuePreStack.size() >= (int) sb.getConfigLong(plasmaSwitchboardConstants.INDEXER_SLOTS, 30) / 2) {+ if (this.log.isFine()) log.logFine("remoteCrawlLoaderJob: too many processes in indexing queue, dismissed (" + "sbQueueSize=" + sb.crawler.queuePreStack.size() + ")");return false;}@@ -366,8 +366,8 @@ public class CrawlQueues {// check if we have an entry in the provider list, otherwise fill the listyacySeed seed;if (remoteCrawlProviderHashes.size() == 0) {- if (sb.webIndex.peers() != null && sb.webIndex.peers().sizeConnected() > 0) {- final Iterator<yacySeed> e = PeerSelection.getProvidesRemoteCrawlURLs(sb.webIndex.peers());+ if (sb.peers != null && sb.peers.sizeConnected() > 0) {+ final Iterator<yacySeed> e = PeerSelection.getProvidesRemoteCrawlURLs(sb.peers);while (e.hasNext()) {seed = e.next();if (seed != null) {@@ -384,7 +384,7 @@ public class CrawlQueues {while ((seed == null) && (remoteCrawlProviderHashes.size() > 0)) {hash = remoteCrawlProviderHashes.remove(remoteCrawlProviderHashes.size() - 1);if (hash == null) continue;- seed = sb.webIndex.peers().get(hash);+ seed = sb.peers.get(hash);if (seed == null) continue;// check if the peer is inside our clusterif ((sb.isRobinsonMode()) && (!sb.isInMyCluster(seed))) {@@ -395,11 +395,11 @@ public class CrawlQueues {if (seed == null) return false;// we know a peer which should provide remote crawl entries. load them now.- final RSSFeed feed = yacyClient.queryRemoteCrawlURLs(sb.webIndex.peers(), seed, 30, 60000);+ final RSSFeed feed = yacyClient.queryRemoteCrawlURLs(sb.peers, seed, 30, 60000);if (feed == null || feed.size() == 0) {// something is wrong with this provider. To prevent that we get not stuck with this peer// we remove it from the peer list- sb.webIndex.peers().peerActions.peerDeparture(seed, "no results from provided remote crawls");+ sb.peers.peerActions.peerDeparture(seed, "no results from provided remote crawls");// ask another peerreturn remoteCrawlLoaderJob();}@@ -437,7 +437,7 @@ public class CrawlQueues {item.getDescription(),null,loaddate,- sb.webIndex.defaultRemoteProfile.handle(),+ sb.crawler.defaultRemoteProfile.handle(),0,0,0@@ -478,7 +478,7 @@ public class CrawlQueues {final String stats = "REMOTETRIGGEREDCRAWL[" + noticeURL.stackSize(NoticedURL.STACK_TYPE_CORE) + ", " + noticeURL.stackSize(NoticedURL.STACK_TYPE_LIMIT) + ", " + noticeURL.stackSize(NoticedURL.STACK_TYPE_OVERHANG) + ", "+ noticeURL.stackSize(NoticedURL.STACK_TYPE_REMOTE) + "]";try {- final CrawlEntry urlEntry = noticeURL.pop(NoticedURL.STACK_TYPE_REMOTE, true, sb.webIndex.profilesActiveCrawls);+ final CrawlEntry urlEntry = noticeURL.pop(NoticedURL.STACK_TYPE_REMOTE, true, sb.crawler.profilesActiveCrawls);final String profileHandle = urlEntry.profileHandle();// System.out.println("DEBUG plasmaSwitchboard.processCrawling:// profileHandle = " + profileHandle + ", urlEntry.url = " +@@ -513,7 +513,7 @@ public class CrawlQueues {) throws IOException {final CrawlEntry centry = new CrawlEntry(- sb.webIndex.peers().mySeed().hash,+ sb.peers.mySeed().hash,url,"","",@@ -521,12 +521,12 @@ public class CrawlQueues {new Date(),(forText) ?((global) ?- sb.webIndex.defaultTextSnippetGlobalProfile.handle() :- sb.webIndex.defaultTextSnippetLocalProfile.handle())+ sb.crawler.defaultTextSnippetGlobalProfile.handle() :+ sb.crawler.defaultTextSnippetLocalProfile.handle()):((global) ?- sb.webIndex.defaultMediaSnippetGlobalProfile.handle() :- sb.webIndex.defaultMediaSnippetLocalProfile.handle()), // crawl profile+ sb.crawler.defaultMediaSnippetGlobalProfile.handle() :+ sb.crawler.defaultMediaSnippetLocalProfile.handle()), // crawl profile0,0,0);@@ -567,7 +567,7 @@ public class CrawlQueues {if (log.isFine()) log.logFine("Crawling of URL '" + entry.url().toString() + "' disallowed by robots.txt.");final ZURL.Entry eentry = errorURL.newEntry(this.entry,- sb.webIndex.peers().mySeed().hash,+ sb.peers.mySeed().hash,new Date(),1,"denied by robots.txt");@@ -581,7 +581,7 @@ public class CrawlQueues {if (result != null) {final ZURL.Entry eentry = errorURL.newEntry(this.entry,- sb.webIndex.peers().mySeed().hash,+ sb.peers.mySeed().hash,new Date(),1,"cannot load: " + result);@@ -595,7 +595,7 @@ public class CrawlQueues {} catch (final Exception e) {final ZURL.Entry eentry = errorURL.newEntry(this.entry,- sb.webIndex.peers().mySeed().hash,+ sb.peers.mySeed().hash,new Date(),1,e.getMessage() + " - in worker");diff --git a/source/de/anomic/crawler/CrawlStacker.java b/source/de/anomic/crawler/CrawlStacker.javaindex 9399d1dd9..7a149e748 100644--- a/source/de/anomic/crawler/CrawlStacker.java+++ b/source/de/anomic/crawler/CrawlStacker.java@@ -32,12 +32,13 @@ import java.net.UnknownHostException;import java.util.Date;import de.anomic.data.Blacklist;+import de.anomic.kelondro.text.Segment;import de.anomic.kelondro.text.metadataPrototype.URLMetadataRow;import de.anomic.kelondro.util.Log;import de.anomic.plasma.plasmaSwitchboard;-import de.anomic.plasma.plasmaWordIndex;import de.anomic.server.serverDomains;import de.anomic.server.serverProcessor;+import de.anomic.yacy.yacySeedDB;import de.anomic.yacy.yacyURL;public final class CrawlStacker {@@ -47,14 +48,24 @@ public final class CrawlStacker {private serverProcessor<CrawlEntry> fastQueue, slowQueue;private long dnsHit, dnsMiss;private CrawlQueues nextQueue;- private plasmaWordIndex wordIndex;+ private CrawlSwitchboard crawler;+ private Segment indexSegment;+ private yacySeedDB peers;private boolean acceptLocalURLs, acceptGlobalURLs;// this is the process that checks url for double-occurrences and for allowance/disallowance by robots.txt- public CrawlStacker(CrawlQueues cq, plasmaWordIndex wordIndex, boolean acceptLocalURLs, boolean acceptGlobalURLs) {+ public CrawlStacker(+ CrawlQueues cq,+ CrawlSwitchboard cs,+ Segment indexSegment,+ yacySeedDB peers,+ boolean acceptLocalURLs,+ boolean acceptGlobalURLs) {this.nextQueue = cq;- this.wordIndex = wordIndex;+ this.crawler = cs;+ this.indexSegment = indexSegment;+ this.peers = peers;this.dnsHit = 0;this.dnsMiss = 0;this.acceptLocalURLs = acceptLocalURLs;@@ -123,7 +134,7 @@ public final class CrawlStacker {// if the url was rejected we store it into the error URL dbif (rejectReason != null) {- final ZURL.Entry ee = nextQueue.errorURL.newEntry(entry, wordIndex.peers().mySeed().hash, new Date(), 1, rejectReason);+ final ZURL.Entry ee = nextQueue.errorURL.newEntry(entry, peers.mySeed().hash, new Date(), 1, rejectReason);ee.store();nextQueue.errorURL.push(ee);}@@ -185,7 +196,7 @@ public final class CrawlStacker {return "url in blacklist";}- final CrawlProfile.entry profile = wordIndex.profilesActiveCrawls.getEntry(entry.profileHandle());+ final CrawlProfile.entry profile = crawler.profilesActiveCrawls.getEntry(entry.profileHandle());if (profile == null) {final String errorMsg = "LOST STACKER PROFILE HANDLE '" + entry.profileHandle() + "' for URL " + entry.url();log.logWarning(errorMsg);@@ -243,8 +254,8 @@ public final class CrawlStacker {// check if the url is double registeredfinal String dbocc = nextQueue.urlExists(entry.url().hash());- if (dbocc != null || wordIndex.metadata().exists(entry.url().hash())) {- final URLMetadataRow oldEntry = wordIndex.metadata().load(entry.url().hash(), null, 0);+ if (dbocc != null || indexSegment.metadata().exists(entry.url().hash())) {+ final URLMetadataRow oldEntry = indexSegment.metadata().load(entry.url().hash(), null, 0);final boolean recrawl = (oldEntry != null) && (profile.recrawlIfOlder() > oldEntry.loaddate().getTime());// do double-checkif ((dbocc != null) && (!recrawl)) {@@ -264,16 +275,16 @@ public final class CrawlStacker {}// store information- final boolean local = entry.initiator().equals(wordIndex.peers().mySeed().hash);- final boolean proxy = (entry.initiator() == null || entry.initiator().equals("------------")) && profile.handle().equals(wordIndex.defaultProxyProfile.handle());- final boolean remote = profile.handle().equals(wordIndex.defaultRemoteProfile.handle());+ final boolean local = entry.initiator().equals(peers.mySeed().hash);+ final boolean proxy = (entry.initiator() == null || entry.initiator().equals("------------")) && profile.handle().equals(crawler.defaultProxyProfile.handle());+ final boolean remote = profile.handle().equals(crawler.defaultRemoteProfile.handle());final boolean global =(profile.remoteIndexing()) /* granted */ &&(entry.depth() == profile.depth()) /* leaf node */ &&//(initiatorHash.equals(yacyCore.seedDB.mySeed.hash)) /* not proxy */ &&(- (wordIndex.peers().mySeed().isSenior()) ||- (wordIndex.peers().mySeed().isPrincipal())+ (peers.mySeed().isSenior()) ||+ (peers.mySeed().isPrincipal())) /* qualified */;if (!local && !global && !remote && !proxy) {diff --git a/source/de/anomic/crawler/CrawlSwitchboard.java b/source/de/anomic/crawler/CrawlSwitchboard.javanew file mode 100644index 000000000..65e45cc64--- /dev/null+++ b/source/de/anomic/crawler/CrawlSwitchboard.java@@ -0,0 +1,268 @@+// CrawlSwitchboard.java+// (C) 2005, 2006 by Michael Peter Christen; [email protected], Frankfurt a. M., Germany+// first published 2005 on http://www.anomic.de+//+// This is a part of YaCy, a peer-to-peer based web search engine+//+// $LastChangedDate: 2009-05-28 01:51:34 +0200 (Do, 28 Mai 2009) $+// $LastChangedRevision: 5988 $+// $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.crawler;++import java.io.File;+import java.io.IOException;+import java.util.Iterator;++import de.anomic.kelondro.util.FileUtils;+import de.anomic.kelondro.util.kelondroException;+import de.anomic.kelondro.util.Log;+import de.anomic.plasma.parser.Word;+import de.anomic.yacy.yacySeedDB;++public final class CrawlSwitchboard {++ public static final String CRAWL_PROFILE_PROXY = "proxy";+ public static final String CRAWL_PROFILE_REMOTE = "remote";+ public static final String CRAWL_PROFILE_SNIPPET_LOCAL_TEXT = "snippetLocalText";+ public static final String CRAWL_PROFILE_SNIPPET_GLOBAL_TEXT = "snippetGlobalText";+ public static final String CRAWL_PROFILE_SNIPPET_LOCAL_MEDIA = "snippetLocalMedia";+ public static final String CRAWL_PROFILE_SNIPPET_GLOBAL_MEDIA = "snippetGlobalMedia";+ public static final String CRAWL_PROFILE_SURROGATE = "surrogates";++ public static final String DBFILE_ACTIVE_CRAWL_PROFILES = "crawlProfilesActive.heap";+ public static final String DBFILE_PASSIVE_CRAWL_PROFILES = "crawlProfilesPassive.heap";++ public static final long CRAWL_PROFILE_PROXY_RECRAWL_CYCLE = 60L * 24L;+ public static final long CRAWL_PROFILE_SNIPPET_LOCAL_TEXT_RECRAWL_CYCLE = 60L * 24L * 30L;+ public static final long CRAWL_PROFILE_SNIPPET_GLOBAL_TEXT_RECRAWL_CYCLE = 60L * 24L * 30L;+ public static final long CRAWL_PROFILE_SNIPPET_LOCAL_MEDIA_RECRAWL_CYCLE = 60L * 24L * 30L;+ public static final long CRAWL_PROFILE_SNIPPET_GLOBAL_MEDIA_RECRAWL_CYCLE = 60L * 24L * 30L;+ public static final long CRAWL_PROFILE_SURROGATE_RECRAWL_CYCLE = 60L * 24L * 30L;++ private final Log log;+ public IndexingStack queuePreStack;+ public CrawlProfile profilesActiveCrawls, profilesPassiveCrawls;+ public CrawlProfile.entry defaultProxyProfile;+ public CrawlProfile.entry defaultRemoteProfile;+ public CrawlProfile.entry defaultTextSnippetLocalProfile, defaultTextSnippetGlobalProfile;+ public CrawlProfile.entry defaultMediaSnippetLocalProfile, defaultMediaSnippetGlobalProfile;+ public CrawlProfile.entry defaultSurrogateProfile;+ private final File queuesRoot;++ public CrawlSwitchboard(+ final yacySeedDB peers,+ final String networkName,+ final Log log,+ final File queuesRoot) throws IOException {++ log.logInfo("Initializing Word Index for the network '" + networkName + "', word hash cache size is " + Word.hashCacheSize + ".");++ if (networkName == null || networkName.length() == 0) {+ log.logSevere("no network name given - shutting down");+ System.exit(0);+ }+ this.log = log;++ // make crawl profiles database and default profiles+ this.queuesRoot = queuesRoot;+ this.queuesRoot.mkdirs();+ this.log.logConfig("Initializing Crawl Profiles");+ final File profilesActiveFile = new File(queuesRoot, DBFILE_ACTIVE_CRAWL_PROFILES);+ if (!profilesActiveFile.exists()) {+ // migrate old file+ final File oldFile = new File(new File(queuesRoot.getParentFile().getParentFile().getParentFile(), "PLASMADB"), "crawlProfilesActive1.db");+ if (oldFile.exists()) oldFile.renameTo(profilesActiveFile);+ }+ try {+ this.profilesActiveCrawls = new CrawlProfile(profilesActiveFile);+ } catch (IOException e) {+ FileUtils.deletedelete(profilesActiveFile);+ try {+ this.profilesActiveCrawls = new CrawlProfile(profilesActiveFile);+ } catch (IOException e1) {+ e1.printStackTrace();+ this.profilesActiveCrawls = null;+ }+ }+ initActiveCrawlProfiles();+ log.logInfo("Loaded active crawl profiles from file " + profilesActiveFile.getName() ++ ", " + this.profilesActiveCrawls.size() + " entries" ++ ", " + profilesActiveFile.length()/1024);+ final File profilesPassiveFile = new File(queuesRoot, DBFILE_PASSIVE_CRAWL_PROFILES);+ if (!profilesPassiveFile.exists()) {+ // migrate old file+ final File oldFile = new File(new File(queuesRoot.getParentFile().getParentFile().getParentFile(), "PLASMADB"), "crawlProfilesPassive1.db");+ if (oldFile.exists()) oldFile.renameTo(profilesPassiveFile);+ }+ try {+ this.profilesPassiveCrawls = new CrawlProfile(profilesPassiveFile);+ } catch (IOException e) {+ FileUtils.deletedelete(profilesPassiveFile);+ try {+ this.profilesPassiveCrawls = new CrawlProfile(profilesPassiveFile);+ } catch (IOException e1) {+ e1.printStackTrace();+ this.profilesPassiveCrawls = null;+ }+ }+ log.logInfo("Loaded passive crawl profiles from file " + profilesPassiveFile.getName() ++ ", " + this.profilesPassiveCrawls.size() + " entries" ++ ", " + profilesPassiveFile.length()/1024);++ // init queues+ final File preStackFile = new File(queuesRoot, "urlNoticePreStack");+ if (!preStackFile.exists()) {+ // migrate old file+ final File oldFile = new File(new File(queuesRoot.getParentFile().getParentFile().getParentFile(), "PLASMADB"), "switchboardQueue.stack");+ if (oldFile.exists()) oldFile.renameTo(preStackFile);+ }+ this.queuePreStack = new IndexingStack(peers, preStackFile, this.profilesActiveCrawls);+ }++ public void clear() {+ queuePreStack.clear();+ }++ private void initActiveCrawlProfiles() {+ this.defaultProxyProfile = null;+ this.defaultRemoteProfile = null;+ this.defaultTextSnippetLocalProfile = null;+ this.defaultTextSnippetGlobalProfile = null;+ this.defaultMediaSnippetLocalProfile = null;+ this.defaultMediaSnippetGlobalProfile = null;+ this.defaultSurrogateProfile = null;+ final Iterator<CrawlProfile.entry> i = this.profilesActiveCrawls.profiles(true);+ CrawlProfile.entry profile;+ String name;+ try {+ while (i.hasNext()) {+ profile = i.next();+ name = profile.name();+ if (name.equals(CRAWL_PROFILE_PROXY)) this.defaultProxyProfile = profile;+ if (name.equals(CRAWL_PROFILE_REMOTE)) this.defaultRemoteProfile = profile;+ if (name.equals(CRAWL_PROFILE_SNIPPET_LOCAL_TEXT)) this.defaultTextSnippetLocalProfile = profile;+ if (name.equals(CRAWL_PROFILE_SNIPPET_GLOBAL_TEXT)) this.defaultTextSnippetGlobalProfile = profile;+ if (name.equals(CRAWL_PROFILE_SNIPPET_LOCAL_MEDIA)) this.defaultMediaSnippetLocalProfile = profile;+ if (name.equals(CRAWL_PROFILE_SNIPPET_GLOBAL_MEDIA)) this.defaultMediaSnippetGlobalProfile = profile;+ if (name.equals(CRAWL_PROFILE_SURROGATE)) this.defaultSurrogateProfile = profile;+ }+ } catch (final Exception e) {+ this.profilesActiveCrawls.clear();+ this.defaultProxyProfile = null;+ this.defaultRemoteProfile = null;+ this.defaultTextSnippetLocalProfile = null;+ this.defaultTextSnippetGlobalProfile = null;+ this.defaultMediaSnippetLocalProfile = null;+ this.defaultMediaSnippetGlobalProfile = null;+ this.defaultSurrogateProfile = null;+ }++ if (this.defaultProxyProfile == null) {+ // generate new default entry for proxy crawling+ this.defaultProxyProfile = this.profilesActiveCrawls.newEntry("proxy", null, CrawlProfile.KEYWORDS_PROXY, CrawlProfile.MATCH_ALL, CrawlProfile.MATCH_NEVER,+ 0 /*Integer.parseInt(getConfig(PROXY_PREFETCH_DEPTH, "0"))*/,+ this.profilesActiveCrawls.getRecrawlDate(CRAWL_PROFILE_PROXY_RECRAWL_CYCLE), -1, -1, false,+ true /*getConfigBool(PROXY_INDEXING_LOCAL_TEXT, true)*/,+ true /*getConfigBool(PROXY_INDEXING_LOCAL_MEDIA, true)*/,+ true, true,+ false /*getConfigBool(PROXY_INDEXING_REMOTE, false)*/, true, true, true);+ }+ if (this.defaultRemoteProfile == null) {+ // generate new default entry for remote crawling+ defaultRemoteProfile = this.profilesActiveCrawls.newEntry(CRAWL_PROFILE_REMOTE, null, CrawlProfile.KEYWORDS_REMOTE, CrawlProfile.MATCH_ALL, CrawlProfile.MATCH_NEVER, 0,+ -1, -1, -1, true, true, true, false, true, false, true, true, false);+ }+ if (this.defaultTextSnippetLocalProfile == null) {+ // generate new default entry for snippet fetch and optional crawling+ defaultTextSnippetLocalProfile = this.profilesActiveCrawls.newEntry(CRAWL_PROFILE_SNIPPET_LOCAL_TEXT, null, CrawlProfile.KEYWORDS_SNIPPET, CrawlProfile.MATCH_ALL, CrawlProfile.MATCH_NEVER, 0,+ this.profilesActiveCrawls.getRecrawlDate(CRAWL_PROFILE_SNIPPET_LOCAL_TEXT_RECRAWL_CYCLE), -1, -1, true, false, false, false, false, false, true, true, false);+ }+ if (this.defaultTextSnippetGlobalProfile == null) {+ // generate new default entry for snippet fetch and optional crawling+ defaultTextSnippetGlobalProfile = this.profilesActiveCrawls.newEntry(CRAWL_PROFILE_SNIPPET_GLOBAL_TEXT, null, CrawlProfile.KEYWORDS_SNIPPET, CrawlProfile.MATCH_ALL, CrawlProfile.MATCH_NEVER, 0,+ this.profilesActiveCrawls.getRecrawlDate(CRAWL_PROFILE_SNIPPET_GLOBAL_TEXT_RECRAWL_CYCLE), -1, -1, true, true, true, true, true, false, true, true, false);+ }+ if (this.defaultMediaSnippetLocalProfile == null) {+ // generate new default entry for snippet fetch and optional crawling+ defaultMediaSnippetLocalProfile = this.profilesActiveCrawls.newEntry(CRAWL_PROFILE_SNIPPET_LOCAL_MEDIA, null, CrawlProfile.KEYWORDS_SNIPPET, CrawlProfile.MATCH_ALL, CrawlProfile.MATCH_NEVER, 0,+ this.profilesActiveCrawls.getRecrawlDate(CRAWL_PROFILE_SNIPPET_LOCAL_MEDIA_RECRAWL_CYCLE), -1, -1, true, false, false, false, false, false, true, true, false);+ }+ if (this.defaultMediaSnippetGlobalProfile == null) {+ // generate new default entry for snippet fetch and optional crawling+ defaultMediaSnippetGlobalProfile = this.profilesActiveCrawls.newEntry(CRAWL_PROFILE_SNIPPET_GLOBAL_MEDIA, null, CrawlProfile.KEYWORDS_SNIPPET, CrawlProfile.MATCH_ALL, CrawlProfile.MATCH_NEVER, 0,+ this.profilesActiveCrawls.getRecrawlDate(CRAWL_PROFILE_SNIPPET_GLOBAL_MEDIA_RECRAWL_CYCLE), -1, -1, true, false, true, true, true, false, true, true, false);+ }+ if (this.defaultSurrogateProfile == null) {+ // generate new default entry for surrogate parsing+ defaultSurrogateProfile = this.profilesActiveCrawls.newEntry(CRAWL_PROFILE_SURROGATE, null, CrawlProfile.KEYWORDS_SNIPPET, CrawlProfile.MATCH_ALL, CrawlProfile.MATCH_NEVER, 0,+ this.profilesActiveCrawls.getRecrawlDate(CRAWL_PROFILE_SURROGATE_RECRAWL_CYCLE), -1, -1, true, true, false, false, false, false, true, true, false);+ }+ }++ private void resetProfiles() {+ final File pdb = new File(this.queuesRoot, DBFILE_ACTIVE_CRAWL_PROFILES);+ if (pdb.exists()) FileUtils.deletedelete(pdb);+ try {+ profilesActiveCrawls = new CrawlProfile(pdb);+ } catch (IOException e) {+ e.printStackTrace();+ }+ initActiveCrawlProfiles();+ }+++ public boolean cleanProfiles() throws InterruptedException {+ if (queuePreStack.size() > 0) return false;+ final Iterator<CrawlProfile.entry> iter = profilesActiveCrawls.profiles(true);+ CrawlProfile.entry entry;+ boolean hasDoneSomething = false;+ try {+ while (iter.hasNext()) {+ // check for interruption+ if (Thread.currentThread().isInterrupted()) throw new InterruptedException("Shutdown in progress");++ // getting next profile+ entry = iter.next();+ if (!((entry.name().equals(CRAWL_PROFILE_PROXY)) ||+ (entry.name().equals(CRAWL_PROFILE_REMOTE)) ||+ (entry.name().equals(CRAWL_PROFILE_SNIPPET_LOCAL_TEXT)) ||+ (entry.name().equals(CRAWL_PROFILE_SNIPPET_GLOBAL_TEXT)) ||+ (entry.name().equals(CRAWL_PROFILE_SNIPPET_LOCAL_MEDIA)) ||+ (entry.name().equals(CRAWL_PROFILE_SNIPPET_GLOBAL_MEDIA)) ||+ (entry.name().equals(CRAWL_PROFILE_SURROGATE)))) {+ profilesPassiveCrawls.newEntry(entry.map());+ iter.remove();+ hasDoneSomething = true;+ }+ }+ } catch (final kelondroException e) {+ resetProfiles();+ hasDoneSomething = true;+ }+ return hasDoneSomething;+ }+++ public void close() {+ profilesActiveCrawls.close();+ queuePreStack.close();+ }++}diff --git a/source/de/anomic/crawler/FTPLoader.java b/source/de/anomic/crawler/FTPLoader.javaindex c2bf817a1..03ff28e76 100644--- a/source/de/anomic/crawler/FTPLoader.java+++ b/source/de/anomic/crawler/FTPLoader.java@@ -66,7 +66,7 @@ public class FTPLoader {Document metadata = new httpdProxyCacheEntry(entry.depth(), entry.url(), entry.name(), "OK",requestHeader, responseHeader,- entry.initiator(), sb.webIndex.profilesActiveCrawls.getEntry(entry.profileHandle()));+ entry.initiator(), sb.crawler.profilesActiveCrawls.getEntry(entry.profileHandle()));plasmaHTCache.storeMetadata(responseHeader, metadata);return metadata;}@@ -145,7 +145,7 @@ public class FTPLoader {if (berr.size() > 0 || htCache == null) {// some error loggingfinal String detail = (berr.size() > 0) ? "\n Errorlog: " + berr.toString() : "";- sb.crawlQueues.errorURL.newEntry(entry, sb.webIndex.peers().mySeed().hash, new Date(), 1, "server download" + detail);+ sb.crawlQueues.errorURL.newEntry(entry, sb.peers.mySeed().hash, new Date(), 1, "server download" + detail);throw new IOException("FTPLoader: Unable to download URL " + entry.url().toString() + detail);}@@ -243,13 +243,13 @@ public class FTPLoader {htCache.setCacheArray(b);} else {log.logInfo("REJECTED TOO BIG FILE with size " + size + " Bytes for URL " + entry.url().toString());- sb.crawlQueues.errorURL.newEntry(entry, this.sb.webIndex.peers().mySeed().hash, new Date(), 1, "file size limit exceeded");+ sb.crawlQueues.errorURL.newEntry(entry, this.sb.peers.mySeed().hash, new Date(), 1, "file size limit exceeded");throw new Exception("file size exceeds limit");}} else {// if the response has not the right file type then reject filelog.logInfo("REJECTED WRONG MIME/EXT TYPE " + mimeType + " for URL " + entry.url().toString());- sb.crawlQueues.errorURL.newEntry(entry, this.sb.webIndex.peers().mySeed().hash, new Date(), 1, "wrong mime type or wrong extension");+ sb.crawlQueues.errorURL.newEntry(entry, this.sb.peers.mySeed().hash, new Date(), 1, "wrong mime type or wrong extension");throw new Exception("response has not the right file type -> rejected");}return htCache;diff --git a/source/de/anomic/crawler/HTTPLoader.java b/source/de/anomic/crawler/HTTPLoader.javaindex 772e85a76..8e66275b3 100644--- a/source/de/anomic/crawler/HTTPLoader.java+++ b/source/de/anomic/crawler/HTTPLoader.java@@ -92,7 +92,7 @@ public final class HTTPLoader {requestHeader,responseHeader,entry.initiator(),- sb.webIndex.profilesActiveCrawls.getEntry(entry.profileHandle())+ sb.crawler.profilesActiveCrawls.getEntry(entry.profileHandle()));plasmaHTCache.storeMetadata(responseHeader, metadata);return metadata;@@ -108,7 +108,7 @@ public final class HTTPLoader {private Document load(final CrawlEntry entry, final String parserMode, final int retryCount) throws IOException {if (retryCount < 0) {- sb.crawlQueues.errorURL.newEntry(entry, sb.webIndex.peers().mySeed().hash, new Date(), 1, "redirection counter exceeded").store();+ sb.crawlQueues.errorURL.newEntry(entry, sb.peers.mySeed().hash, new Date(), 1, "redirection counter exceeded").store();throw new IOException("Redirection counter exceeded for URL " + entry.url().toString() + ". Processing aborted.");}@@ -122,7 +122,7 @@ public final class HTTPLoader {// check if url is in blacklistfinal String hostlow = host.toLowerCase();if (plasmaSwitchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_CRAWLER, hostlow, path)) {- sb.crawlQueues.errorURL.newEntry(entry, sb.webIndex.peers().mySeed().hash, new Date(), 1, "url in blacklist").store();+ sb.crawlQueues.errorURL.newEntry(entry, sb.peers.mySeed().hash, new Date(), 1, "url in blacklist").store();throw new IOException("CRAWLER Rejecting URL '" + entry.url().toString() + "'. URL is in blacklist.");}@@ -161,7 +161,7 @@ public final class HTTPLoader {// get the content length and check if the length is allowedlong contentLength = res.getResponseHeader().getContentLength();if (maxFileSize >= 0 && contentLength > maxFileSize) {- sb.crawlQueues.errorURL.newEntry(entry, sb.webIndex.peers().mySeed().hash, new Date(), 1, "file size limit exceeded");+ sb.crawlQueues.errorURL.newEntry(entry, sb.peers.mySeed().hash, new Date(), 1, "file size limit exceeded");throw new IOException("REJECTED URL " + entry.url() + " because file size '" + contentLength + "' exceeds max filesize limit of " + maxFileSize + " bytes.");}@@ -172,14 +172,14 @@ public final class HTTPLoader {// check length again in case it was not possible to get the length before loadingif (maxFileSize >= 0 && contentLength > maxFileSize) {- sb.crawlQueues.errorURL.newEntry(entry, sb.webIndex.peers().mySeed().hash, new Date(), 1, "file size limit exceeded");+ sb.crawlQueues.errorURL.newEntry(entry, sb.peers.mySeed().hash, new Date(), 1, "file size limit exceeded");throw new IOException("REJECTED URL " + entry.url() + " because file size '" + contentLength + "' exceeds max filesize limit of " + maxFileSize + " bytes.");}htCache.setCacheArray(responseBody);} else {// if the response has not the right file type then reject file- sb.crawlQueues.errorURL.newEntry(entry, sb.webIndex.peers().mySeed().hash, new Date(), 1, "wrong mime type or wrong extension");+ sb.crawlQueues.errorURL.newEntry(entry, sb.peers.mySeed().hash, new Date(), 1, "wrong mime type or wrong extension");throw new IOException("REJECTED WRONG MIME/EXT TYPE " + res.getResponseHeader().mime() + " for URL " + entry.url().toString());}return htCache;@@ -201,7 +201,7 @@ public final class HTTPLoader {redirectionUrlString = redirectionUrlString.trim();if (redirectionUrlString.length() == 0) {- sb.crawlQueues.errorURL.newEntry(entry, sb.webIndex.peers().mySeed().hash, new Date(), 1, "redirection header empy");+ sb.crawlQueues.errorURL.newEntry(entry, sb.peers.mySeed().hash, new Date(), 1, "redirection header empy");throw new IOException("CRAWLER Redirection of URL=" + entry.url().toString() + " aborted. Location header is empty.");}@@ -214,7 +214,7 @@ public final class HTTPLoader {// if we are already doing a shutdown we don't need to retry crawlingif (Thread.currentThread().isInterrupted()) {- sb.crawlQueues.errorURL.newEntry(entry, sb.webIndex.peers().mySeed().hash, new Date(), 1, "server shutdown");+ sb.crawlQueues.errorURL.newEntry(entry, sb.peers.mySeed().hash, new Date(), 1, "server shutdown");throw new IOException("CRAWLER Retry of URL=" + entry.url().toString() + " aborted because of server shutdown.");}@@ -224,7 +224,7 @@ public final class HTTPLoader {// check if the url was already indexedfinal String dbname = sb.urlExists(urlhash);if (dbname != null) {- sb.crawlQueues.errorURL.newEntry(entry, sb.webIndex.peers().mySeed().hash, new Date(), 1, "redirection to double content");+ sb.crawlQueues.errorURL.newEntry(entry, sb.peers.mySeed().hash, new Date(), 1, "redirection to double content");throw new IOException("CRAWLER Redirection of URL=" + entry.url().toString() + " ignored. The url appears already in db " + dbname);}@@ -234,7 +234,7 @@ public final class HTTPLoader {}} else {// if the response has not the right response type then reject file- sb.crawlQueues.errorURL.newEntry(entry, sb.webIndex.peers().mySeed().hash, new Date(), 1, "wrong http status code " + res.getStatusCode() + ")");+ sb.crawlQueues.errorURL.newEntry(entry, sb.peers.mySeed().hash, new Date(), 1, "wrong http status code " + res.getStatusCode() + ")");throw new IOException("REJECTED WRONG STATUS TYPE '" + res.getStatusLine() + "' for URL " + entry.url().toString());}} finally {diff --git a/source/de/anomic/crawler/IndexingStack.java b/source/de/anomic/crawler/IndexingStack.javaindex 0b4411d6f..070c3496a 100644--- a/source/de/anomic/crawler/IndexingStack.java+++ b/source/de/anomic/crawler/IndexingStack.java@@ -39,12 +39,12 @@ import de.anomic.kelondro.index.Row;import de.anomic.kelondro.order.Base64Order;import de.anomic.kelondro.order.NaturalOrder;import de.anomic.kelondro.table.Stack;+import de.anomic.kelondro.text.MetadataRepository;import de.anomic.kelondro.text.metadataPrototype.URLMetadataRow;import de.anomic.kelondro.util.DateFormatter;import de.anomic.kelondro.util.Log;import de.anomic.plasma.plasmaHTCache;import de.anomic.plasma.plasmaSwitchboardConstants;-import de.anomic.plasma.plasmaWordIndex;import de.anomic.yacy.yacySeed;import de.anomic.yacy.yacySeedDB;import de.anomic.yacy.yacyURL;@@ -53,12 +53,12 @@ public class IndexingStack {private final Stack sbQueueStack;private final CrawlProfile profiles;- private final plasmaWordIndex wordIndex;+ private final yacySeedDB peers;private final ConcurrentHashMap<String, QueueEntry> queueInProcess;- public IndexingStack(final plasmaWordIndex wordIndex, final File sbQueueStackPath, final CrawlProfile profiles) {+ public IndexingStack(final yacySeedDB peers, final File sbQueueStackPath, final CrawlProfile profiles) {this.profiles = profiles;- this.wordIndex = wordIndex;+ this.peers = peers;this.queueInProcess = new ConcurrentHashMap<String, QueueEntry>();this.sbQueueStack = Stack.open(sbQueueStackPath, rowdef);}@@ -327,12 +327,12 @@ public class IndexingStack {public yacySeed initiatorPeer() {if ((initiator == null) || (initiator.length() == 0)) return null;- if (initiator.equals(wordIndex.peers().mySeed().hash)) {+ if (initiator.equals(peers.mySeed().hash)) {// normal crawlingreturn null;}// this was done for remote peer (a global crawl)- return wordIndex.peers().getConnected(initiator);+ return peers.getConnected(initiator);}public int depth() {@@ -371,11 +371,11 @@ public class IndexingStack {return (responseHeader == null) ? new Date() : responseHeader.lastModified();}- public yacyURL referrerURL() {+ public yacyURL referrerURL(MetadataRepository repository) {if (referrerURL == null) {// FIXME the equals seems to be incorrect: String.equals(boolean)if ((referrerHash == null) || ((initiator != null) && (referrerHash.equals(initiator.length() == 0)))) return null;- final URLMetadataRow entry = wordIndex.metadata().load(referrerHash, null, 0);+ final URLMetadataRow entry = repository.load(referrerHash, null, 0);if (entry == null) referrerURL = null; else referrerURL = entry.metadata().url();}return referrerURL;@@ -402,7 +402,7 @@ public class IndexingStack {if ((initiator == null) || initiator.length() == 0 || initiator.equals("------------")) {// proxy-loadprocessCase = plasmaSwitchboardConstants.PROCESSCASE_4_PROXY_LOAD;- } else if (initiator.equals(wordIndex.peers().mySeed().hash)) {+ } else if (initiator.equals(peers.mySeed().hash)) {// normal crawlingprocessCase = plasmaSwitchboardConstants.PROCESSCASE_5_LOCAL_CRAWLING;} else {diff --git a/source/de/anomic/crawler/NoticeURLImporter.java b/source/de/anomic/crawler/NoticeURLImporter.javaindex adfe7d2c1..81e829203 100644--- a/source/de/anomic/crawler/NoticeURLImporter.java+++ b/source/de/anomic/crawler/NoticeURLImporter.java@@ -7,7 +7,7 @@ import java.util.HashSet;import java.util.Iterator;import de.anomic.kelondro.util.FileUtils;-import de.anomic.plasma.plasmaWordIndex;+import de.anomic.crawler.CrawlSwitchboard;public class NoticeURLImporter extends AbstractImporter implements Importer {@@ -31,7 +31,7 @@ public class NoticeURLImporter extends AbstractImporter implements Importer {// TODO: we need more error handling herethis.plasmaPath = crawlerPath;final File noticeUrlDbFile = new File(plasmaPath,"urlNotice1.db");- final File profileDbFile = new File(plasmaPath, plasmaWordIndex.DBFILE_ACTIVE_CRAWL_PROFILES);+ final File profileDbFile = new File(plasmaPath, CrawlSwitchboard.DBFILE_ACTIVE_CRAWL_PROFILES);String errorMsg = null;if (!plasmaPath.exists())diff --git a/source/de/anomic/crawler/ResourceObserver.java b/source/de/anomic/crawler/ResourceObserver.javaindex 569e1f4fd..334e12f75 100644--- a/source/de/anomic/crawler/ResourceObserver.java+++ b/source/de/anomic/crawler/ResourceObserver.java@@ -131,7 +131,7 @@ public final class ResourceObserver {if (tmpDisksFree == LOW && sb.getConfigBool(plasmaSwitchboardConstants.INDEX_RECEIVE_ALLOW, false)) {log.logInfo("disabling index receive");sb.setConfig(plasmaSwitchboardConstants.INDEX_RECEIVE_ALLOW, false);- sb.webIndex.peers().mySeed().setFlagAcceptRemoteIndex(false);+ sb.peers.mySeed().setFlagAcceptRemoteIndex(false);}}else {diff --git a/source/de/anomic/data/SitemapParser.java b/source/de/anomic/data/SitemapParser.javaindex 60a2d00bd..86e6f96b9 100644--- a/source/de/anomic/data/SitemapParser.java+++ b/source/de/anomic/data/SitemapParser.java@@ -260,7 +260,7 @@ public class SitemapParser extends DefaultHandler {final String dbocc = this.sb.urlExists(nexturlhash);if ((dbocc != null) && (dbocc.equalsIgnoreCase("loaded"))) {// the url was already loaded. we need to check the date- final URLMetadataRow oldEntry = this.sb.webIndex.metadata().load(nexturlhash, null, 0);+ final URLMetadataRow oldEntry = this.sb.indexSegment.metadata().load(nexturlhash, null, 0);if (oldEntry != null) {final Date modDate = oldEntry.moddate();// check if modDate is null@@ -272,7 +272,7 @@ public class SitemapParser extends DefaultHandler {// URL needs to crawledthis.sb.crawlStacker.enqueueEntry(new CrawlEntry(- this.sb.webIndex.peers().mySeed().hash,+ this.sb.peers.mySeed().hash,url,null, // this.siteMapURL.toString(),this.nextURL,@@ -307,7 +307,7 @@ public class SitemapParser extends DefaultHandler {}private CrawlProfile.entry createProfile(final String domainName, final yacyURL sitemapURL) {- return this.sb.webIndex.profilesActiveCrawls.newEntry(+ return this.sb.crawler.profilesActiveCrawls.newEntry(domainName, sitemapURL, CrawlProfile.KEYWORDS_USER,// crawling FilterCrawlProfile.MATCH_ALL, CrawlProfile.MATCH_NEVER,diff --git a/source/de/anomic/data/URLAnalysis.java b/source/de/anomic/data/URLAnalysis.javaindex 02e519522..e91db4291 100644--- a/source/de/anomic/data/URLAnalysis.java+++ b/source/de/anomic/data/URLAnalysis.java@@ -55,11 +55,11 @@ import de.anomic.kelondro.index.IntegerHandleIndex;import de.anomic.kelondro.order.Base64Order;import de.anomic.kelondro.text.MetadataRepository;import de.anomic.kelondro.text.ReferenceContainerArray;+import de.anomic.kelondro.text.Segment;import de.anomic.kelondro.text.MetadataRepository.Export;import de.anomic.kelondro.text.metadataPrototype.URLMetadataRow;import de.anomic.kelondro.text.referencePrototype.WordReferenceRow;import de.anomic.kelondro.util.MemoryControl;-import de.anomic.plasma.plasmaWordIndex;import de.anomic.yacy.yacyURL;public class URLAnalysis {@@ -398,7 +398,7 @@ public class URLAnalysis {try {IntegerHandleIndex idx = ReferenceContainerArray.referenceHashes(cellPath,- plasmaWordIndex.wordReferenceFactory,+ Segment.wordReferenceFactory,Base64Order.enhancedCoder,WordReferenceRow.urlEntryRow);System.out.println("INDEX REFERENCE COLLECTION starting dump of statistics");diff --git a/source/de/anomic/data/bookmarksDB.java b/source/de/anomic/data/bookmarksDB.javaindex 1d07eac2f..df764d5bc 100644--- a/source/de/anomic/data/bookmarksDB.java+++ b/source/de/anomic/data/bookmarksDB.java@@ -247,23 +247,23 @@ public class bookmarksDB {Pattern.compile(newcrawlingMustMatch);String urlhash = crawlingStartURL.hash();- sb.webIndex.metadata().remove(urlhash);+ sb.indexSegment.metadata().remove(urlhash);sb.crawlQueues.noticeURL.removeByURLHash(urlhash);sb.crawlQueues.errorURL.remove(urlhash);// stack url- sb.webIndex.profilesPassiveCrawls.removeEntry(crawlingStartURL.hash()); // if there is an old entry, delete it- CrawlProfile.entry pe = sb.webIndex.profilesActiveCrawls.newEntry(+ sb.crawler.profilesPassiveCrawls.removeEntry(crawlingStartURL.hash()); // if there is an old entry, delete it+ CrawlProfile.entry pe = sb.crawler.profilesActiveCrawls.newEntry(folder+"/"+crawlingStartURL, crawlingStartURL, CrawlProfile.KEYWORDS_USER,newcrawlingMustMatch,CrawlProfile.MATCH_NEVER,newcrawlingdepth,- sb.webIndex.profilesActiveCrawls.getRecrawlDate(crawlingIfOlder), crawlingDomFilterDepth, crawlingDomMaxPages,+ sb.crawler.profilesActiveCrawls.getRecrawlDate(crawlingIfOlder), crawlingDomFilterDepth, crawlingDomMaxPages,crawlingQ,indexText, indexMedia,storeHTCache, true, crawlOrder, xsstopw, xdstopw, xpstopw);sb.crawlStacker.enqueueEntry(new CrawlEntry(- sb.webIndex.peers().mySeed().hash,+ sb.peers.mySeed().hash,crawlingStartURL,null,"CRAWLING-ROOT",@@ -291,7 +291,7 @@ public class bookmarksDB {m.remove("generalFilter");m.remove("specificFilter");m.put("intention", "Automatic ReCrawl!");- sb.webIndex.peers().newsPool.publishMyNews(yacyNewsRecord.newRecord(sb.webIndex.peers().mySeed(), yacyNewsPool.CATEGORY_CRAWL_START, m));+ sb.peers.newsPool.publishMyNews(yacyNewsRecord.newRecord(sb.peers.mySeed(), yacyNewsPool.CATEGORY_CRAWL_START, m));}} catch (MalformedURLException e1) {}} // ifdiff --git a/source/de/anomic/data/wiki/knwikiParser.java b/source/de/anomic/data/wiki/knwikiParser.javaindex c50bcc557..4219d42ec 100644--- a/source/de/anomic/data/wiki/knwikiParser.java+++ b/source/de/anomic/data/wiki/knwikiParser.java@@ -126,7 +126,7 @@ public class knwikiParser implements wikiParser {tokens = new Token[] {new SimpleToken('=', '=', new String[][] { null, { "h2" }, { "h3" }, { "h4" } }, true),new SimpleToken('\'', '\'', new String[][] { null, { "i" }, { "b" }, null, { "b", "i" } }, false),- new LinkToken((publicAddress == null) ? sb.webIndex.peers().mySeed().getPublicAddress() : publicAddress, "Wiki.html?page=", sb),+ new LinkToken((publicAddress == null) ? sb.peers.mySeed().getPublicAddress() : publicAddress, "Wiki.html?page=", sb),new ListToken('*', "ul"),new ListToken('#', "ol"),new ListToken(':', "blockquote", null),diff --git a/source/de/anomic/http/httpdFileHandler.java b/source/de/anomic/http/httpdFileHandler.javaindex ef1a0e3af..ea142efab 100644--- a/source/de/anomic/http/httpdFileHandler.java+++ b/source/de/anomic/http/httpdFileHandler.java@@ -787,7 +787,7 @@ public final class httpdFileHandler {templatePatterns.put(servletProperties.PEER_STAT_VERSION, switchboard.getConfig("version", ""));templatePatterns.put(servletProperties.PEER_STAT_UPTIME, ((System.currentTimeMillis() - serverCore.startupTime) / 1000) / 60); // uptime in minutestemplatePatterns.putHTML(servletProperties.PEER_STAT_CLIENTNAME, switchboard.getConfig("peerName", "anomic"));- templatePatterns.putHTML(servletProperties.PEER_STAT_CLIENTID, ((plasmaSwitchboard) switchboard).webIndex.peers().myID());+ templatePatterns.putHTML(servletProperties.PEER_STAT_CLIENTID, ((plasmaSwitchboard) switchboard).peers.myID());templatePatterns.put(servletProperties.PEER_STAT_MYTIME, DateFormatter.formatShortSecond());//System.out.println("respond props: " + ((tp == null) ? "null" : tp.toString())); // debug} catch (final InvocationTargetException e) {diff --git a/source/de/anomic/http/httpdProxyHandler.java b/source/de/anomic/http/httpdProxyHandler.javaindex e3851d6ca..6c6488c02 100644--- a/source/de/anomic/http/httpdProxyHandler.java+++ b/source/de/anomic/http/httpdProxyHandler.java@@ -394,7 +394,7 @@ public final class httpdProxyHandler {requestHeader,cachedResponseHeader,null, // initiator- sb.webIndex.defaultProxyProfile // profile+ sb.crawler.defaultProxyProfile // profile);plasmaHTCache.storeMetadata(cachedResponseHeader, cacheEntry); // TODO: check if this storeMetadata is necessary@@ -507,7 +507,7 @@ public final class httpdProxyHandler {requestHeader,responseHeader,null,- sb.webIndex.defaultProxyProfile+ sb.crawler.defaultProxyProfile);plasmaHTCache.storeMetadata(responseHeader, cacheEntry);diff --git a/source/de/anomic/icap/icapd.java b/source/de/anomic/icap/icapd.javaindex 4f6fc105e..b4ebcfa8f 100644--- a/source/de/anomic/icap/icapd.java+++ b/source/de/anomic/icap/icapd.java@@ -384,7 +384,7 @@ public class icapd implements serverHandler, Cloneable {httpRespStatusLine,httpReqHeader, httpResHeader,null,- sb.webIndex.defaultProxyProfile+ sb.crawler.defaultProxyProfile);// copy the response body into the filediff --git a/source/de/anomic/plasma/plasmaWordIndex.java b/source/de/anomic/kelondro/text/Segment.javasimilarity index 50%rename from source/de/anomic/plasma/plasmaWordIndex.javarename to source/de/anomic/kelondro/text/Segment.javaindex 8b4430cae..215b37f97 100644--- a/source/de/anomic/plasma/plasmaWordIndex.java+++ b/source/de/anomic/kelondro/text/Segment.java@@ -1,679 +1,411 @@-// plasmaWordIndex.java-// (C) 2005, 2006 by Michael Peter Christen; [email protected], Frankfurt a. M., Germany-// first published 2005 on http://www.anomic.de-//-// This is a part of YaCy, a peer-to-peer based web search engine-//-// $LastChangedDate$-// $LastChangedRevision$-// $LastChangedBy$-//-// 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.plasma;--import java.io.File;-import java.io.IOException;-import java.util.Date;-import java.util.HashMap;-import java.util.HashSet;-import java.util.Iterator;-import java.util.Map;-import java.util.Set;-import java.util.TreeSet;--import de.anomic.content.RSSMessage;-import de.anomic.crawler.CrawlProfile;-import de.anomic.crawler.IndexingStack;-import de.anomic.data.Blacklist;-import de.anomic.htmlFilter.htmlFilterContentScraper;-import de.anomic.http.httpdProxyCacheEntry;-import de.anomic.kelondro.order.Base64Order;-import de.anomic.kelondro.order.ByteOrder;-import de.anomic.kelondro.text.BufferedIndex;-import de.anomic.kelondro.text.IndexCell;-import de.anomic.kelondro.text.ReferenceContainer;-import de.anomic.kelondro.text.IODispatcher;-import de.anomic.kelondro.text.MetadataRepository;-import de.anomic.kelondro.text.ReferenceFactory;-import de.anomic.kelondro.text.metadataPrototype.URLMetadataRow;-import de.anomic.kelondro.text.referencePrototype.WordReference;-import de.anomic.kelondro.text.referencePrototype.WordReferenceFactory;-import de.anomic.kelondro.text.referencePrototype.WordReferenceRow;-import de.anomic.kelondro.util.FileUtils;-import de.anomic.kelondro.util.kelondroException;-import de.anomic.kelondro.util.Log;-import de.anomic.plasma.parser.Word;-import de.anomic.plasma.parser.Condenser;-import de.anomic.tools.iso639;-import de.anomic.xml.RSSFeed;-import de.anomic.yacy.yacySeedDB;-import de.anomic.yacy.yacyURL;--public final class plasmaWordIndex {-- // environment constants- public static final long wCacheMaxAge = 1000 * 60 * 30; // milliseconds; 30 minutes- public static final int wCacheMaxChunk = 800; // maximum number of references for each urlhash- public static final int lowcachedivisor = 900;- public static final long targetFileSize = 256 * 1024 * 1024; // 256 MB- public static final int writeBufferSize = 4 * 1024 * 1024;-- // the reference factory- public static final ReferenceFactory<WordReference> wordReferenceFactory = new WordReferenceFactory();-- public static final String CRAWL_PROFILE_PROXY = "proxy";- public static final String CRAWL_PROFILE_REMOTE = "remote";- public static final String CRAWL_PROFILE_SNIPPET_LOCAL_TEXT = "snippetLocalText";- public static final String CRAWL_PROFILE_SNIPPET_GLOBAL_TEXT = "snippetGlobalText";- public static final String CRAWL_PROFILE_SNIPPET_LOCAL_MEDIA = "snippetLocalMedia";- public static final String CRAWL_PROFILE_SNIPPET_GLOBAL_MEDIA = "snippetGlobalMedia";- public static final String CRAWL_PROFILE_SURROGATE = "surrogates";-- public static final String DBFILE_ACTIVE_CRAWL_PROFILES = "crawlProfilesActive.heap";- public static final String DBFILE_PASSIVE_CRAWL_PROFILES = "crawlProfilesPassive.heap";-- public static final long CRAWL_PROFILE_PROXY_RECRAWL_CYCLE = 60L * 24L;- public static final long CRAWL_PROFILE_SNIPPET_LOCAL_TEXT_RECRAWL_CYCLE = 60L * 24L * 30L;- public static final long CRAWL_PROFILE_SNIPPET_GLOBAL_TEXT_RECRAWL_CYCLE = 60L * 24L * 30L;- public static final long CRAWL_PROFILE_SNIPPET_LOCAL_MEDIA_RECRAWL_CYCLE = 60L * 24L * 30L;- public static final long CRAWL_PROFILE_SNIPPET_GLOBAL_MEDIA_RECRAWL_CYCLE = 60L * 24L * 30L;- public static final long CRAWL_PROFILE_SURROGATE_RECRAWL_CYCLE = 60L * 24L * 30L;-- public static final ByteOrder wordOrder = Base64Order.enhancedCoder;-- private final IndexCell<WordReference> index;- private final Log log;- private MetadataRepository metadata;- private final yacySeedDB peers;- private final File primaryRoot, secondaryRoot;- public IndexingStack queuePreStack;- public CrawlProfile profilesActiveCrawls, profilesPassiveCrawls;- public CrawlProfile.entry defaultProxyProfile;- public CrawlProfile.entry defaultRemoteProfile;- public CrawlProfile.entry defaultTextSnippetLocalProfile, defaultTextSnippetGlobalProfile;- public CrawlProfile.entry defaultMediaSnippetLocalProfile, defaultMediaSnippetGlobalProfile;- public CrawlProfile.entry defaultSurrogateProfile;- private final File queuesRoot;- private IODispatcher<WordReference> merger;-- public plasmaWordIndex(- final String networkName,- final Log log,- final File indexPrimaryRoot,- final File indexSecondaryRoot,- final int entityCacheMaxSize,- final long maxFileSize,- final int redundancy,- final int partitionExponent) throws IOException {-- log.logInfo("Initializing Word Index for the network '" + networkName + "', word hash cache size is " + Word.hashCacheSize + ".");-- if (networkName == null || networkName.length() == 0) {- log.logSevere("no network name given - shutting down");- System.exit(0);- }- this.log = log;- this.primaryRoot = new File(indexPrimaryRoot, networkName);- this.secondaryRoot = new File(indexSecondaryRoot, networkName);- File indexPrimaryTextLocation = new File(this.primaryRoot, "TEXT");- if (!indexPrimaryTextLocation.exists()) {- // patch old index locations; the secondary path is patched in plasmaCrawlLURL- final File oldPrimaryPath = new File(new File(indexPrimaryRoot, "PUBLIC"), "TEXT");- final File oldPrimaryTextLocation = new File(new File(indexPrimaryRoot, "PUBLIC"), "TEXT");- if (oldPrimaryPath.exists() && oldPrimaryTextLocation.exists()) {- // move the text folder from the old location to the new location- assert !indexPrimaryTextLocation.exists();- indexPrimaryTextLocation.mkdirs();- if (oldPrimaryTextLocation.renameTo(indexPrimaryTextLocation)) {- FileUtils.deletedelete(oldPrimaryPath);- } else {- indexPrimaryTextLocation = oldPrimaryTextLocation; // emergency case: stay with old directory- }- }- }-- this.merger = new IODispatcher<WordReference>(plasmaWordIndex.wordReferenceFactory, 1, 1, writeBufferSize);- this.merger.start();- this.index = new IndexCell<WordReference>(- new File(indexPrimaryTextLocation, "RICELL"),- wordReferenceFactory,- wordOrder,- WordReferenceRow.urlEntryRow,- entityCacheMaxSize,- targetFileSize,- maxFileSize,- this.merger,- writeBufferSize);-- // migrate LURL-db files into new subdirectory METADATA- File textdir = new File(this.secondaryRoot, "TEXT");- File metadatadir = new File(textdir, "METADATA");- if (!metadatadir.exists()) metadatadir.mkdirs();- String[] l = textdir.list();- for (int i = 0; i < l.length; i++) {- if (l[i].startsWith("urls.")) (new File(textdir, l[i])).renameTo(new File(metadatadir, l[i]));- }- // create LURL-db- metadata = new MetadataRepository(metadatadir);-- // make crawl profiles database and default profiles- this.queuesRoot = new File(this.primaryRoot, "QUEUES");- this.queuesRoot.mkdirs();- this.log.logConfig("Initializing Crawl Profiles");- final File profilesActiveFile = new File(queuesRoot, DBFILE_ACTIVE_CRAWL_PROFILES);- if (!profilesActiveFile.exists()) {- // migrate old file- final File oldFile = new File(new File(queuesRoot.getParentFile().getParentFile().getParentFile(), "PLASMADB"), "crawlProfilesActive1.db");- if (oldFile.exists()) oldFile.renameTo(profilesActiveFile);- }- try {- this.profilesActiveCrawls = new CrawlProfile(profilesActiveFile);- } catch (IOException e) {- FileUtils.deletedelete(profilesActiveFile);- try {- this.profilesActiveCrawls = new CrawlProfile(profilesActiveFile);- } catch (IOException e1) {- e1.printStackTrace();- this.profilesActiveCrawls = null;- }- }- initActiveCrawlProfiles();- log.logInfo("Loaded active crawl profiles from file " + profilesActiveFile.getName() +- ", " + this.profilesActiveCrawls.size() + " entries" +- ", " + profilesActiveFile.length()/1024);- final File profilesPassiveFile = new File(queuesRoot, DBFILE_PASSIVE_CRAWL_PROFILES);- if (!profilesPassiveFile.exists()) {- // migrate old file- final File oldFile = new File(new File(queuesRoot.getParentFile().getParentFile().getParentFile(), "PLASMADB"), "crawlProfilesPassive1.db");- if (oldFile.exists()) oldFile.renameTo(profilesPassiveFile);- }- try {- this.profilesPassiveCrawls = new CrawlProfile(profilesPassiveFile);- } catch (IOException e) {- FileUtils.deletedelete(profilesPassiveFile);- try {- this.profilesPassiveCrawls = new CrawlProfile(profilesPassiveFile);- } catch (IOException e1) {- e1.printStackTrace();- this.profilesPassiveCrawls = null;- }- }- log.logInfo("Loaded passive crawl profiles from file " + profilesPassiveFile.getName() +- ", " + this.profilesPassiveCrawls.size() + " entries" +- ", " + profilesPassiveFile.length()/1024);-- // init queues- final File preStackFile = new File(queuesRoot, "urlNoticePreStack");- if (!preStackFile.exists()) {- // migrate old file- final File oldFile = new File(new File(queuesRoot.getParentFile().getParentFile().getParentFile(), "PLASMADB"), "switchboardQueue.stack");- if (oldFile.exists()) oldFile.renameTo(preStackFile);- }- this.queuePreStack = new IndexingStack(this, preStackFile, this.profilesActiveCrawls);-- // create or init seed cache- final File networkRoot = new File(this.primaryRoot, "NETWORK");- networkRoot.mkdirs();- final File mySeedFile = new File(networkRoot, yacySeedDB.DBFILE_OWN_SEED);- final File oldSeedFile = new File(new File(indexPrimaryRoot.getParentFile(), "YACYDB"), "mySeed.txt");- if (oldSeedFile.exists()) oldSeedFile.renameTo(mySeedFile);- peers = new yacySeedDB(- networkRoot,- "seed.new.heap",- "seed.old.heap",- "seed.pot.heap",- mySeedFile,- redundancy,- partitionExponent);- }-- public MetadataRepository metadata() {- return this.metadata;- }-- public yacySeedDB peers() {- return this.peers;- }-- public IndexCell<WordReference> index() {- return this.index;- }-- public void clear() {- try {- index.clear();- metadata.clear();- } catch (final IOException e) {- e.printStackTrace();- }- queuePreStack.clear();- }-- private void initActiveCrawlProfiles() {- this.defaultProxyProfile = null;- this.defaultRemoteProfile = null;- this.defaultTextSnippetLocalProfile = null;- this.defaultTextSnippetGlobalProfile = null;- this.defaultMediaSnippetLocalProfile = null;- this.defaultMediaSnippetGlobalProfile = null;- this.defaultSurrogateProfile = null;- final Iterator<CrawlProfile.entry> i = this.profilesActiveCrawls.profiles(true);- CrawlProfile.entry profile;- String name;- try {- while (i.hasNext()) {- profile = i.next();- name = profile.name();- if (name.equals(CRAWL_PROFILE_PROXY)) this.defaultProxyProfile = profile;- if (name.equals(CRAWL_PROFILE_REMOTE)) this.defaultRemoteProfile = profile;- if (name.equals(CRAWL_PROFILE_SNIPPET_LOCAL_TEXT)) this.defaultTextSnippetLocalProfile = profile;- if (name.equals(CRAWL_PROFILE_SNIPPET_GLOBAL_TEXT)) this.defaultTextSnippetGlobalProfile = profile;- if (name.equals(CRAWL_PROFILE_SNIPPET_LOCAL_MEDIA)) this.defaultMediaSnippetLocalProfile = profile;- if (name.equals(CRAWL_PROFILE_SNIPPET_GLOBAL_MEDIA)) this.defaultMediaSnippetGlobalProfile = profile;- if (name.equals(CRAWL_PROFILE_SURROGATE)) this.defaultSurrogateProfile = profile;- }- } catch (final Exception e) {- this.profilesActiveCrawls.clear();- this.defaultProxyProfile = null;- this.defaultRemoteProfile = null;- this.defaultTextSnippetLocalProfile = null;- this.defaultTextSnippetGlobalProfile = null;- this.defaultMediaSnippetLocalProfile = null;- this.defaultMediaSnippetGlobalProfile = null;- this.defaultSurrogateProfile = null;- }-- if (this.defaultProxyProfile == null) {- // generate new default entry for proxy crawling- this.defaultProxyProfile = this.profilesActiveCrawls.newEntry("proxy", null, CrawlProfile.KEYWORDS_PROXY, CrawlProfile.MATCH_ALL, CrawlProfile.MATCH_NEVER,- 0 /*Integer.parseInt(getConfig(PROXY_PREFETCH_DEPTH, "0"))*/,- this.profilesActiveCrawls.getRecrawlDate(CRAWL_PROFILE_PROXY_RECRAWL_CYCLE), -1, -1, false,- true /*getConfigBool(PROXY_INDEXING_LOCAL_TEXT, true)*/,- true /*getConfigBool(PROXY_INDEXING_LOCAL_MEDIA, true)*/,- true, true,- false /*getConfigBool(PROXY_INDEXING_REMOTE, false)*/, true, true, true);- }- if (this.defaultRemoteProfile == null) {- // generate new default entry for remote crawling- defaultRemoteProfile = this.profilesActiveCrawls.newEntry(CRAWL_PROFILE_REMOTE, null, CrawlProfile.KEYWORDS_REMOTE, CrawlProfile.MATCH_ALL, CrawlProfile.MATCH_NEVER, 0,- -1, -1, -1, true, true, true, false, true, false, true, true, false);- }- if (this.defaultTextSnippetLocalProfile == null) {- // generate new default entry for snippet fetch and optional crawling- defaultTextSnippetLocalProfile = this.profilesActiveCrawls.newEntry(CRAWL_PROFILE_SNIPPET_LOCAL_TEXT, null, CrawlProfile.KEYWORDS_SNIPPET, CrawlProfile.MATCH_ALL, CrawlProfile.MATCH_NEVER, 0,- this.profilesActiveCrawls.getRecrawlDate(CRAWL_PROFILE_SNIPPET_LOCAL_TEXT_RECRAWL_CYCLE), -1, -1, true, false, false, false, false, false, true, true, false);- }- if (this.defaultTextSnippetGlobalProfile == null) {- // generate new default entry for snippet fetch and optional crawling- defaultTextSnippetGlobalProfile = this.profilesActiveCrawls.newEntry(CRAWL_PROFILE_SNIPPET_GLOBAL_TEXT, null, CrawlProfile.KEYWORDS_SNIPPET, CrawlProfile.MATCH_ALL, CrawlProfile.MATCH_NEVER, 0,- this.profilesActiveCrawls.getRecrawlDate(CRAWL_PROFILE_SNIPPET_GLOBAL_TEXT_RECRAWL_CYCLE), -1, -1, true, true, true, true, true, false, true, true, false);- }- if (this.defaultMediaSnippetLocalProfile == null) {- // generate new default entry for snippet fetch and optional crawling- defaultMediaSnippetLocalProfile = this.profilesActiveCrawls.newEntry(CRAWL_PROFILE_SNIPPET_LOCAL_MEDIA, null, CrawlProfile.KEYWORDS_SNIPPET, CrawlProfile.MATCH_ALL, CrawlProfile.MATCH_NEVER, 0,- this.profilesActiveCrawls.getRecrawlDate(CRAWL_PROFILE_SNIPPET_LOCAL_MEDIA_RECRAWL_CYCLE), -1, -1, true, false, false, false, false, false, true, true, false);- }- if (this.defaultMediaSnippetGlobalProfile == null) {- // generate new default entry for snippet fetch and optional crawling- defaultMediaSnippetGlobalProfile = this.profilesActiveCrawls.newEntry(CRAWL_PROFILE_SNIPPET_GLOBAL_MEDIA, null, CrawlProfile.KEYWORDS_SNIPPET, CrawlProfile.MATCH_ALL, CrawlProfile.MATCH_NEVER, 0,- this.profilesActiveCrawls.getRecrawlDate(CRAWL_PROFILE_SNIPPET_GLOBAL_MEDIA_RECRAWL_CYCLE), -1, -1, true, false, true, true, true, false, true, true, false);- }- if (this.defaultSurrogateProfile == null) {- // generate new default entry for surrogate parsing- defaultSurrogateProfile = this.profilesActiveCrawls.newEntry(CRAWL_PROFILE_SURROGATE, null, CrawlProfile.KEYWORDS_SNIPPET, CrawlProfile.MATCH_ALL, CrawlProfile.MATCH_NEVER, 0,- this.profilesActiveCrawls.getRecrawlDate(CRAWL_PROFILE_SURROGATE_RECRAWL_CYCLE), -1, -1, true, true, false, false, false, false, true, true, false);- }- }-- private void resetProfiles() {- final File pdb = new File(this.queuesRoot, DBFILE_ACTIVE_CRAWL_PROFILES);- if (pdb.exists()) FileUtils.deletedelete(pdb);- try {- profilesActiveCrawls = new CrawlProfile(pdb);- } catch (IOException e) {- e.printStackTrace();- }- initActiveCrawlProfiles();- }--- public boolean cleanProfiles() throws InterruptedException {- if (queuePreStack.size() > 0) return false;- final Iterator<CrawlProfile.entry> iter = profilesActiveCrawls.profiles(true);- CrawlProfile.entry entry;- boolean hasDoneSomething = false;- try {- while (iter.hasNext()) {- // check for interruption- if (Thread.currentThread().isInterrupted()) throw new InterruptedException("Shutdown in progress");-- // getting next profile- entry = iter.next();- if (!((entry.name().equals(CRAWL_PROFILE_PROXY)) ||- (entry.name().equals(CRAWL_PROFILE_REMOTE)) ||- (entry.name().equals(CRAWL_PROFILE_SNIPPET_LOCAL_TEXT)) ||- (entry.name().equals(CRAWL_PROFILE_SNIPPET_GLOBAL_TEXT)) ||- (entry.name().equals(CRAWL_PROFILE_SNIPPET_LOCAL_MEDIA)) ||- (entry.name().equals(CRAWL_PROFILE_SNIPPET_GLOBAL_MEDIA)) ||- (entry.name().equals(CRAWL_PROFILE_SURROGATE)))) {- profilesPassiveCrawls.newEntry(entry.map());- iter.remove();- hasDoneSomething = true;- }- }- } catch (final kelondroException e) {- resetProfiles();- hasDoneSomething = true;- }- return hasDoneSomething;- }-- public File getLocation(final boolean primary) {- return (primary) ? this.primaryRoot : this.secondaryRoot;- }-- /**- * this is called by the switchboard to put in a new page into the index- * use all the words in one condenser object to simultanous create index entries- *- * @param url- * @param urlModified- * @param document- * @param condenser- * @param language- * @param doctype- * @param outlinksSame- * @param outlinksOther- * @return- */- public int addPageIndex(final yacyURL url, final Date urlModified, final plasmaParserDocument document, final Condenser condenser, final String language, final char doctype, final int outlinksSame, final int outlinksOther) {- int wordCount = 0;- final int urlLength = url.toNormalform(true, true).length();- final int urlComps = htmlFilterContentScraper.urlComps(url.toString()).length;-- // iterate over all words of context text- final Iterator<Map.Entry<String, Word>> i = condenser.words().entrySet().iterator();- Map.Entry<String, Word> wentry;- String word;- int len = (document == null) ? urlLength : document.dc_title().length();- WordReferenceRow ientry = new WordReferenceRow(url.hash(),- urlLength, urlComps, len,- condenser.RESULT_NUMB_WORDS,- condenser.RESULT_NUMB_SENTENCES,- urlModified.getTime(),- System.currentTimeMillis(),- language,- doctype,- outlinksSame, outlinksOther);- Word wprop;- while (i.hasNext()) {- wentry = i.next();- word = wentry.getKey();- wprop = wentry.getValue();- assert (wprop.flags != null);- ientry.setWord(wprop);- try {- this.index.add(Word.word2hash(word), ientry);- } catch (IOException e) {- e.printStackTrace();- }- wordCount++;- }-- return wordCount;- }-- public void close() {- if (this.merger != null) this.merger.terminate();- index.close();- metadata.close();- peers.close();- profilesActiveCrawls.close();- queuePreStack.close();- }-- public URLMetadataRow storeDocument(final IndexingStack.QueueEntry entry, final plasmaParserDocument document, final Condenser condenser) throws IOException {- final long startTime = System.currentTimeMillis();-- // CREATE INDEX-- // load some document metadata- final String dc_title = document.dc_title();- final yacyURL referrerURL = entry.referrerURL();- final Date docDate = entry.getModificationDate();-- // do a identification of the language- String language = condenser.language(); // this is a statistical analysation of the content: will be compared with other attributes- String bymetadata = document.dc_language(); // the languageByMetadata may return null if there was no declaration- if (language == null) {- // no statistics available, we take either the metadata (if given) or the TLD- language = (bymetadata == null) ? entry.url().language() : bymetadata;- System.out.println("*** DEBUG LANGUAGE-BY-STATISTICS: " + entry.url() + " FAILED, taking " + ((bymetadata == null) ? "TLD" : "metadata") + ": " + language);- } else {- if (bymetadata == null) {- // two possible results: compare and report conflicts- if (language.equals(entry.url().language()))- System.out.println("*** DEBUG LANGUAGE-BY-STATISTICS: " + entry.url() + " CONFIRMED - TLD IDENTICAL: " + language);- else {- String error = "*** DEBUG LANGUAGE-BY-STATISTICS: " + entry.url() + " CONFLICTING: " + language + " (the language given by the TLD is " + entry.url().language() + ")";- // see if we have a hint in the url that the statistic was right- String u = entry.url().toNormalform(true, false).toLowerCase();- if (!u.contains("/" + language + "/") && !u.contains("/" + iso639.country(language).toLowerCase() + "/")) {- // no confirmation using the url, use the TLD- language = entry.url().language();- System.out.println(error + ", corrected using the TLD");- } else {- // this is a strong hint that the statistics was in fact correct- System.out.println(error + ", but the url proves that the statistic is correct");- }- }- } else {- // here we have three results: we can do a voting- if (language.equals(bymetadata)) {- //System.out.println("*** DEBUG LANGUAGE-BY-STATISTICS: " + entry.url() + " CONFIRMED - METADATA IDENTICAL: " + language);- } else if (language.equals(entry.url().language())) {- //System.out.println("*** DEBUG LANGUAGE-BY-STATISTICS: " + entry.url() + " CONFIRMED - TLD IS IDENTICAL: " + language);- } else if (bymetadata.equals(entry.url().language())) {- //System.out.println("*** DEBUG LANGUAGE-BY-STATISTICS: " + entry.url() + " CONFLICTING: " + language + " BUT METADATA AND TLD ARE IDENTICAL: " + bymetadata + ")");- language = bymetadata;- } else {- //System.out.println("*** DEBUG LANGUAGE-BY-STATISTICS: " + entry.url() + " CONFLICTING: ALL DIFFERENT! statistic: " + language + ", metadata: " + bymetadata + ", TLD: + " + entry.url().language() + ". taking metadata.");- language = bymetadata;- }- }- }-- // create a new loaded URL db entry- final long ldate = System.currentTimeMillis();- final URLMetadataRow newEntry = new URLMetadataRow(- entry.url(), // URL- dc_title, // document description- document.dc_creator(), // author- document.dc_subject(' '), // tags- "", // ETag- docDate, // modification date- new Date(), // loaded date- new Date(ldate + Math.max(0, ldate - docDate.getTime()) / 2), // freshdate, computed with Proxy-TTL formula- (referrerURL == null) ? null : referrerURL.hash(), // referer hash- new byte[0], // md5- (int) entry.size(), // size- condenser.RESULT_NUMB_WORDS, // word count- httpdProxyCacheEntry.docType(document.dc_format()), // doctype- condenser.RESULT_FLAGS, // flags- language, // language- document.inboundLinks(), // inbound links- document.outboundLinks(), // outbound links- document.getAudiolinks().size(), // laudio- document.getImages().size(), // limage- document.getVideolinks().size(), // lvideo- document.getApplinks().size() // lapp- );-- // STORE URL TO LOADED-URL-DB- metadata.store(newEntry); // TODO: should be serialized; integrated in IODispatcher-- final long storageEndTime = System.currentTimeMillis();-- // STORE PAGE INDEX INTO WORD INDEX DB- final int words = addPageIndex(- entry.url(), // document url- docDate, // document mod date- document, // document content- condenser, // document condenser- language, // document language- httpdProxyCacheEntry.docType(document.dc_format()), // document type- document.inboundLinks(), // inbound links- document.outboundLinks() // outbound links- );-- final long indexingEndTime = System.currentTimeMillis();-- if (log.isInfo()) {- // TODO: UTF-8 docDescription seems not to be displayed correctly because- // of string concatenation- log.logInfo("*Indexed " + words + " words in URL " + entry.url() +- " [" + entry.urlHash() + "]" +- "\n\tDescription: " + dc_title +- "\n\tMimeType: " + document.dc_format() + " | Charset: " + document.getCharset() + " | " +- "Size: " + document.getTextLength() + " bytes | " +- "Anchors: " + ((document.getAnchors() == null) ? 0 : document.getAnchors().size()) +- "\n\tLinkStorageTime: " + (storageEndTime - startTime) + " ms | " +- "indexStorageTime: " + (indexingEndTime - storageEndTime) + " ms");- RSSFeed.channels((entry.initiator().equals(peers.mySeed().hash)) ? RSSFeed.LOCALINDEXING : RSSFeed.REMOTEINDEXING).addMessage(new RSSMessage("Indexed web page", dc_title, entry.url().toNormalform(true, false)));- }-- // finished- return newEntry;- }-- // The Cleaner class was provided as "UrldbCleaner" by Hydrox- public synchronized ReferenceCleaner getReferenceCleaner(final byte[] startHash) {- return new ReferenceCleaner(startHash);- }-- public class ReferenceCleaner extends Thread {-- private final byte[] startHash;- private boolean run = true;- private boolean pause = false;- public int rwiCountAtStart = 0;- public byte[] wordHashNow = null;- public byte[] lastWordHash = null;- public int lastDeletionCounter = 0;-- public ReferenceCleaner(final byte[] startHash) {- this.startHash = startHash;- this.rwiCountAtStart = index().size();- }-- public void run() {- Log.logInfo("INDEXCLEANER", "IndexCleaner-Thread started");- ReferenceContainer<WordReference> container = null;- WordReference entry = null;- yacyURL url = null;- final HashSet<String> urlHashs = new HashSet<String>();- try {- Iterator<ReferenceContainer<WordReference>> indexContainerIterator = index.references(startHash, false, 100, false).iterator();- while (indexContainerIterator.hasNext() && run) {- waiter();- container = indexContainerIterator.next();- final Iterator<WordReference> containerIterator = container.entries();- wordHashNow = container.getTermHash();- while (containerIterator.hasNext() && run) {- waiter();- entry = containerIterator.next();- // System.out.println("Wordhash: "+wordHash+" UrlHash:- // "+entry.getUrlHash());- final URLMetadataRow ue = metadata.load(entry.metadataHash(), entry, 0);- if (ue == null) {- urlHashs.add(entry.metadataHash());- } else {- url = ue.metadata().url();- if ((url == null) || (plasmaSwitchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_CRAWLER, url) == true)) {- urlHashs.add(entry.metadataHash());- }- }- }- if (urlHashs.size() > 0) try {- final int removed = index.remove(container.getTermHash(), urlHashs);- Log.logFine("INDEXCLEANER", container.getTermHashAsString() + ": " + removed + " of " + container.size() + " URL-entries deleted");- lastWordHash = container.getTermHash();- lastDeletionCounter = urlHashs.size();- urlHashs.clear();- } catch (IOException e) {- e.printStackTrace();- }-- if (!containerIterator.hasNext()) {- // We may not be finished yet, try to get the next chunk of wordHashes- final TreeSet<ReferenceContainer<WordReference>> containers = index.references(container.getTermHash(), false, 100, false);- indexContainerIterator = containers.iterator();- // Make sure we don't get the same wordhash twice, but don't skip a word- if ((indexContainerIterator.hasNext()) && (!container.getTermHash().equals(indexContainerIterator.next().getTermHash()))) {- indexContainerIterator = containers.iterator();- }- }- }- } catch (final IOException e) {- e.printStackTrace();- } catch (final Exception e) {- e.printStackTrace();- }- Log.logInfo("INDEXCLEANER", "IndexCleaner-Thread stopped");- }-- public void abort() {- synchronized(this) {- run = false;- this.notifyAll();- }- }-- public void pause() {- synchronized (this) {- if (!pause) {- pause = true;- Log.logInfo("INDEXCLEANER", "IndexCleaner-Thread paused");- }- }- }-- public void endPause() {- synchronized (this) {- if (pause) {- pause = false;- this.notifyAll();- Log.logInfo("INDEXCLEANER", "IndexCleaner-Thread resumed");- }- }- }-- public void waiter() {- synchronized (this) {- if (this.pause) {- try {- this.wait();- } catch (final InterruptedException e) {- this.run = false;- return;- }- }- }- }- }-}+// Segment.java+// (C) 2005-209 by Michael Peter Christen; [email protected], Frankfurt a. M., Germany+// first published 2005 on http://yacy.net; full redesign for segments 28.5.2009+//+// This is a part of YaCy, a peer-to-peer based web search engine+//+// $LastChangedDate: 2009-05-28 01:51:34 +0200 (Do, 28 Mai 2009) $+// $LastChangedRevision: 5988 $+// $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.kelondro.text;++import java.io.File;+import java.io.IOException;+import java.util.Date;+import java.util.HashSet;+import java.util.Iterator;+import java.util.Map;+import java.util.TreeSet;++import de.anomic.crawler.IndexingStack;+import de.anomic.data.Blacklist;+import de.anomic.htmlFilter.htmlFilterContentScraper;+import de.anomic.http.httpdProxyCacheEntry;+import de.anomic.kelondro.order.Base64Order;+import de.anomic.kelondro.order.ByteOrder;+import de.anomic.kelondro.text.metadataPrototype.URLMetadataRow;+import de.anomic.kelondro.text.referencePrototype.WordReference;+import de.anomic.kelondro.text.referencePrototype.WordReferenceFactory;+import de.anomic.kelondro.text.referencePrototype.WordReferenceRow;+import de.anomic.kelondro.util.Log;+import de.anomic.plasma.plasmaParserDocument;+import de.anomic.plasma.plasmaSwitchboard;+import de.anomic.plasma.parser.Word;+import de.anomic.plasma.parser.Condenser;+import de.anomic.tools.iso639;+import de.anomic.yacy.yacyURL;++public final class Segment {++ // environment constants+ public static final long wCacheMaxAge = 1000 * 60 * 30; // milliseconds; 30 minutes+ public static final int wCacheMaxChunk = 800; // maximum number of references for each urlhash+ public static final int lowcachedivisor = 900;+ public static final long targetFileSize = 256 * 1024 * 1024; // 256 MB+ public static final int writeBufferSize = 4 * 1024 * 1024;++ // the reference factory+ public static final ReferenceFactory<WordReference> wordReferenceFactory = new WordReferenceFactory();+ public static final ByteOrder wordOrder = Base64Order.enhancedCoder;++ private final IndexCell<WordReference> index;+ private final Log log;+ private final MetadataRepository metadata;+ private final File segmentPath;+ private final IODispatcher<WordReference> merger;++ public Segment(+ final Log log,+ final File segmentPath,+ final int entityCacheMaxSize,+ final long maxFileSize) throws IOException {++ log.logInfo("Initializing Segment '" + segmentPath + "', word hash cache size is " + Word.hashCacheSize + ".");++ this.log = log;+ this.segmentPath = segmentPath;++ this.merger = new IODispatcher<WordReference>(wordReferenceFactory, 1, 1, writeBufferSize);+ this.merger.start();+ this.index = new IndexCell<WordReference>(+ new File(segmentPath, "RICELL"),+ wordReferenceFactory,+ wordOrder,+ WordReferenceRow.urlEntryRow,+ entityCacheMaxSize,+ targetFileSize,+ maxFileSize,+ this.merger,+ writeBufferSize);++ File metadatadir = new File(segmentPath, "METADATA");+ if (!metadatadir.exists()) metadatadir.mkdirs();++ // create LURL-db+ metadata = new MetadataRepository(metadatadir);+ }++ public MetadataRepository metadata() {+ return this.metadata;+ }++ public IndexCell<WordReference> index() {+ return this.index;+ }++ public void clear() {+ try {+ index.clear();+ metadata.clear();+ } catch (final IOException e) {+ e.printStackTrace();+ }+ }++ public File getLocation() {+ return this.segmentPath;+ }++ /**+ * this is called by the switchboard to put in a new page into the index+ * use all the words in one condenser object to simultanous create index entries+ *+ * @param url+ * @param urlModified+ * @param document+ * @param condenser+ * @param language+ * @param doctype+ * @param outlinksSame+ * @param outlinksOther+ * @return+ */+ public int addPageIndex(final yacyURL url, final Date urlModified, final plasmaParserDocument document, final Condenser condenser, final String language, final char doctype, final int outlinksSame, final int outlinksOther) {+ int wordCount = 0;+ final int urlLength = url.toNormalform(true, true).length();+ final int urlComps = htmlFilterContentScraper.urlComps(url.toString()).length;++ // iterate over all words of context text+ final Iterator<Map.Entry<String, Word>> i = condenser.words().entrySet().iterator();+ Map.Entry<String, Word> wentry;+ String word;+ int len = (document == null) ? urlLength : document.dc_title().length();+ WordReferenceRow ientry = new WordReferenceRow(url.hash(),+ urlLength, urlComps, len,+ condenser.RESULT_NUMB_WORDS,+ condenser.RESULT_NUMB_SENTENCES,+ urlModified.getTime(),+ System.currentTimeMillis(),+ language,+ doctype,+ outlinksSame, outlinksOther);+ Word wprop;+ while (i.hasNext()) {+ wentry = i.next();+ word = wentry.getKey();+ wprop = wentry.getValue();+ assert (wprop.flags != null);+ ientry.setWord(wprop);+ try {+ this.index.add(Word.word2hash(word), ientry);+ } catch (IOException e) {+ e.printStackTrace();+ }+ wordCount++;+ }++ return wordCount;+ }++ public void close() {+ if (this.merger != null) this.merger.terminate();+ index.close();+ metadata.close();+ }++ public URLMetadataRow storeDocument(final IndexingStack.QueueEntry entry, final plasmaParserDocument document, final Condenser condenser) throws IOException {+ final long startTime = System.currentTimeMillis();++ // CREATE INDEX++ // load some document metadata+ final String dc_title = document.dc_title();+ final yacyURL referrerURL = entry.referrerURL(this.metadata);+ final Date docDate = entry.getModificationDate();++ // do a identification of the language+ String language = condenser.language(); // this is a statistical analysation of the content: will be compared with other attributes+ String bymetadata = document.dc_language(); // the languageByMetadata may return null if there was no declaration+ if (language == null) {+ // no statistics available, we take either the metadata (if given) or the TLD+ language = (bymetadata == null) ? entry.url().language() : bymetadata;+ System.out.println("*** DEBUG LANGUAGE-BY-STATISTICS: " + entry.url() + " FAILED, taking " + ((bymetadata == null) ? "TLD" : "metadata") + ": " + language);+ } else {+ if (bymetadata == null) {+ // two possible results: compare and report conflicts+ if (language.equals(entry.url().language()))+ System.out.println("*** DEBUG LANGUAGE-BY-STATISTICS: " + entry.url() + " CONFIRMED - TLD IDENTICAL: " + language);+ else {+ String error = "*** DEBUG LANGUAGE-BY-STATISTICS: " + entry.url() + " CONFLICTING: " + language + " (the language given by the TLD is " + entry.url().language() + ")";+ // see if we have a hint in the url that the statistic was right+ String u = entry.url().toNormalform(true, false).toLowerCase();+ if (!u.contains("/" + language + "/") && !u.contains("/" + iso639.country(language).toLowerCase() + "/")) {+ // no confirmation using the url, use the TLD+ language = entry.url().language();+ System.out.println(error + ", corrected using the TLD");+ } else {+ // this is a strong hint that the statistics was in fact correct+ System.out.println(error + ", but the url proves that the statistic is correct");+ }+ }+ } else {+ // here we have three results: we can do a voting+ if (language.equals(bymetadata)) {+ //System.out.println("*** DEBUG LANGUAGE-BY-STATISTICS: " + entry.url() + " CONFIRMED - METADATA IDENTICAL: " + language);+ } else if (language.equals(entry.url().language())) {+ //System.out.println("*** DEBUG LANGUAGE-BY-STATISTICS: " + entry.url() + " CONFIRMED - TLD IS IDENTICAL: " + language);+ } else if (bymetadata.equals(entry.url().language())) {+ //System.out.println("*** DEBUG LANGUAGE-BY-STATISTICS: " + entry.url() + " CONFLICTING: " + language + " BUT METADATA AND TLD ARE IDENTICAL: " + bymetadata + ")");+ language = bymetadata;+ } else {+ //System.out.println("*** DEBUG LANGUAGE-BY-STATISTICS: " + entry.url() + " CONFLICTING: ALL DIFFERENT! statistic: " + language + ", metadata: " + bymetadata + ", TLD: + " + entry.url().language() + ". taking metadata.");+ language = bymetadata;+ }+ }+ }++ // create a new loaded URL db entry+ final long ldate = System.currentTimeMillis();+ final URLMetadataRow newEntry = new URLMetadataRow(+ entry.url(), // URL+ dc_title, // document description+ document.dc_creator(), // author+ document.dc_subject(' '), // tags+ "", // ETag+ docDate, // modification date+ new Date(), // loaded date+ new Date(ldate + Math.max(0, ldate - docDate.getTime()) / 2), // freshdate, computed with Proxy-TTL formula+ (referrerURL == null) ? null : referrerURL.hash(), // referer hash+ new byte[0], // md5+ (int) entry.size(), // size+ condenser.RESULT_NUMB_WORDS, // word count+ httpdProxyCacheEntry.docType(document.dc_format()), // doctype+ condenser.RESULT_FLAGS, // flags+ language, // language+ document.inboundLinks(), // inbound links+ document.outboundLinks(), // outbound links+ document.getAudiolinks().size(), // laudio+ document.getImages().size(), // limage+ document.getVideolinks().size(), // lvideo+ document.getApplinks().size() // lapp+ );++ // STORE URL TO LOADED-URL-DB+ metadata.store(newEntry); // TODO: should be serialized; integrated in IODispatcher++ final long storageEndTime = System.currentTimeMillis();++ // STORE PAGE INDEX INTO WORD INDEX DB+ final int words = addPageIndex(+ entry.url(), // document url+ docDate, // document mod date+ document, // document content+ condenser, // document condenser+ language, // document language+ httpdProxyCacheEntry.docType(document.dc_format()), // document type+ document.inboundLinks(), // inbound links+ document.outboundLinks() // outbound links+ );++ final long indexingEndTime = System.currentTimeMillis();++ if (log.isInfo()) {+ // TODO: UTF-8 docDescription seems not to be displayed correctly because+ // of string concatenation+ log.logInfo("*Indexed " + words + " words in URL " + entry.url() ++ " [" + entry.urlHash() + "]" ++ "\n\tDescription: " + dc_title ++ "\n\tMimeType: " + document.dc_format() + " | Charset: " + document.getCharset() + " | " ++ "Size: " + document.getTextLength() + " bytes | " ++ "Anchors: " + ((document.getAnchors() == null) ? 0 : document.getAnchors().size()) ++ "\n\tLinkStorageTime: " + (storageEndTime - startTime) + " ms | " ++ "indexStorageTime: " + (indexingEndTime - storageEndTime) + " ms");+ }++ // finished+ return newEntry;+ }++ // The Cleaner class was provided as "UrldbCleaner" by Hydrox+ public synchronized ReferenceCleaner getReferenceCleaner(final byte[] startHash) {+ return new ReferenceCleaner(startHash);+ }++ public class ReferenceCleaner extends Thread {++ private final byte[] startHash;+ private boolean run = true;+ private boolean pause = false;+ public int rwiCountAtStart = 0;+ public byte[] wordHashNow = null;+ public byte[] lastWordHash = null;+ public int lastDeletionCounter = 0;++ public ReferenceCleaner(final byte[] startHash) {+ this.startHash = startHash;+ this.rwiCountAtStart = index().size();+ }++ public void run() {+ Log.logInfo("INDEXCLEANER", "IndexCleaner-Thread started");+ ReferenceContainer<WordReference> container = null;+ WordReference entry = null;+ yacyURL url = null;+ final HashSet<String> urlHashs = new HashSet<String>();+ try {+ Iterator<ReferenceContainer<WordReference>> indexContainerIterator = index.references(startHash, false, 100, false).iterator();+ while (indexContainerIterator.hasNext() && run) {+ waiter();+ container = indexContainerIterator.next();+ final Iterator<WordReference> containerIterator = container.entries();+ wordHashNow = container.getTermHash();+ while (containerIterator.hasNext() && run) {+ waiter();+ entry = containerIterator.next();+ // System.out.println("Wordhash: "+wordHash+" UrlHash:+ // "+entry.getUrlHash());+ final URLMetadataRow ue = metadata.load(entry.metadataHash(), entry, 0);+ if (ue == null) {+ urlHashs.add(entry.metadataHash());+ } else {+ url = ue.metadata().url();+ if ((url == null) || (plasmaSwitchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_CRAWLER, url) == true)) {+ urlHashs.add(entry.metadataHash());+ }+ }+ }+ if (urlHashs.size() > 0) try {+ final int removed = index.remove(container.getTermHash(), urlHashs);+ Log.logFine("INDEXCLEANER", container.getTermHashAsString() + ": " + removed + " of " + container.size() + " URL-entries deleted");+ lastWordHash = container.getTermHash();+ lastDeletionCounter = urlHashs.size();+ urlHashs.clear();+ } catch (IOException e) {+ e.printStackTrace();+ }++ if (!containerIterator.hasNext()) {+ // We may not be finished yet, try to get the next chunk of wordHashes+ final TreeSet<ReferenceContainer<WordReference>> containers = index.references(container.getTermHash(), false, 100, false);+ indexContainerIterator = containers.iterator();+ // Make sure we don't get the same wordhash twice, but don't skip a word+ if ((indexContainerIterator.hasNext()) && (!container.getTermHash().equals(indexContainerIterator.next().getTermHash()))) {+ indexContainerIterator = containers.iterator();+ }+ }+ }+ } catch (final IOException e) {+ e.printStackTrace();+ } catch (final Exception e) {+ e.printStackTrace();+ }+ Log.logInfo("INDEXCLEANER", "IndexCleaner-Thread stopped");+ }++ public void abort() {+ synchronized(this) {+ run = false;+ this.notifyAll();+ }+ }++ public void pause() {+ synchronized (this) {+ if (!pause) {+ pause = true;+ Log.logInfo("INDEXCLEANER", "IndexCleaner-Thread paused");+ }+ }+ }++ public void endPause() {+ synchronized (this) {+ if (pause) {+ pause = false;+ this.notifyAll();+ Log.logInfo("INDEXCLEANER", "IndexCleaner-Thread resumed");+ }+ }+ }++ public void waiter() {+ synchronized (this) {+ if (this.pause) {+ try {+ this.wait();+ } catch (final InterruptedException e) {+ this.run = false;+ return;+ }+ }+ }+ }+ }+}diff --git a/source/de/anomic/plasma/plasmaDbImporter.java b/source/de/anomic/plasma/plasmaDbImporter.javaindex b0298804d..8fbdc4f30 100644--- a/source/de/anomic/plasma/plasmaDbImporter.java+++ b/source/de/anomic/plasma/plasmaDbImporter.java@@ -8,6 +8,7 @@ import de.anomic.crawler.AbstractImporter;import de.anomic.crawler.Importer;import de.anomic.kelondro.text.Reference;import de.anomic.kelondro.text.ReferenceContainer;+import de.anomic.kelondro.text.Segment;import de.anomic.kelondro.text.metadataPrototype.URLMetadataRow;import de.anomic.kelondro.text.referencePrototype.WordReference;import de.anomic.kelondro.util.DateFormatter;@@ -17,12 +18,12 @@ public class plasmaDbImporter extends AbstractImporter implements Importer {/*** the source word index (the DB to import)*/- private final plasmaWordIndex importWordIndex;+ private final Segment importWordIndex;/*** the destination word index (the home DB)*/- protected plasmaWordIndex homeWordIndex;+ protected Segment homeWordIndex;private final int importStartSize;private byte[] wordHash = "------------".getBytes();@@ -32,7 +33,7 @@ public class plasmaDbImporter extends AbstractImporter implements Importer {private long urlCounter = 0, wordCounter = 0, entryCounter = 0, notBoundEntryCounter = 0;- public plasmaDbImporter(final plasmaWordIndex homeWI, final plasmaWordIndex importWI) {+ public plasmaDbImporter(final Segment homeWI, final Segment importWI) {super("PLASMADB");this.homeWordIndex = homeWI;this.importWordIndex = importWI;@@ -43,7 +44,7 @@ public class plasmaDbImporter extends AbstractImporter implements Importer {* @see Importer#getJobName()*/public String getJobName() {- return this.importWordIndex.getLocation(true).toString();+ return this.importWordIndex.getLocation().toString();}/**@@ -92,7 +93,7 @@ public class plasmaDbImporter extends AbstractImporter implements Importer {this.log.logInfo("STARTING DB-IMPORT");try {- this.log.logInfo("Importing DB from '" + this.importWordIndex.getLocation(true).getAbsolutePath() + "'");+ this.log.logInfo("Importing DB from '" + this.importWordIndex.getLocation().getAbsolutePath() + "'");this.log.logInfo("Home word index contains " + homeWordIndex.index().size() + " words and " + homeWordIndex.metadata().size() + " URLs.");this.log.logInfo("Import word index contains " + this.importWordIndex.index().size() + " words and " + this.importWordIndex.metadata().size() + " URLs.");@@ -100,7 +101,7 @@ public class plasmaDbImporter extends AbstractImporter implements Importer {final HashSet<String> importedUrlBuffer = new HashSet<String>();// iterate over all words from import db- //Iterator importWordHashIterator = this.importWordIndex.wordHashes(this.wordChunkStartHash, plasmaWordIndex.RL_WORDFILES, false);+ //Iterator importWordHashIterator = this.importWordIndex.wordHashes(this.wordChunkStartHash, CrawlSwitchboard.RL_WORDFILES, false);Iterator<ReferenceContainer<WordReference>> indexContainerIterator = this.importWordIndex.index().references(this.wordChunkStartHash, false, 100, false).iterator();while (!isAborted() && indexContainerIterator.hasNext()) {diff --git a/source/de/anomic/plasma/plasmaRankingCRProcess.java b/source/de/anomic/plasma/plasmaRankingCRProcess.javaindex be3b2973c..69d174365 100644--- a/source/de/anomic/plasma/plasmaRankingCRProcess.java+++ b/source/de/anomic/plasma/plasmaRankingCRProcess.java@@ -40,6 +40,7 @@ import de.anomic.kelondro.order.MicroDate;import de.anomic.kelondro.table.EcoTable;import de.anomic.kelondro.text.IndexCell;import de.anomic.kelondro.text.ReferenceContainer;+import de.anomic.kelondro.text.Segment;import de.anomic.kelondro.text.citationPrototype.CitationReferenceRow;import de.anomic.kelondro.text.referencePrototype.WordReference;import de.anomic.kelondro.util.DateFormatter;@@ -249,7 +250,7 @@ public class plasmaRankingCRProcess {newacc = new EcoTable(new File(path, CRG_accname), CRG_accrow, EcoTable.tailCacheUsageAuto, 0, 0);newseq = new IndexCell<WordReference>(path,- plasmaWordIndex.wordReferenceFactory,+ Segment.wordReferenceFactory,Base64Order.enhancedCoder,CRG_colrow,10000, 1000000000L, 20, null, 1000000);@@ -383,9 +384,9 @@ public class plasmaRankingCRProcess {public static int genrcix(final File cr_path_in, final File rci_path_out) throws IOException {//kelondroFlexTable acc = new kelondroFlexTable(cr_path_in, CRG_accname, kelondroBase64Order.enhancedCoder, 128 * 1024 * 1024, -1, CRG_accrow, true);final IndexCell<WordReference> seq = new IndexCell<WordReference>(- cr_path_in, plasmaWordIndex.wordReferenceFactory, Base64Order.enhancedCoder, CRG_colrow, 10000, 1000000000L, 20, null, 1000000);+ cr_path_in, Segment.wordReferenceFactory, Base64Order.enhancedCoder, CRG_colrow, 10000, 1000000000L, 20, null, 1000000);final IndexCell<WordReference> rci = new IndexCell<WordReference>(- rci_path_out, plasmaWordIndex.wordReferenceFactory, Base64Order.enhancedCoder, RCI_coli, 10000, 1000000000L, 20, null, 1000000);+ rci_path_out, Segment.wordReferenceFactory, Base64Order.enhancedCoder, RCI_coli, 10000, 1000000000L, 20, null, 1000000);// loop over all refereesint count = 0;diff --git a/source/de/anomic/plasma/plasmaSearchAPI.java b/source/de/anomic/plasma/plasmaSearchAPI.javaindex c03415acb..0daf89186 100644--- a/source/de/anomic/plasma/plasmaSearchAPI.java+++ b/source/de/anomic/plasma/plasmaSearchAPI.java@@ -74,7 +74,7 @@ public class plasmaSearchAPI {yacySeed seed;int hc = 0;prop.put("searchresult_keyhash", startHash);- final Iterator<yacySeed> e = PeerSelection.getAcceptRemoteIndexSeeds(sb.webIndex.peers(), startHash, sb.webIndex.peers().sizeConnected(), true);+ final Iterator<yacySeed> e = PeerSelection.getAcceptRemoteIndexSeeds(sb.peers, startHash, sb.peers.sizeConnected(), true);while (e.hasNext()) {seed = e.next();if (seed != null) {@@ -88,7 +88,7 @@ public class plasmaSearchAPI {public static plasmaSearchRankingProcess genSearchresult(final serverObjects prop, final plasmaSwitchboard sb, final byte[] keyhash, final Bitfield filter) {final plasmaSearchQuery query = new plasmaSearchQuery(new String(keyhash), -1, sb.getRanking(), filter);- final plasmaSearchRankingProcess ranked = new plasmaSearchRankingProcess(sb.webIndex, query, Integer.MAX_VALUE, 1);+ final plasmaSearchRankingProcess ranked = new plasmaSearchRankingProcess(sb.indexSegment, query, Integer.MAX_VALUE, 1);ranked.execQuery();if (ranked.filteredCount() == 0) {diff --git a/source/de/anomic/plasma/plasmaSearchEvent.java b/source/de/anomic/plasma/plasmaSearchEvent.javaindex c5f62b82d..ffe8c88d2 100644--- a/source/de/anomic/plasma/plasmaSearchEvent.java+++ b/source/de/anomic/plasma/plasmaSearchEvent.java@@ -42,6 +42,7 @@ import de.anomic.kelondro.order.Base64Order;import de.anomic.kelondro.order.Bitfield;import de.anomic.kelondro.text.Reference;import de.anomic.kelondro.text.ReferenceContainer;+import de.anomic.kelondro.text.Segment;import de.anomic.kelondro.text.metadataPrototype.URLMetadataRow;import de.anomic.kelondro.text.referencePrototype.WordReference;import de.anomic.kelondro.text.referencePrototype.WordReferenceVars;@@ -57,6 +58,7 @@ import de.anomic.plasma.plasmaSnippetCache.MediaSnippet;import de.anomic.server.serverProfiling;import de.anomic.yacy.yacySearch;import de.anomic.yacy.yacySeed;+import de.anomic.yacy.yacySeedDB;import de.anomic.yacy.yacyURL;import de.anomic.yacy.dht.FlatWordPartitionScheme;@@ -78,7 +80,8 @@ public final class plasmaSearchEvent {private long eventTime;plasmaSearchQuery query;- private final plasmaWordIndex wordIndex;+ private final Segment indexSegment;+ private final yacySeedDB peers;plasmaSearchRankingProcess rankedCache; // ordered search results, grows dynamically as all the query threads enrich this containerprivate final Map<String, TreeMap<String, String>> rcAbstracts; // cache for index abstracts; word:TreeMap mapping where the embedded TreeMap is a urlhash:peerlist relationprivate yacySearch[] primarySearchThreads, secondarySearchThreads;@@ -100,12 +103,14 @@ public final class plasmaSearchEvent {@SuppressWarnings("unchecked")private plasmaSearchEvent(final plasmaSearchQuery query,- final plasmaWordIndex wordIndex,+ final Segment indexSegment,+ final yacySeedDB peers,final ResultURLs crawlResults,final TreeMap<byte[], String> preselectedPeerHashes,final boolean generateAbstracts) {this.eventTime = System.currentTimeMillis(); // for lifetime check- this.wordIndex = wordIndex;+ this.indexSegment = indexSegment;+ this.peers = peers;this.crawlResults = crawlResults;this.query = query;this.rcAbstracts = (query.queryHashes.size() > 1) ? new TreeMap<String, TreeMap<String, String>>() : null; // generate abstracts only for combined searches@@ -136,7 +141,7 @@ public final class plasmaSearchEvent {if ((query.domType == plasmaSearchQuery.SEARCHDOM_GLOBALDHT) ||(query.domType == plasmaSearchQuery.SEARCHDOM_CLUSTERALL)) {// do a global search- this.rankedCache = new plasmaSearchRankingProcess(wordIndex, query, max_results_preparation, 16);+ this.rankedCache = new plasmaSearchRankingProcess(indexSegment, query, max_results_preparation, 16);this.hostNavigator = null;final int fetchpeers = 12;@@ -153,7 +158,8 @@ public final class plasmaSearchEvent {query.targetlang,query.displayResults(),query.maxDistance,- wordIndex,+ indexSegment,+ peers,crawlResults,rankedCache,rcAbstracts,@@ -172,10 +178,10 @@ public final class plasmaSearchEvent {Log.logFine("SEARCH_EVENT", "SEARCH TIME AFTER GLOBAL-TRIGGER TO " + primarySearchThreads.length + " PEERS: " + ((System.currentTimeMillis() - start) / 1000) + " seconds");} else {// do a local search- this.rankedCache = new plasmaSearchRankingProcess(wordIndex, query, max_results_preparation, 2);+ this.rankedCache = new plasmaSearchRankingProcess(indexSegment, query, max_results_preparation, 2);this.rankedCache.execQuery();this.hostNavigator = rankedCache.getHostNavigator(10);- //plasmaWordIndex.Finding finding = wordIndex.retrieveURLs(query, false, 2, ranking, process);+ //CrawlSwitchboard.Finding finding = wordIndex.retrieveURLs(query, false, 2, ranking, process);if (generateAbstracts) {// compute index abstracts@@ -191,7 +197,7 @@ public final class plasmaSearchEvent {IAmaxcounthash = wordhash;maxcount = container.size();}- l = FlatWordPartitionScheme.std.dhtDistance(wordhash, null, wordIndex.peers().mySeed());+ l = FlatWordPartitionScheme.std.dhtDistance(wordhash, null, peers.mySeed());if (l < mindhtdistance) {// calculate the word hash that is closest to our dht positionmindhtdistance = l;@@ -254,7 +260,7 @@ public final class plasmaSearchEvent {final TreeSet<byte[]> removeWords = cleanEvent.query.queryHashes;removeWords.addAll(cleanEvent.query.excludeHashes);try {- cleanEvent.wordIndex.index().remove(removeWords, cleanEvent.failedURLs.keySet());+ cleanEvent.indexSegment.index().remove(removeWords, cleanEvent.failedURLs.keySet());} catch (IOException e) {e.printStackTrace();}@@ -310,7 +316,7 @@ public final class plasmaSearchEvent {(query.constraint.get(Condenser.flag_cat_indexof)) &&(!(metadata.dc_title().startsWith("Index of")))) {final Iterator<byte[]> wi = query.queryHashes.iterator();- while (wi.hasNext()) try { wordIndex.index().remove(wi.next(), page.hash()); } catch (IOException e) {}+ while (wi.hasNext()) try { indexSegment.index().remove(wi.next(), page.hash()); } catch (IOException e) {}registerFailure(page.hash(), "index-of constraint not fullfilled");return null;}@@ -333,7 +339,7 @@ public final class plasmaSearchEvent {}if (snippetFetchMode == 0) {- return new ResultEntry(page, wordIndex, null, null, dbRetrievalTime, 0); // result without snippet+ return new ResultEntry(page, indexSegment, peers, null, null, dbRetrievalTime, 0); // result without snippet}// load snippet@@ -346,15 +352,15 @@ public final class plasmaSearchEvent {if (snippet.getErrorCode() < 11) {// we loaded the file and found the snippet- return new ResultEntry(page, wordIndex, snippet, null, dbRetrievalTime, snippetComputationTime); // result with snippet attached+ return new ResultEntry(page, indexSegment, peers, snippet, null, dbRetrievalTime, snippetComputationTime); // result with snippet attached} else if (snippetFetchMode == 1) {// we did not demand online loading, therefore a failure does not mean that the missing snippet causes a rejection of this result// this may happen during a remote search, because snippet loading is omitted to retrieve results faster- return new ResultEntry(page, wordIndex, null, null, dbRetrievalTime, snippetComputationTime); // result without snippet+ return new ResultEntry(page, indexSegment, peers, null, null, dbRetrievalTime, snippetComputationTime); // result without snippet} else {// problems with snippet fetchregisterFailure(page.hash(), "no text snippet for URL " + metadata.url());- if (!wordIndex.peers().mySeed().isVirgin())+ if (!peers.mySeed().isVirgin())try {plasmaSnippetCache.failConsequences(snippet, query.id(false));} catch (IOException e) {@@ -371,9 +377,9 @@ public final class plasmaSearchEvent {if ((mediaSnippets != null) && (mediaSnippets.size() > 0)) {// found media snippets, return entry- return new ResultEntry(page, wordIndex, null, mediaSnippets, dbRetrievalTime, snippetComputationTime);+ return new ResultEntry(page, indexSegment, peers, null, mediaSnippets, dbRetrievalTime, snippetComputationTime);} else if (snippetFetchMode == 1) {- return new ResultEntry(page, wordIndex, null, null, dbRetrievalTime, snippetComputationTime);+ return new ResultEntry(page, indexSegment, peers, null, null, dbRetrievalTime, snippetComputationTime);} else {// problems with snippet fetchregisterFailure(page.hash(), "no media snippet for URL " + metadata.url());@@ -451,7 +457,8 @@ public final class plasmaSearchEvent {public static plasmaSearchEvent getEvent(final plasmaSearchQuery query,final plasmaSearchRankingProfile ranking,- final plasmaWordIndex wordIndex,+ final Segment indexSegment,+ final yacySeedDB peers,final ResultURLs crawlResults,final TreeMap<byte[], String> preselectedPeerHashes,final boolean generateAbstracts) {@@ -474,7 +481,7 @@ public final class plasmaSearchEvent {}if (event == null) {// generate a new event- event = new plasmaSearchEvent(query, wordIndex, crawlResults, preselectedPeerHashes, generateAbstracts);+ event = new plasmaSearchEvent(query, indexSegment, peers, crawlResults, preselectedPeerHashes, generateAbstracts);} else {// if worker threads had been alive, but did not succeed, start them again to fetch missing linksif ((!event.anyWorkerAlive()) &&@@ -689,18 +696,18 @@ public final class plasmaSearchEvent {final TreeMap<String, String> secondarySearchURLs = new TreeMap<String, String>(); // a (peerhash:urlhash-liststring) mappingIterator<Map.Entry<String, String>> i1 = abstractJoin.entrySet().iterator();Map.Entry<String, String> entry1;- String url, urls, peer, peers;- final String mypeerhash = wordIndex.peers().mySeed().hash;+ String url, urls, peer, ps;+ final String mypeerhash = peers.mySeed().hash;boolean mypeerinvolved = false;int mypeercount;while (i1.hasNext()) {entry1 = i1.next();url = entry1.getKey();- peers = entry1.getValue();+ ps = entry1.getValue();//System.out.println("DEBUG-INDEXABSTRACT: url " + url + ": from peers " + peers);mypeercount = 0;- for (int j = 0; j < peers.length(); j = j + 12) {- peer = peers.substring(j, j + 12);+ for (int j = 0; j < ps.length(); j = j + 12) {+ peer = ps.substring(j, j + 12);if ((peer.equals(mypeerhash)) && (mypeercount++ > 1)) continue;//if (peers.indexOf(peer) < j) continue; // avoid doubles that may appear in the abstractJoinurls = secondarySearchURLs.get(peer);@@ -724,7 +731,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, crawlResults, this.rankedCache, peer, plasmaSwitchboard.urlBlacklist,+ words, "", urls, indexSegment, peers, crawlResults, this.rankedCache, peer, plasmaSwitchboard.urlBlacklist,query.ranking, query.constraint, preselectedPeerHashes);}@@ -784,7 +791,9 @@ public final class plasmaSearchEvent {// statistic objectspublic long dbRetrievalTime, snippetComputationTime;- public ResultEntry(final URLMetadataRow urlentry, final plasmaWordIndex wordIndex,+ public ResultEntry(final URLMetadataRow urlentry,+ final Segment indexSegment,+ yacySeedDB peers,final plasmaSnippetCache.TextSnippet textSnippet,final ArrayList<plasmaSnippetCache.MediaSnippet> mediaSnippets,final long dbRetrievalTime, final long snippetComputationTime) {@@ -801,13 +810,13 @@ public final class plasmaSearchEvent {// translate host into current IPint p = host.indexOf(".");final String hash = yacySeed.hexHash2b64Hash(host.substring(p + 1, host.length() - 6));- final yacySeed seed = wordIndex.peers().getConnected(hash);+ final yacySeed seed = peers.getConnected(hash);final String filename = urlcomps.url().getFile();String address = null;if ((seed == null) || ((address = seed.getPublicAddress()) == null)) {// seed is not known from heretry {- wordIndex.index().remove(+ indexSegment.index().remove(Word.words2hashes(Condenser.getWords(("yacyshare " +filename.replace('?', ' ') +@@ -817,7 +826,7 @@ public final class plasmaSearchEvent {} catch (IOException e) {e.printStackTrace();}- wordIndex.metadata().remove(urlentry.hash()); // clean up+ indexSegment.metadata().remove(urlentry.hash()); // clean upthrow new RuntimeException("index void");}alternative_urlstring = "http://" + address + "/" + host.substring(0, p) + filename;diff --git a/source/de/anomic/plasma/plasmaSearchRankingProcess.java b/source/de/anomic/plasma/plasmaSearchRankingProcess.javaindex 99b9a4fe0..8abdaaf05 100644--- a/source/de/anomic/plasma/plasmaSearchRankingProcess.java+++ b/source/de/anomic/plasma/plasmaSearchRankingProcess.java@@ -44,6 +44,7 @@ import de.anomic.kelondro.order.Digest;import de.anomic.kelondro.text.Reference;import de.anomic.kelondro.text.ReferenceContainer;import de.anomic.kelondro.text.ReferenceOrder;+import de.anomic.kelondro.text.Segment;import de.anomic.kelondro.text.metadataPrototype.URLMetadataRow;import de.anomic.kelondro.text.referencePrototype.WordReference;import de.anomic.kelondro.text.referencePrototype.WordReferenceVars;@@ -73,13 +74,13 @@ public final class plasmaSearchRankingProcess {private final ScoreCluster<String> ref; // reference score computation for the commonSense heuristicprivate final int[] flagcount; // flag counterprivate final TreeSet<String> misses; // contains url-hashes that could not been found in the LURL-DB- private final plasmaWordIndex wordIndex;+ private final Segment indexSegment;private HashMap<byte[], ReferenceContainer<WordReference>>[] localSearchContainerMaps;private final int[] domZones;private HashMap<String, hoststat> hostNavigator;public plasmaSearchRankingProcess(- final plasmaWordIndex wordIndex,+ final Segment indexSegment,final plasmaSearchQuery query,final int maxentries,final int concurrency) {@@ -100,7 +101,7 @@ public final class plasmaSearchRankingProcess {this.urlhashes = new ConcurrentHashMap<String, Integer>(0, 0.75f, concurrency);this.ref = new ScoreCluster<String>();this.misses = new TreeSet<String>();- this.wordIndex = wordIndex;+ this.indexSegment = indexSegment;this.flagcount = new int[32];for (int i = 0; i < 32; i++) {this.flagcount[i] = 0;}this.domZones = new int[8];@@ -119,14 +120,14 @@ public final class plasmaSearchRankingProcess {public void execQuery() {long timer = System.currentTimeMillis();- this.localSearchContainerMaps = wordIndex.index().searchTerm(query.queryHashes, query.excludeHashes, null);+ this.localSearchContainerMaps = indexSegment.index().searchTerm(query.queryHashes, query.excludeHashes, null);serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(query.id(true), plasmaSearchEvent.COLLECTION, this.localSearchContainerMaps[0].size(), System.currentTimeMillis() - timer), false);// join and exclude the local resulttimer = System.currentTimeMillis();final ReferenceContainer<WordReference> index =ReferenceContainer.joinExcludeContainers(- plasmaWordIndex.wordReferenceFactory,+ Segment.wordReferenceFactory,this.localSearchContainerMaps[0].values(),this.localSearchContainerMaps[1].values(),query.maxDistance);@@ -273,7 +274,7 @@ public final class plasmaSearchRankingProcess {URLMetadataRow mr;yacyURL url;for (int i = 0; i < rc; i++) {- mr = wordIndex.metadata().load(hsa[i].hashsample, null, 0);+ mr = indexSegment.metadata().load(hsa[i].hashsample, null, 0);if (mr == null) continue;url = mr.metadata().url();if (url == null) continue;@@ -363,7 +364,7 @@ public final class plasmaSearchRankingProcess {if (((stack.size() == 0) && (size() == 0))) break;final SortStack<WordReferenceVars>.stackElement obrwi = bestRWI(skipDoubleDom);if (obrwi == null) continue; // *** ? this happened and the thread was suspended silently. cause?- final URLMetadataRow u = wordIndex.metadata().load(obrwi.element.metadataHash(), obrwi.element, obrwi.weight.longValue());+ final URLMetadataRow u = indexSegment.metadata().load(obrwi.element.metadataHash(), obrwi.element, obrwi.weight.longValue());if (u != null) {final URLMetadataRow.Components metadata = u.metadata();if (metadata.url() != null) {diff --git a/source/de/anomic/plasma/plasmaSnippetCache.java b/source/de/anomic/plasma/plasmaSnippetCache.javaindex 6d4f43e88..da297a1aa 100644--- a/source/de/anomic/plasma/plasmaSnippetCache.java+++ b/source/de/anomic/plasma/plasmaSnippetCache.java@@ -951,18 +951,18 @@ 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().webIndex.metadata().remove(urlHash);+ plasmaSwitchboard.getSwitchboard().indexSegment.metadata().remove(urlHash);final plasmaSearchEvent event = plasmaSearchEvent.getEvent(eventID);assert plasmaSwitchboard.getSwitchboard() != null;- assert plasmaSwitchboard.getSwitchboard().webIndex != null;+ assert plasmaSwitchboard.getSwitchboard().indexSegment != null;assert event != null : "eventID = " + eventID;assert event.getQuery() != null;- plasmaSwitchboard.getSwitchboard().webIndex.index().remove(event.getQuery().queryHashes, urlHash);+ plasmaSwitchboard.getSwitchboard().indexSegment.index().remove(event.getQuery().queryHashes, urlHash);event.remove(urlHash);}if (snippet.getErrorCode() == ERROR_NO_MATCH) {log.logInfo("error: '" + snippet.getError() + "', remove words '" + querystring + "' for url = " + snippet.getUrl().toNormalform(false, true) + ", cause: " + snippet.getError());- plasmaSwitchboard.getSwitchboard().webIndex.index().remove(snippet.remaingHashes, urlHash);+ plasmaSwitchboard.getSwitchboard().indexSegment.index().remove(snippet.remaingHashes, urlHash);plasmaSearchEvent.getEvent(eventID).remove(urlHash);}return snippet.getError();diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.javaindex 724c5dac0..989c212be 100644--- a/source/de/anomic/plasma/plasmaSwitchboard.java+++ b/source/de/anomic/plasma/plasmaSwitchboard.java@@ -112,11 +112,13 @@ import java.util.TreeSet;import java.util.regex.Pattern;import de.anomic.content.DCEntry;+import de.anomic.content.RSSMessage;import de.anomic.content.file.SurrogateReader;import de.anomic.crawler.CrawlEntry;import de.anomic.crawler.CrawlProfile;import de.anomic.crawler.CrawlQueues;import de.anomic.crawler.CrawlStacker;+import de.anomic.crawler.CrawlSwitchboard;import de.anomic.crawler.HTTPLoader;import de.anomic.crawler.ImporterManager;import de.anomic.crawler.IndexingStack;@@ -148,6 +150,7 @@ import de.anomic.http.httpd;import de.anomic.http.httpdRobotsTxtConfig;import de.anomic.kelondro.order.Digest;import de.anomic.kelondro.order.NaturalOrder;+import de.anomic.kelondro.text.Segment;import de.anomic.kelondro.text.metadataPrototype.URLMetadataRow;import de.anomic.kelondro.order.Base64Order;import de.anomic.kelondro.util.DateFormatter;@@ -175,12 +178,14 @@ import de.anomic.server.serverSystem;import de.anomic.server.serverThread;import de.anomic.tools.crypt;import de.anomic.tools.CryptoLib;+import de.anomic.xml.RSSFeed;import de.anomic.yacy.yacyClient;import de.anomic.yacy.yacyCore;import de.anomic.yacy.yacyNewsPool;import de.anomic.yacy.yacyNewsRecord;import de.anomic.yacy.yacySeed;import de.anomic.yacy.Tray;+import de.anomic.yacy.yacySeedDB;import de.anomic.yacy.yacyURL;import de.anomic.yacy.yacyUpdateLocation;import de.anomic.yacy.yacyRelease;@@ -218,7 +223,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.public File surrogatesInPath;public File surrogatesOutPath;public Map<String, String> rankingPermissions;- public plasmaWordIndex webIndex;+ public Segment indexSegment;+ public CrawlSwitchboard crawler;public CrawlQueues crawlQueues;public ResultURLs crawlResults;public CrawlStacker crawlStacker;@@ -250,6 +256,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.public List<Pattern> networkWhitelist, networkBlacklist;public Dispatcher dhtDispatcher;public List<String> trail;+ public yacySeedDB peers;public serverProcessor<indexingQueueEntry> indexingDocumentProcessor;public serverProcessor<indexingQueueEntry> indexingCondensementProcessor;@@ -293,8 +300,6 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.this.log.logConfig("Plasma DB Path: " + this.plasmaPath.toString());final File indexPrimaryPath = getConfigPath(plasmaSwitchboardConstants.INDEX_PRIMARY_PATH, plasmaSwitchboardConstants.INDEX_PATH_DEFAULT);this.log.logConfig("Index Primary Path: " + indexPrimaryPath.toString());- final File indexSecondaryPath = (getConfig(plasmaSwitchboardConstants.INDEX_SECONDARY_PATH, "").length() == 0) ? indexPrimaryPath : new File(getConfig(plasmaSwitchboardConstants.INDEX_SECONDARY_PATH, ""));- this.log.logConfig("Index Secondary Path: " + indexSecondaryPath.toString());this.listsPath = getConfigPath(plasmaSwitchboardConstants.LISTS_PATH, plasmaSwitchboardConstants.LISTS_PATH_DEFAULT);this.log.logConfig("Lists Path: " + this.listsPath.toString());this.htDocsPath = getConfigPath(plasmaSwitchboardConstants.HTDOCS_PATH, plasmaSwitchboardConstants.HTDOCS_PATH_DEFAULT);@@ -322,20 +327,32 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.final String networkName = getConfig(plasmaSwitchboardConstants.NETWORK_NAME, "");final long fileSizeMax = (serverSystem.isWindows) ? sb.getConfigLong("filesize.max.win", (long) Integer.MAX_VALUE) : sb.getConfigLong("filesize.max.other", (long) Integer.MAX_VALUE);final int redundancy = (int) sb.getConfigLong("network.unit.dhtredundancy.senior", 1);- final int paritionExponent = (int) sb.getConfigLong("network.unit.dht.partitionExponent", 0);+ final int partitionExponent = (int) sb.getConfigLong("network.unit.dht.partitionExponent", 0);try {- webIndex = new plasmaWordIndex(- networkName,- log,- indexPrimaryPath,- indexSecondaryPath,- wordCacheMaxCount,- fileSizeMax,- redundancy,- paritionExponent);+ final File networkRoot = new File(new File(indexPrimaryPath, networkName), "NETWORK");+ networkRoot.mkdirs();+ final File mySeedFile = new File(networkRoot, yacySeedDB.DBFILE_OWN_SEED);+ peers = new yacySeedDB(+ networkRoot,+ "seed.new.heap",+ "seed.old.heap",+ "seed.pot.heap",+ mySeedFile,+ redundancy,+ partitionExponent);+ indexSegment = new Segment(+ log,+ new File(new File(indexPrimaryPath, networkName), "TEXT"),+ wordCacheMaxCount,+ fileSizeMax);+ crawler = new CrawlSwitchboard(+ peers,+ networkName,+ log,+ new File(new File(indexPrimaryPath, networkName), "QUEUES"));} catch (IOException e1) {e1.printStackTrace();- webIndex = null;+ indexSegment = null;}crawlResults = new ResultURLs();@@ -347,9 +364,9 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.// init a DHT transmission dispatcherthis.dhtDispatcher = new Dispatcher(- webIndex.index(),- webIndex.metadata(),- webIndex.peers(),+ indexSegment.index(),+ indexSegment.metadata(),+ peers,true,30000);@@ -451,7 +468,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.htCachePath = getConfigPath(plasmaSwitchboardConstants.HTCACHE_PATH, plasmaSwitchboardConstants.HTCACHE_PATH_DEFAULT);this.log.logInfo("HTCACHE Path = " + htCachePath.getAbsolutePath());final long maxCacheSize = 1024 * 1024 * Long.parseLong(getConfig(plasmaSwitchboardConstants.PROXY_CACHE_SIZE, "2")); // this is megabyte- plasmaHTCache.init(htCachePath, webIndex.peers().mySeed().hash, maxCacheSize);+ plasmaHTCache.init(htCachePath, peers.mySeed().hash, maxCacheSize);// create the surrogates directoriessurrogatesInPath = getConfigPath(plasmaSwitchboardConstants.SURROGATES_IN_PATH, plasmaSwitchboardConstants.SURROGATES_IN_PATH_DEFAULT);@@ -564,8 +581,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.CRDist1Target = kaskelix.de:8080,yacy.dyndns.org:8000,suma-lab.de:8080**/rankingOn = getConfig(plasmaSwitchboardConstants.RANKING_DIST_ON, "true").equals("true") && networkName.equals("freeworld");- rankingOwnDistribution = new plasmaRankingDistribution(log, webIndex.peers(), new File(rankingPath, getConfig(plasmaSwitchboardConstants.RANKING_DIST_0_PATH, plasmaRankingDistribution.CR_OWN)), (int) getConfigLong(plasmaSwitchboardConstants.RANKING_DIST_0_METHOD, plasmaRankingDistribution.METHOD_ANYSENIOR), (int) getConfigLong(plasmaSwitchboardConstants.RANKING_DIST_0_METHOD, 0), getConfig(plasmaSwitchboardConstants.RANKING_DIST_0_TARGET, ""));- rankingOtherDistribution = new plasmaRankingDistribution(log, webIndex.peers(), new File(rankingPath, getConfig(plasmaSwitchboardConstants.RANKING_DIST_1_PATH, plasmaRankingDistribution.CR_OTHER)), (int) getConfigLong(plasmaSwitchboardConstants.RANKING_DIST_1_METHOD, plasmaRankingDistribution.METHOD_MIXEDSENIOR), (int) getConfigLong(plasmaSwitchboardConstants.RANKING_DIST_1_METHOD, 30), getConfig(plasmaSwitchboardConstants.RANKING_DIST_1_TARGET, "kaskelix.de:8080,yacy.dyndns.org:8000"));+ rankingOwnDistribution = new plasmaRankingDistribution(log, peers, new File(rankingPath, getConfig(plasmaSwitchboardConstants.RANKING_DIST_0_PATH, plasmaRankingDistribution.CR_OWN)), (int) getConfigLong(plasmaSwitchboardConstants.RANKING_DIST_0_METHOD, plasmaRankingDistribution.METHOD_ANYSENIOR), (int) getConfigLong(plasmaSwitchboardConstants.RANKING_DIST_0_METHOD, 0), getConfig(plasmaSwitchboardConstants.RANKING_DIST_0_TARGET, ""));+ rankingOtherDistribution = new plasmaRankingDistribution(log, peers, new File(rankingPath, getConfig(plasmaSwitchboardConstants.RANKING_DIST_1_PATH, plasmaRankingDistribution.CR_OTHER)), (int) getConfigLong(plasmaSwitchboardConstants.RANKING_DIST_1_METHOD, plasmaRankingDistribution.METHOD_MIXEDSENIOR), (int) getConfigLong(plasmaSwitchboardConstants.RANKING_DIST_1_METHOD, 30), getConfig(plasmaSwitchboardConstants.RANKING_DIST_1_TARGET, "kaskelix.de:8080,yacy.dyndns.org:8000"));// init nameCacheNoCachingListserverDomains.setNoCachingPatterns(getConfig(plasmaSwitchboardConstants.HTTPC_NAME_CACHE_CACHING_PATTERNS_NO,""));@@ -575,15 +592,17 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.plasmaSnippetCache.init(parser, log, this);// init the wiki- wikiParser = new wikiCode(this.webIndex.peers().mySeed().getClusterAddress());+ wikiParser = new wikiCode(this.peers.mySeed().getClusterAddress());// initializing the resourceObserverserverInstantBusyThread.oneTimeJob(ResourceObserver.class, "initThread", ResourceObserver.log, 0);// initializing the stackCrawlThreadthis.crawlStacker = new CrawlStacker(- crawlQueues,- this.webIndex,+ this.crawlQueues,+ this.crawler,+ this.indexSegment,+ this.peers,"local.any".indexOf(getConfig("network.unit.domain", "global")) >= 0,"global.any".indexOf(getConfig("network.unit.domain", "global")) >= 0);@@ -594,7 +613,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.// before we do that, we wait some time until the seed list is loaded.//while (((System.currentTimeMillis() - startedSeedListAquisition) < 8000) && (this.webIndex.seedDB.sizeConnected() == 0)) try {Thread.sleep(1000);} catch (final InterruptedException e) {}//try {Thread.sleep(1000);} catch (final InterruptedException e) {}- this.clusterhashes = this.webIndex.peers().clusterHashes(getConfig("cluster.peers.yacydomain", ""));+ this.clusterhashes = this.peers.clusterHashes(getConfig("cluster.peers.yacydomain", ""));// deploy blocking threadsint indexerThreads = Math.max(1, serverProcessor.useCPU / 2);@@ -645,8 +664,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.// test routine for snippet fetch//Set query = new HashSet();- //query.add(plasmaWordIndexEntry.word2hash("Weitergabe"));- //query.add(plasmaWordIndexEntry.word2hash("Zahl"));+ //query.add(CrawlSwitchboardEntry.word2hash("Weitergabe"));+ //query.add(CrawlSwitchboardEntry.word2hash("Zahl"));//plasmaSnippetCache.result scr = snippetCache.retrieve(new URL("http://www.heise.de/mobil/newsticker/meldung/mail/54980"), query, true);//plasmaSnippetCache.result scr = snippetCache.retrieve(new URL("http://www.heise.de/security/news/foren/go.shtml?read=1&msg_id=7301419&forum_id=72721"), query, true);//plasmaSnippetCache.result scr = snippetCache.retrieve(new URL("http://www.heise.de/kiosk/archiv/ct/2003/4/20"), query, true, 260);@@ -785,8 +804,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.// switch the networkssynchronized (this) {// shut down- synchronized (this.webIndex) {- this.webIndex.close();+ synchronized (this.indexSegment) {+ this.indexSegment.close();}this.crawlStacker.announceClose();this.crawlStacker.close();@@ -795,29 +814,43 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.setConfig("network.unit.definition", networkDefinition);overwriteNetworkDefinition();final File indexPrimaryPath = getConfigPath(plasmaSwitchboardConstants.INDEX_PRIMARY_PATH, plasmaSwitchboardConstants.INDEX_PATH_DEFAULT);- final File indexSecondaryPath = (getConfig(plasmaSwitchboardConstants.INDEX_SECONDARY_PATH, "").length() == 0) ? indexPrimaryPath : new File(getConfig(plasmaSwitchboardConstants.INDEX_SECONDARY_PATH, ""));final int wordCacheMaxCount = (int) getConfigLong(plasmaSwitchboardConstants.WORDCACHE_MAX_COUNT, 20000);final long fileSizeMax = (serverSystem.isWindows) ? sb.getConfigLong("filesize.max.win", (long) Integer.MAX_VALUE) : sb.getConfigLong("filesize.max.other", (long) Integer.MAX_VALUE);final int redundancy = (int) sb.getConfigLong("network.unit.dhtredundancy.senior", 1);- final int paritionExponent = (int) sb.getConfigLong("network.unit.dht.partitionExponent", 0);+ final int partitionExponent = (int) sb.getConfigLong("network.unit.dht.partitionExponent", 0);try {- this.webIndex = new plasmaWordIndex(- getConfig(plasmaSwitchboardConstants.NETWORK_NAME, ""),- getLog(),- indexPrimaryPath,- indexSecondaryPath,- wordCacheMaxCount,- fileSizeMax,- redundancy,- paritionExponent);+ String networkName = getConfig(plasmaSwitchboardConstants.NETWORK_NAME, "");+ final File networkRoot = new File(new File(indexPrimaryPath, networkName), "NETWORK");+ networkRoot.mkdirs();+ final File mySeedFile = new File(networkRoot, yacySeedDB.DBFILE_OWN_SEED);+ peers = new yacySeedDB(+ networkRoot,+ "seed.new.heap",+ "seed.old.heap",+ "seed.pot.heap",+ mySeedFile,+ redundancy,+ partitionExponent);+ indexSegment = new Segment(+ log,+ new File(new File(indexPrimaryPath, networkName), "TEXT"),+ wordCacheMaxCount,+ fileSizeMax);+ crawler = new CrawlSwitchboard(+ peers,+ networkName,+ log,+ new File(new File(indexPrimaryPath, networkName), "QUEUES"));} catch (IOException e) {e.printStackTrace();- this.webIndex = null;+ this.indexSegment = null;}// we need a new stacker, because this uses network-specific attributes to sort out urls (local, global)this.crawlStacker = new CrawlStacker(- crawlQueues,- this.webIndex,+ this.crawlQueues,+ this.crawler,+ this.indexSegment,+ this.peers,"local.any".indexOf(getConfig("network.unit.domain", "global")) >= 0,"global.any".indexOf(getConfig("network.unit.domain", "global")) >= 0);}@@ -964,12 +997,12 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.// 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 (webIndex.metadata().exists(hash)) return "loaded";+ if (indexSegment.metadata().exists(hash)) return "loaded";return this.crawlQueues.urlExists(hash);}public void urlRemove(final String hash) {- webIndex.metadata().remove(hash);+ indexSegment.metadata().remove(hash);crawlResults.remove(hash);crawlQueues.urlRemove(hash);}@@ -979,7 +1012,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.if (urlhash.length() == 0) return null;final yacyURL ne = crawlQueues.getURL(urlhash);if (ne != null) return ne;- final URLMetadataRow le = webIndex.metadata().load(urlhash, null, 0);+ final URLMetadataRow le = indexSegment.metadata().load(urlhash, null, 0);if (le != null) return le.metadata().url();return null;}@@ -1033,7 +1066,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.(crawlStacker != null && crawlStacker.size() > 0) ||(crawlQueues.noticeURL.notEmpty()))return false;- return this.webIndex.cleanProfiles();+ return this.crawler.cleanProfiles();}public boolean htEntryStoreProcess(final Document entry) {@@ -1071,7 +1104,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.doIndexing = false;}- synchronized (webIndex.queuePreStack) {+ synchronized (crawler.queuePreStack) {/* =========================================================================* STORING DATA*@@ -1107,7 +1140,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.if (doIndexing && isSupportedContent) {// enqueue for further crawling- enQueue(this.webIndex.queuePreStack.newEntry(+ enQueue(this.crawler.queuePreStack.newEntry(entry.url(),(entry.referrerURL() == null) ? null : entry.referrerURL().hash(),entry.ifModifiedSince(),@@ -1162,7 +1195,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.webStructure.close();crawlQueues.close();log.logConfig("SWITCHBOARD SHUTDOWN STEP 3: sending termination signal to database manager (stand by...)");- webIndex.close();+ indexSegment.close();+ peers.close();plasmaHTCache.close();UPnP.deletePortMapping();Tray.removeTray();@@ -1170,13 +1204,13 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.}public int queueSize() {- return webIndex.queuePreStack.size();+ return crawler.queuePreStack.size();}public void enQueue(final IndexingStack.QueueEntry job) {assert job != null;try {- webIndex.queuePreStack.push(job);+ crawler.queuePreStack.push(job);} catch (final IOException e) {log.logSevere("IOError in plasmaSwitchboard.enQueue: " + e.getMessage(), e);}@@ -1184,32 +1218,32 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.public void deQueueFreeMem() {// flush some entries from the RAM cache- webIndex.index().cleanupBuffer(5000);+ indexSegment.index().cleanupBuffer(5000);// empty some caches- webIndex.metadata().clearCache();+ indexSegment.metadata().clearCache();plasmaSearchEvent.cleanupEvents(true);}public IndexingStack.QueueEntry deQueue() {// getting the next entry from the indexing queueIndexingStack.QueueEntry nextentry = null;- synchronized (webIndex.queuePreStack) {+ synchronized (crawler.queuePreStack) {// do one processing step- if (this.log.isFine()) log.logFine("DEQUEUE: sbQueueSize=" + webIndex.queuePreStack.size() ++ if (this.log.isFine()) log.logFine("DEQUEUE: sbQueueSize=" + crawler.queuePreStack.size() +", coreStackSize=" + crawlQueues.noticeURL.stackSize(NoticedURL.STACK_TYPE_CORE) +", limitStackSize=" + crawlQueues.noticeURL.stackSize(NoticedURL.STACK_TYPE_LIMIT) +", overhangStackSize=" + crawlQueues.noticeURL.stackSize(NoticedURL.STACK_TYPE_OVERHANG) +", remoteStackSize=" + crawlQueues.noticeURL.stackSize(NoticedURL.STACK_TYPE_REMOTE));try {- final int sizeBefore = webIndex.queuePreStack.size();- nextentry = webIndex.queuePreStack.pop();+ final int sizeBefore = crawler.queuePreStack.size();+ nextentry = crawler.queuePreStack.pop();if (nextentry == null) {log.logWarning("deQueue: null entry on queue stack.");- if (webIndex.queuePreStack.size() == sizeBefore) {+ if (crawler.queuePreStack.size() == sizeBefore) {// this is a severe problem: because this time a null is returned, it means that this status will last forever// to re-enable use of the sbQueue, it must be emptied completelylog.logSevere("deQueue: does not shrink after pop() == null. Emergency reset.");- webIndex.queuePreStack.clear();+ crawler.queuePreStack.clear();}return null;}@@ -1243,7 +1277,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.// create a queue entryplasmaParserDocument document = surrogate.document();- queueentry = this.webIndex.queuePreStack.newEntry(surrogate.url(), null, null, false, null, 0, this.webIndex.defaultSurrogateProfile.handle(), null);+ queueentry = this.crawler.queuePreStack.newEntry(surrogate.url(), null, null, false, null, 0, this.crawler.defaultSurrogateProfile.handle(), null);/** public QueueEntry newEntry(final yacyURL url, final String referrer, final Date ifModifiedSince, final boolean requestWithCookie,final String initiator, final int depth, final String profilehandle, final String anchorName)@@ -1292,7 +1326,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.}// getting the next entry from the indexing queue- if (webIndex.queuePreStack.size() == 0) {+ if (crawler.queuePreStack.size() == 0) {//log.logFine("deQueue: nothing to do, queue is emtpy");return doneSomething; // nothing to do}@@ -1323,7 +1357,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.if (noIndexReason != null) {// this document should not be indexed. log cause and close queue- final yacyURL referrerURL = queueEntry.referrerURL();+ final yacyURL referrerURL = queueEntry.referrerURL(this.indexSegment.metadata());log.logFine("Not indexed any word in URL " + queueEntry.url() + "; cause: " + noIndexReason);addURLtoErrorDB(queueEntry.url(), (referrerURL == null) ? "" : referrerURL.hash(), queueEntry.initiator(), queueEntry.anchorName(), noIndexReason);// finish this entry@@ -1331,7 +1365,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.}// put document into the concurrent processing queue- webIndex.queuePreStack.enQueueToActive(queueEntry);+ crawler.queuePreStack.enQueueToActive(queueEntry);// check for interruptioncheckInterruption();@@ -1376,7 +1410,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.// clear caches if necessaryif (!MemoryControl.request(8000000L, false)) {- webIndex.metadata().clearCache();+ indexSegment.metadata().clearCache();plasmaSearchEvent.cleanupEvents(true);}@@ -1389,29 +1423,29 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.// refresh recrawl datestry{- Iterator<CrawlProfile.entry> it = webIndex.profilesActiveCrawls.profiles(true);+ Iterator<CrawlProfile.entry> it = crawler.profilesActiveCrawls.profiles(true);entry selentry;while (it.hasNext()) {selentry = it.next();- if (selentry.name().equals(plasmaWordIndex.CRAWL_PROFILE_PROXY))- webIndex.profilesActiveCrawls.changeEntry(selentry, CrawlProfile.entry.RECRAWL_IF_OLDER,- Long.toString(webIndex.profilesActiveCrawls.getRecrawlDate(plasmaWordIndex.CRAWL_PROFILE_PROXY_RECRAWL_CYCLE)));- // if (selentry.name().equals(plasmaWordIndex.CRAWL_PROFILE_REMOTE));- if (selentry.name().equals(plasmaWordIndex.CRAWL_PROFILE_SNIPPET_LOCAL_TEXT))- webIndex.profilesActiveCrawls.changeEntry(selentry, CrawlProfile.entry.RECRAWL_IF_OLDER,- Long.toString(webIndex.profilesActiveCrawls.getRecrawlDate(plasmaWordIndex.CRAWL_PROFILE_SNIPPET_LOCAL_TEXT_RECRAWL_CYCLE)));- if (selentry.name().equals(plasmaWordIndex.CRAWL_PROFILE_SNIPPET_GLOBAL_TEXT))- webIndex.profilesActiveCrawls.changeEntry(selentry, CrawlProfile.entry.RECRAWL_IF_OLDER,- Long.toString(webIndex.profilesActiveCrawls.getRecrawlDate(plasmaWordIndex.CRAWL_PROFILE_SNIPPET_GLOBAL_TEXT_RECRAWL_CYCLE)));- if (selentry.name().equals(plasmaWordIndex.CRAWL_PROFILE_SNIPPET_LOCAL_MEDIA))- webIndex.profilesActiveCrawls.changeEntry(selentry, CrawlProfile.entry.RECRAWL_IF_OLDER,- Long.toString(webIndex.profilesActiveCrawls.getRecrawlDate(plasmaWordIndex.CRAWL_PROFILE_SNIPPET_LOCAL_MEDIA_RECRAWL_CYCLE)));- if (selentry.name().equals(plasmaWordIndex.CRAWL_PROFILE_SNIPPET_GLOBAL_MEDIA))- webIndex.profilesActiveCrawls.changeEntry(selentry, CrawlProfile.entry.RECRAWL_IF_OLDER,- Long.toString(webIndex.profilesActiveCrawls.getRecrawlDate(plasmaWordIndex.CRAWL_PROFILE_SNIPPET_GLOBAL_MEDIA_RECRAWL_CYCLE)));- if (selentry.name().equals(plasmaWordIndex.CRAWL_PROFILE_SURROGATE))- webIndex.profilesActiveCrawls.changeEntry(selentry, CrawlProfile.entry.RECRAWL_IF_OLDER,- Long.toString(webIndex.profilesActiveCrawls.getRecrawlDate(plasmaWordIndex.CRAWL_PROFILE_SURROGATE_RECRAWL_CYCLE)));+ if (selentry.name().equals(CrawlSwitchboard.CRAWL_PROFILE_PROXY))+ crawler.profilesActiveCrawls.changeEntry(selentry, CrawlProfile.entry.RECRAWL_IF_OLDER,+ Long.toString(crawler.profilesActiveCrawls.getRecrawlDate(CrawlSwitchboard.CRAWL_PROFILE_PROXY_RECRAWL_CYCLE)));+ // if (selentry.name().equals(CrawlSwitchboard.CRAWL_PROFILE_REMOTE));+ if (selentry.name().equals(CrawlSwitchboard.CRAWL_PROFILE_SNIPPET_LOCAL_TEXT))+ crawler.profilesActiveCrawls.changeEntry(selentry, CrawlProfile.entry.RECRAWL_IF_OLDER,+ Long.toString(crawler.profilesActiveCrawls.getRecrawlDate(CrawlSwitchboard.CRAWL_PROFILE_SNIPPET_LOCAL_TEXT_RECRAWL_CYCLE)));+ if (selentry.name().equals(CrawlSwitchboard.CRAWL_PROFILE_SNIPPET_GLOBAL_TEXT))+ crawler.profilesActiveCrawls.changeEntry(selentry, CrawlProfile.entry.RECRAWL_IF_OLDER,+ Long.toString(crawler.profilesActiveCrawls.getRecrawlDate(CrawlSwitchboard.CRAWL_PROFILE_SNIPPET_GLOBAL_TEXT_RECRAWL_CYCLE)));+ if (selentry.name().equals(CrawlSwitchboard.CRAWL_PROFILE_SNIPPET_LOCAL_MEDIA))+ crawler.profilesActiveCrawls.changeEntry(selentry, CrawlProfile.entry.RECRAWL_IF_OLDER,+ Long.toString(crawler.profilesActiveCrawls.getRecrawlDate(CrawlSwitchboard.CRAWL_PROFILE_SNIPPET_LOCAL_MEDIA_RECRAWL_CYCLE)));+ if (selentry.name().equals(CrawlSwitchboard.CRAWL_PROFILE_SNIPPET_GLOBAL_MEDIA))+ crawler.profilesActiveCrawls.changeEntry(selentry, CrawlProfile.entry.RECRAWL_IF_OLDER,+ Long.toString(crawler.profilesActiveCrawls.getRecrawlDate(CrawlSwitchboard.CRAWL_PROFILE_SNIPPET_GLOBAL_MEDIA_RECRAWL_CYCLE)));+ if (selentry.name().equals(CrawlSwitchboard.CRAWL_PROFILE_SURROGATE))+ crawler.profilesActiveCrawls.changeEntry(selentry, CrawlProfile.entry.RECRAWL_IF_OLDER,+ Long.toString(crawler.profilesActiveCrawls.getRecrawlDate(CrawlSwitchboard.CRAWL_PROFILE_SURROGATE_RECRAWL_CYCLE)));}} catch (final IOException e) {};@@ -1463,20 +1497,20 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.// clean up newscheckInterruption();try {- if (this.log.isFine()) log.logFine("Cleaning Incoming News, " + this.webIndex.peers().newsPool.size(yacyNewsPool.INCOMING_DB) + " entries on stack");- if (this.webIndex.peers().newsPool.automaticProcess(webIndex.peers()) > 0) hasDoneSomething = true;+ if (this.log.isFine()) log.logFine("Cleaning Incoming News, " + this.peers.newsPool.size(yacyNewsPool.INCOMING_DB) + " entries on stack");+ if (this.peers.newsPool.automaticProcess(peers) > 0) hasDoneSomething = true;} catch (final IOException e) {}if (getConfigBool("cleanup.deletionProcessedNews", true)) {- this.webIndex.peers().newsPool.clear(yacyNewsPool.PROCESSED_DB);+ this.peers.newsPool.clear(yacyNewsPool.PROCESSED_DB);}if (getConfigBool("cleanup.deletionPublishedNews", true)) {- this.webIndex.peers().newsPool.clear(yacyNewsPool.PUBLISHED_DB);+ this.peers.newsPool.clear(yacyNewsPool.PUBLISHED_DB);}// clean up seed-dbsif(getConfigBool("routing.deleteOldSeeds.permission",true)) {final long deleteOldSeedsTime = getConfigLong("routing.deleteOldSeeds.time",7)*24*3600000;- Iterator<yacySeed> e = this.webIndex.peers().seedsSortedDisconnected(true,yacySeed.LASTSEEN);+ Iterator<yacySeed> e = this.peers.seedsSortedDisconnected(true,yacySeed.LASTSEEN);yacySeed seed = null;final ArrayList<String> deleteQueue = new ArrayList<String>();checkInterruption();@@ -1490,9 +1524,9 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.deleteQueue.add(seed.hash);}}- for(int i=0;i<deleteQueue.size();++i) this.webIndex.peers().removeDisconnected(deleteQueue.get(i));+ for(int i=0;i<deleteQueue.size();++i) this.peers.removeDisconnected(deleteQueue.get(i));deleteQueue.clear();- e = this.webIndex.peers().seedsSortedPotential(true,yacySeed.LASTSEEN);+ e = this.peers.seedsSortedPotential(true,yacySeed.LASTSEEN);checkInterruption();//clean potential seedswhile(e.hasNext()) {@@ -1504,7 +1538,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.deleteQueue.add(seed.hash);}}- for (int i = 0; i < deleteQueue.size(); ++i) this.webIndex.peers().removePotential(deleteQueue.get(i));+ for (int i = 0; i < deleteQueue.size(); ++i) this.peers.removePotential(deleteQueue.get(i));}// check if update is available and@@ -1527,7 +1561,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.}// initiate broadcast about peer startup to spread supporter url- if (this.webIndex.peers().newsPool.size(yacyNewsPool.OUTGOING_DB) == 0) {+ if (this.peers.newsPool.size(yacyNewsPool.OUTGOING_DB) == 0) {// read profilefinal Properties profile = new Properties();FileInputStream fileIn = null;@@ -1542,12 +1576,12 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.if ((homepage != null) && (homepage.length() > 10)) {final Properties news = new Properties();news.put("homepage", profile.get("homepage"));- this.webIndex.peers().newsPool.publishMyNews(yacyNewsRecord.newRecord(webIndex.peers().mySeed(), yacyNewsPool.CATEGORY_PROFILE_BROADCAST, news));+ this.peers.newsPool.publishMyNews(yacyNewsRecord.newRecord(peers.mySeed(), yacyNewsPool.CATEGORY_PROFILE_BROADCAST, news));}}// update the cluster set- this.clusterhashes = this.webIndex.peers().clusterHashes(getConfig("cluster.peers.yacydomain", ""));+ this.clusterhashes = this.peers.clusterHashes(getConfig("cluster.peers.yacydomain", ""));// after all clean up is done, check the resource usage@@ -1738,7 +1772,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.// CREATE INDEXfinal String dc_title = document.dc_title();- final yacyURL referrerURL = queueEntry.referrerURL();+ final yacyURL referrerURL = queueEntry.referrerURL(this.indexSegment.metadata());final int processCase = queueEntry.processCase();// remove stopwords@@ -1747,7 +1781,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.// STORE URL TO LOADED-URL-DBURLMetadataRow newEntry = null;try {- newEntry = webIndex.storeDocument(queueEntry, document, condenser);+ newEntry = indexSegment.storeDocument(queueEntry, document, condenser);+ RSSFeed.channels((queueEntry.initiator().equals(peers.mySeed().hash)) ? RSSFeed.LOCALINDEXING : RSSFeed.REMOTEINDEXING).addMessage(new RSSMessage("Indexed web page", dc_title, queueEntry.url().toNormalform(true, false)));} catch (final IOException e) {if (this.log.isFine()) log.logFine("Not Indexed Resource '" + queueEntry.url().toNormalform(false, true) + "': process case=" + processCase);addURLtoErrorDB(queueEntry.url(), referrerURL.hash(), queueEntry.initiator(), dc_title, "error storing url: " + e.getMessage());@@ -1758,7 +1793,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.crawlResults.stack(newEntry, // loaded url db entryqueueEntry.initiator(), // initiator peer hash- this.webIndex.peers().mySeed().hash, // executor peer hash+ this.peers.mySeed().hash, // executor peer hashprocessCase // process case);@@ -1800,7 +1835,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.this.reference = reference;}public void run() {- yacyClient.crawlReceipt(webIndex.peers().mySeed(), initiatorPeer, "crawl", "fill", "indexed", reference, "");+ yacyClient.crawlReceipt(peers.mySeed(), initiatorPeer, "crawl", "fill", "indexed", reference, "");}}@@ -1826,7 +1861,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.public String toString() {// it is possible to use this method in the cgi pages.// actually it is used there for testing purpose- return "PROPS: " + super.toString() + "; QUEUE: " + webIndex.queuePreStack.toString();+ return "PROPS: " + super.toString() + "; QUEUE: " + crawler.queuePreStack.toString();}// method for index deletion@@ -1840,7 +1875,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.if (urlhash == null) return 0;// determine the url string- final URLMetadataRow entry = webIndex.metadata().load(urlhash, null, 0);+ final URLMetadataRow entry = indexSegment.metadata().load(urlhash, null, 0);if (entry == null) return 0;final URLMetadataRow.Components metadata = entry.metadata();if (metadata.url() == null) return 0;@@ -1856,7 +1891,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.}if (resource == null) {// delete just the url entry- webIndex.metadata().remove(urlhash);+ indexSegment.metadata().remove(urlhash);return 0;} else {resourceContent = (InputStream) resource[0];@@ -1875,10 +1910,10 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.// delete all word referencesint count = 0;- if (words != null) count = webIndex.index().remove(Word.words2hashes(words), urlhash);+ if (words != null) count = indexSegment.index().remove(Word.words2hashes(words), urlhash);// finally delete the url entry itself- webIndex.metadata().remove(urlhash);+ indexSegment.metadata().remove(urlhash);return count;}} catch (final ParserException e) {@@ -1974,16 +2009,16 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.}public String dhtShallTransfer() {- if (this.webIndex.peers() == null) {+ if (this.peers == null) {return "no DHT distribution: seedDB == null";}- if (this.webIndex.peers().mySeed() == null) {+ if (this.peers.mySeed() == null) {return "no DHT distribution: mySeed == null";}- if (this.webIndex.peers().mySeed().isVirgin()) {+ if (this.peers.mySeed().isVirgin()) {return "no DHT distribution: status is virgin";}- if (this.webIndex.peers().noDHTActivity()) {+ if (this.peers.noDHTActivity()) {return "no DHT distribution: network too small";}if (!this.getConfigBool("network.unit.dht", true)) {@@ -1992,17 +2027,17 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.if (getConfig(plasmaSwitchboardConstants.INDEX_DIST_ALLOW, "false").equalsIgnoreCase("false")) {return "no DHT distribution: not enabled (ser setting)";}- if (webIndex.metadata().size() < 10) {- return "no DHT distribution: loadedURL.size() = " + webIndex.metadata().size();+ if (indexSegment.metadata().size() < 10) {+ return "no DHT distribution: loadedURL.size() = " + indexSegment.metadata().size();}- if (webIndex.index().size() < 100) {- return "no DHT distribution: not enough words - wordIndex.size() = " + webIndex.index().size();+ if (indexSegment.index().size() < 100) {+ return "no DHT distribution: not enough words - wordIndex.size() = " + indexSegment.index().size();}if ((getConfig(plasmaSwitchboardConstants.INDEX_DIST_ALLOW_WHILE_CRAWLING, "false").equalsIgnoreCase("false")) && (crawlQueues.noticeURL.notEmptyLocal())) {- return "no DHT distribution: crawl in progress: noticeURL.stackSize() = " + crawlQueues.noticeURL.size() + ", sbQueue.size() = " + webIndex.queuePreStack.size();+ return "no DHT distribution: crawl in progress: noticeURL.stackSize() = " + crawlQueues.noticeURL.size() + ", sbQueue.size() = " + crawler.queuePreStack.size();}- if ((getConfig(plasmaSwitchboardConstants.INDEX_DIST_ALLOW_WHILE_INDEXING, "false").equalsIgnoreCase("false")) && (webIndex.queuePreStack.size() > 1)) {- return "no DHT distribution: indexing in progress: noticeURL.stackSize() = " + crawlQueues.noticeURL.size() + ", sbQueue.size() = " + webIndex.queuePreStack.size();+ if ((getConfig(plasmaSwitchboardConstants.INDEX_DIST_ALLOW_WHILE_INDEXING, "false").equalsIgnoreCase("false")) && (crawler.queuePreStack.size() > 1)) {+ return "no DHT distribution: indexing in progress: noticeURL.stackSize() = " + crawlQueues.noticeURL.size() + ", sbQueue.size() = " + crawler.queuePreStack.size();}return null; // this means; yes, please do dht transfer}@@ -2014,7 +2049,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.return false;}boolean hasDoneSomething = false;- if (this.dhtDispatcher.cloudSize() > this.webIndex.peers().scheme.verticalPartitions() * 4) {+ if (this.dhtDispatcher.cloudSize() > this.peers.scheme.verticalPartitions() * 4) {log.logInfo("dhtTransferJob: no selection, too many entries in transmission cloud: " + this.dhtDispatcher.cloudSize());} else if (MemoryControl.available() < 1024*1024*25) {log.logInfo("dhtTransferJob: no selection, too less memory available : " + (MemoryControl.available() / 1024 / 1024) + " MB");@@ -2024,7 +2059,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.while (tries-- > 0) {startHash = PeerSelection.selectTransferStart();assert startHash != null;- limitHash = PeerSelection.limitOver(this.webIndex.peers(), startHash);+ limitHash = PeerSelection.limitOver(this.peers, startHash);if (limitHash != null) break;}if (limitHash == null || startHash == null) {@@ -2095,28 +2130,28 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.// generate new peer namesetConfig("peerName", yacySeed.makeDefaultPeerName());}- webIndex.peers().mySeed().put(yacySeed.NAME, getConfig("peerName", "nameless"));- webIndex.peers().mySeed().put(yacySeed.PORT, Integer.toString(serverCore.getPortNr(getConfig("port", "8080"))));+ peers.mySeed().put(yacySeed.NAME, getConfig("peerName", "nameless"));+ peers.mySeed().put(yacySeed.PORT, Integer.toString(serverCore.getPortNr(getConfig("port", "8080"))));//the speed of indexing (pages/minute) of the peerfinal long uptime = (System.currentTimeMillis() - serverCore.startupTime) / 1000;- webIndex.peers().mySeed().put(yacySeed.ISPEED, Integer.toString(currentPPM()));+ peers.mySeed().put(yacySeed.ISPEED, Integer.toString(currentPPM()));totalQPM = requestedQueries * 60d / Math.max(uptime, 1d);- webIndex.peers().mySeed().put(yacySeed.RSPEED, Double.toString(totalQPM /*Math.max((float) requestcdiff, 0f) * 60f / Math.max((float) uptimediff, 1f)*/ ));-- webIndex.peers().mySeed().put(yacySeed.UPTIME, Long.toString(uptime/60)); // the number of minutes that the peer is up in minutes/day (moving average MA30)- webIndex.peers().mySeed().put(yacySeed.LCOUNT, Integer.toString(webIndex.metadata().size())); // the number of links that the peer has stored (LURL's)- webIndex.peers().mySeed().put(yacySeed.NCOUNT, Integer.toString(crawlQueues.noticeURL.size())); // the number of links that the peer has noticed, but not loaded (NURL's)- webIndex.peers().mySeed().put(yacySeed.RCOUNT, Integer.toString(crawlQueues.noticeURL.stackSize(NoticedURL.STACK_TYPE_LIMIT))); // the number of links that the peer provides for remote crawling (ZURL's)- webIndex.peers().mySeed().put(yacySeed.ICOUNT, Integer.toString(webIndex.index().size())); // the minimum number of words that the peer has indexed (as it says)- webIndex.peers().mySeed().put(yacySeed.SCOUNT, Integer.toString(webIndex.peers().sizeConnected())); // the number of seeds that the peer has stored- webIndex.peers().mySeed().put(yacySeed.CCOUNT, Double.toString(((int) ((webIndex.peers().sizeConnected() + webIndex.peers().sizeDisconnected() + webIndex.peers().sizePotential()) * 60.0 / (uptime + 1.01)) * 100) / 100.0)); // the number of clients that the peer connects (as connects/hour)- webIndex.peers().mySeed().put(yacySeed.VERSION, getConfig("version", ""));- webIndex.peers().mySeed().setFlagDirectConnect(true);- webIndex.peers().mySeed().setLastSeenUTC();- webIndex.peers().mySeed().put(yacySeed.UTC, DateFormatter.UTCDiffString());- webIndex.peers().mySeed().setFlagAcceptRemoteCrawl(getConfig("crawlResponse", "").equals("true"));- webIndex.peers().mySeed().setFlagAcceptRemoteIndex(getConfig("allowReceiveIndex", "").equals("true"));+ peers.mySeed().put(yacySeed.RSPEED, Double.toString(totalQPM /*Math.max((float) requestcdiff, 0f) * 60f / Math.max((float) uptimediff, 1f)*/ ));++ peers.mySeed().put(yacySeed.UPTIME, Long.toString(uptime/60)); // the number of minutes that the peer is up in minutes/day (moving average MA30)+ peers.mySeed().put(yacySeed.LCOUNT, Integer.toString(indexSegment.metadata().size())); // the number of links that the peer has stored (LURL's)+ peers.mySeed().put(yacySeed.NCOUNT, Integer.toString(crawlQueues.noticeURL.size())); // the number of links that the peer has noticed, but not loaded (NURL's)+ peers.mySeed().put(yacySeed.RCOUNT, Integer.toString(crawlQueues.noticeURL.stackSize(NoticedURL.STACK_TYPE_LIMIT))); // the number of links that the peer provides for remote crawling (ZURL's)+ peers.mySeed().put(yacySeed.ICOUNT, Integer.toString(indexSegment.index().size())); // the minimum number of words that the peer has indexed (as it says)+ peers.mySeed().put(yacySeed.SCOUNT, Integer.toString(peers.sizeConnected())); // the number of seeds that the peer has stored+ peers.mySeed().put(yacySeed.CCOUNT, Double.toString(((int) ((peers.sizeConnected() + peers.sizeDisconnected() + peers.sizePotential()) * 60.0 / (uptime + 1.01)) * 100) / 100.0)); // the number of clients that the peer connects (as connects/hour)+ peers.mySeed().put(yacySeed.VERSION, getConfig("version", ""));+ peers.mySeed().setFlagDirectConnect(true);+ peers.mySeed().setLastSeenUTC();+ peers.mySeed().put(yacySeed.UTC, DateFormatter.UTCDiffString());+ peers.mySeed().setFlagAcceptRemoteCrawl(getConfig("crawlResponse", "").equals("true"));+ peers.mySeed().setFlagAcceptRemoteIndex(getConfig("allowReceiveIndex", "").equals("true"));//mySeed.setFlagAcceptRemoteIndex(true);}@@ -2129,7 +2164,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.ArrayList<String> seedList;Iterator<String> enu;int lc;- final int sc = webIndex.peers().sizeConnected();+ final int sc = peers.sizeConnected();httpResponseHeader header;yacyCore.log.logInfo("BOOTSTRAP: " + sc + " seeds known from previous run");@@ -2175,8 +2210,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.while (enu.hasNext()) {ys = yacySeed.genRemoteSeed(enu.next(), null, false);if ((ys != null) &&- ((!webIndex.peers().mySeedIsDefined()) || !webIndex.peers().mySeed().hash.equals(ys.hash))) {- if (webIndex.peers().peerActions.connectPeer(ys, false)) lc++;+ ((!peers.mySeedIsDefined()) || !peers.mySeed().hash.equals(ys.hash))) {+ if (peers.peerActions.connectPeer(ys, false)) lc++;//seedDB.writeMap(ys.hash, ys.getMap(), "init");//System.out.println("BOOTSTRAP: received peer " + ys.get(yacySeed.NAME, "anonymous") + "/" + ys.getAddress());//lc++;@@ -2194,7 +2229,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.}}}- yacyCore.log.logInfo("BOOTSTRAP: " + (webIndex.peers().sizeConnected() - sc) + " new seeds while bootstraping.");+ yacyCore.log.logInfo("BOOTSTRAP: " + (peers.sizeConnected() - sc) + " new seeds while bootstraping.");}public void checkInterruption() throws InterruptedException {diff --git a/source/de/anomic/urlRedirector/urlRedirectord.java b/source/de/anomic/urlRedirector/urlRedirectord.javaindex bbe78c7cf..652a511c2 100644--- a/source/de/anomic/urlRedirector/urlRedirectord.java+++ b/source/de/anomic/urlRedirector/urlRedirectord.java@@ -34,7 +34,7 @@ public class urlRedirectord implements serverHandler, Cloneable {}if (profile == null) {- profile = sb.webIndex.profilesActiveCrawls.newEntry(+ profile = sb.crawler.profilesActiveCrawls.newEntry(// name"URL Redirector",// start URL@@ -151,7 +151,7 @@ public class urlRedirectord implements serverHandler, Cloneable {if (pos != -1) {final String newDepth = line.substring(pos).trim();theLogger.logFine("Changing crawling depth to '" + newDepth + "'.");- sb.webIndex.profilesActiveCrawls.changeEntry(profile, "generalDepth",newDepth);+ sb.crawler.profilesActiveCrawls.changeEntry(profile, "generalDepth",newDepth);}outputWriter.print("\r\n");outputWriter.flush();@@ -160,7 +160,7 @@ public class urlRedirectord implements serverHandler, Cloneable {if (pos != -1) {final String newValue = line.substring(pos).trim();theLogger.logFine("Changing crawl dynamic setting to '" + newValue + "'");- sb.webIndex.profilesActiveCrawls.changeEntry(profile, "crawlingQ",newValue);+ sb.crawler.profilesActiveCrawls.changeEntry(profile, "crawlingQ",newValue);}outputWriter.print("\r\n");outputWriter.flush();@@ -191,13 +191,13 @@ public class urlRedirectord implements serverHandler, Cloneable {) {// first delete old entry, if existsfinal String urlhash = reqURL.hash();- sb.webIndex.metadata().remove(urlhash);+ sb.indexSegment.metadata().remove(urlhash);sb.crawlQueues.noticeURL.removeByURLHash(urlhash);sb.crawlQueues.errorURL.remove(urlhash);// enqueuing URL for crawlingsb.crawlStacker.enqueueEntry(new CrawlEntry(- sb.webIndex.peers().mySeed().hash,+ sb.peers.mySeed().hash,reqURL,null,"URL Redirector",diff --git a/source/de/anomic/yacy/dht/Dispatcher.java b/source/de/anomic/yacy/dht/Dispatcher.javaindex 3e495a0f8..e154d849f 100755--- a/source/de/anomic/yacy/dht/Dispatcher.java+++ b/source/de/anomic/yacy/dht/Dispatcher.java@@ -36,10 +36,10 @@ import de.anomic.kelondro.order.Base64Order;import de.anomic.kelondro.text.BufferedIndex;import de.anomic.kelondro.text.ReferenceContainer;import de.anomic.kelondro.text.MetadataRepository;+import de.anomic.kelondro.text.Segment;import de.anomic.kelondro.text.referencePrototype.WordReference;import de.anomic.kelondro.text.referencePrototype.WordReferenceRow;import de.anomic.kelondro.util.Log;-import de.anomic.plasma.plasmaWordIndex;import de.anomic.server.serverProcessor;import de.anomic.yacy.yacySeed;import de.anomic.yacy.yacySeedDB;@@ -228,7 +228,7 @@ public class Dispatcher {for (ReferenceContainer container: containers) {// init the new partitionsfor (int j = 0; j < partitionBuffer.length; j++) {- partitionBuffer[j] = new ReferenceContainer(plasmaWordIndex.wordReferenceFactory, container.getTermHash(), container.row(), container.size() / partitionCount);+ partitionBuffer[j] = new ReferenceContainer(Segment.wordReferenceFactory, container.getTermHash(), container.row(), container.size() / partitionCount);}// split the containerdiff --git a/source/de/anomic/yacy/dht/Transmission.java b/source/de/anomic/yacy/dht/Transmission.javaindex 83eb9160b..50d252b6a 100644--- a/source/de/anomic/yacy/dht/Transmission.java+++ b/source/de/anomic/yacy/dht/Transmission.java@@ -35,10 +35,10 @@ import de.anomic.kelondro.text.Index;import de.anomic.kelondro.text.ReferenceContainer;import de.anomic.kelondro.text.ReferenceContainerCache;import de.anomic.kelondro.text.MetadataRepository;+import de.anomic.kelondro.text.Segment;import de.anomic.kelondro.text.metadataPrototype.URLMetadataRow;import de.anomic.kelondro.text.referencePrototype.WordReference;import de.anomic.kelondro.util.Log;-import de.anomic.plasma.plasmaWordIndex;import de.anomic.server.serverProcessorJob;import de.anomic.yacy.yacyClient;import de.anomic.yacy.yacySeed;@@ -107,7 +107,7 @@ public class Transmission {final Row payloadrow) {super();this.primaryTarget = primaryTarget;- this.containers = new ReferenceContainerCache<WordReference>(plasmaWordIndex.wordReferenceFactory, payloadrow, plasmaWordIndex.wordOrder);+ this.containers = new ReferenceContainerCache<WordReference>(Segment.wordReferenceFactory, payloadrow, Segment.wordOrder);this.containers.initWriteMode();this.references = new HashMap<String, URLMetadataRow>();this.badReferences = new HashSet<String>();diff --git a/source/de/anomic/yacy/yacyClient.java b/source/de/anomic/yacy/yacyClient.javaindex 494d83e57..ff5c8d662 100644--- a/source/de/anomic/yacy/yacyClient.java+++ b/source/de/anomic/yacy/yacyClient.java@@ -73,6 +73,7 @@ import de.anomic.kelondro.order.Digest;import de.anomic.kelondro.text.Reference;import de.anomic.kelondro.text.ReferenceContainer;import de.anomic.kelondro.text.ReferenceContainerCache;+import de.anomic.kelondro.text.Segment;import de.anomic.kelondro.text.metadataPrototype.URLMetadataRow;import de.anomic.kelondro.text.referencePrototype.WordReference;import de.anomic.kelondro.util.ByteBuffer;@@ -82,7 +83,6 @@ import de.anomic.plasma.plasmaSearchRankingProfile;import de.anomic.plasma.plasmaSnippetCache;import de.anomic.plasma.plasmaSwitchboard;import de.anomic.plasma.plasmaSwitchboardConstants;-import de.anomic.plasma.plasmaWordIndex;import de.anomic.plasma.parser.Word;import de.anomic.server.serverCore;import de.anomic.server.serverDomains;@@ -431,7 +431,7 @@ public final class yacyClient {final boolean global,final int partitions,final yacySeed target,- final plasmaWordIndex wordIndex,+ final Segment indexSegment,final ResultURLs crawlResults,final plasmaSearchRankingProcess containerCache,final Map<String, TreeMap<String, String>> abstractCache,@@ -529,7 +529,7 @@ public final class yacyClient {final int words = wordhashes.length() / yacySeedDB.commonHashLength;final ReferenceContainer<WordReference>[] container = new ReferenceContainer[words];for (int i = 0; i < words; i++) {- container[i] = ReferenceContainer.emptyContainer(plasmaWordIndex.wordReferenceFactory, wordhashes.substring(i * yacySeedDB.commonHashLength, (i + 1) * yacySeedDB.commonHashLength).getBytes(), count);+ container[i] = ReferenceContainer.emptyContainer(Segment.wordReferenceFactory, wordhashes.substring(i * yacySeedDB.commonHashLength, (i + 1) * yacySeedDB.commonHashLength).getBytes(), count);}// insert results to containers@@ -569,7 +569,7 @@ public final class yacyClient {// passed all checks, store urltry {- wordIndex.metadata().store(urlEntry);+ indexSegment.metadata().store(urlEntry);crawlResults.stack(urlEntry, mySeed.hash, target.hash, 2);} catch (final IOException e) {yacyCore.log.logSevere("could not store search result", e);@@ -638,7 +638,7 @@ public final class yacyClient {// insert the containers to the indexfor (int m = 0; m < words; m++) try {- wordIndex.index().add(container[m]);+ indexSegment.index().add(container[m]);} catch (IOException e) {e.printStackTrace();}@@ -1076,7 +1076,7 @@ public final class yacyClient {final plasmaSwitchboard sb = new plasmaSwitchboard(new File(args[0]), "httpProxy.init", "DATA/SETTINGS/yacy.conf", false);/*final yacyCore core =*/ new yacyCore(sb);sb.loadSeedLists();- final yacySeed target = sb.webIndex.peers().getConnected(args[1]);+ final yacySeed target = sb.peers.getConnected(args[1]);final byte[] wordhashe = Word.word2hash("test");//System.out.println("permission=" + permissionMessage(args[1]));@@ -1084,9 +1084,9 @@ public final class yacyClient {reqHeader.put(httpRequestHeader.USER_AGENT, HTTPLoader.crawlerUserAgent);final byte[] content = httpClient.wget("http://" + target.getPublicAddress() + "/yacy/search.html" +- "?myseed=" + sb.webIndex.peers().mySeed().genSeedStr(null) ++ "?myseed=" + sb.peers.mySeed().genSeedStr(null) +"&youare=" + target.hash + "&key=" +- "&myseed=" + sb.webIndex.peers().mySeed() .genSeedStr(null) ++ "&myseed=" + sb.peers.mySeed() .genSeedStr(null) +"&count=10" +"&resource=global" +"&query=" + new String(wordhashe) +diff --git a/source/de/anomic/yacy/yacyCore.java b/source/de/anomic/yacy/yacyCore.javaindex b1bcfe5d9..4944707cf 100644--- a/source/de/anomic/yacy/yacyCore.java+++ b/source/de/anomic/yacy/yacyCore.java@@ -103,7 +103,7 @@ public class yacyCore {final String staticIP = sb.getConfig("staticIP", "");if (staticIP.length() != 0 && yacySeed.isProperIP(staticIP) == null) {serverCore.useStaticIP = true;- sb.webIndex.peers().mySeed().setIP(staticIP);+ sb.peers.mySeed().setIP(staticIP);log.logInfo("staticIP set to "+ staticIP);} else {serverCore.useStaticIP = false;@@ -134,11 +134,11 @@ public class yacyCore {yacyCore.log.logDebug("***DEBUG publishSeedList: I can reach myself");*/- if ((sb.webIndex.peers().lastSeedUpload_myIP.equals(sb.webIndex.peers().mySeed().getIP())) &&- (sb.webIndex.peers().lastSeedUpload_seedDBSize == sb.webIndex.peers().sizeConnected()) &&+ if ((sb.peers.lastSeedUpload_myIP.equals(sb.peers.mySeed().getIP())) &&+ (sb.peers.lastSeedUpload_seedDBSize == sb.peers.sizeConnected()) &&(canReachMyself()) &&- (System.currentTimeMillis() - sb.webIndex.peers().lastSeedUpload_timeStamp < 1000 * 60 * 60 * 24) &&- (sb.webIndex.peers().mySeed().isPrincipal())+ (System.currentTimeMillis() - sb.peers.lastSeedUpload_timeStamp < 1000 * 60 * 60 * 24) &&+ (sb.peers.mySeed().isPrincipal())) {if (log.isFine()) log.logFine("yacyCore.publishSeedList: not necessary to publish: oldIP is equal, sizeConnected is equal and I can reach myself under the old IP.");return;@@ -185,29 +185,29 @@ public class yacyCore {sb.updateMySeed();// publish own seed to other peer, this can every peer, but makes only sense for senior peers- if (sb.webIndex.peers().sizeConnected() == 0) {+ if (sb.peers.sizeConnected() == 0) {// reload the seed listssb.loadSeedLists();- log.logInfo("re-initialized seed list. received " + sb.webIndex.peers().sizeConnected() + " new peer(s)");+ log.logInfo("re-initialized seed list. received " + sb.peers.sizeConnected() + " new peer(s)");}final int newSeeds = publishMySeed(false);if (newSeeds > 0) {- log.logInfo("received " + newSeeds + " new peer(s), know a total of " + sb.webIndex.peers().sizeConnected() + " different peers");+ log.logInfo("received " + newSeeds + " new peer(s), know a total of " + sb.peers.sizeConnected() + " different peers");}}private boolean canReachMyself() { // TODO: check if this method is necessary - depending on the used router it will not work// returns true if we can reach ourself under our known peer address// if we cannot reach ourself, we call a forced publishMySeed and return false- final int urlc = yacyClient.queryUrlCount(sb.webIndex.peers().mySeed());+ final int urlc = yacyClient.queryUrlCount(sb.peers.mySeed());if (urlc >= 0) {- sb.webIndex.peers().mySeed().setLastSeenUTC();+ sb.peers.mySeed().setLastSeenUTC();return true;}log.logInfo("re-connect own seed");- final String oldAddress = sb.webIndex.peers().mySeed().getPublicAddress();+ final String oldAddress = sb.peers.mySeed().getPublicAddress();/*final int newSeeds =*/ publishMySeed(true);- return (oldAddress != null && oldAddress.equals(sb.webIndex.peers().mySeed().getPublicAddress()));+ return (oldAddress != null && oldAddress.equals(sb.peers.mySeed().getPublicAddress()));}protected class publishThread extends Thread {@@ -230,24 +230,24 @@ public class yacyCore {public final void run() {try {- this.added = yacyClient.publishMySeed(sb.webIndex.peers().mySeed(), sb.webIndex.peers().peerActions, seed.getClusterAddress(), seed.hash);+ this.added = yacyClient.publishMySeed(sb.peers.mySeed(), sb.peers.peerActions, seed.getClusterAddress(), seed.hash);if (this.added < 0) {// no or wrong response, delete that addressfinal String cause = "peer ping to peer resulted in error response (added < 0)";log.logInfo("publish: disconnected " + this.seed.get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_SENIOR) + " peer '" + this.seed.getName() + "' from " + this.seed.getPublicAddress() + ": " + cause);- sb.webIndex.peers().peerActions.peerDeparture(this.seed, cause);+ sb.peers.peerActions.peerDeparture(this.seed, cause);} else {// success! we have published our peer to a senior peer// update latest news from the other peerlog.logInfo("publish: handshaked " + this.seed.get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_SENIOR) + " peer '" + this.seed.getName() + "' at " + this.seed.getPublicAddress());// check if seed's lastSeen has been updated- final yacySeed newSeed = sb.webIndex.peers().getConnected(this.seed.hash);+ final yacySeed newSeed = sb.peers.getConnected(this.seed.hash);if (newSeed != null) {if (!newSeed.isOnline()) {if (log.isFine()) log.logFine("publish: recently handshaked " + this.seed.get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_SENIOR) +" peer '" + this.seed.getName() + "' at " + this.seed.getPublicAddress() + " is not online." +" Removing Peer from connected");- sb.webIndex.peers().peerActions.peerDeparture(newSeed, "peer not online");+ sb.peers.peerActions.peerDeparture(newSeed, "peer not online");} elseif (newSeed.getLastSeenUTC() < (System.currentTimeMillis() - 10000)) {// update last seed date@@ -256,14 +256,14 @@ public class yacyCore {" peer '" + this.seed.getName() + "' at " + this.seed.getPublicAddress() + " with old LastSeen: '" +DateFormatter.formatShortSecond(new Date(newSeed.getLastSeenUTC())) + "'");newSeed.setLastSeenUTC();- sb.webIndex.peers().peerActions.peerArrival(newSeed, true);+ sb.peers.peerActions.peerArrival(newSeed, true);} else {if (log.isFine()) log.logFine("publish: recently handshaked " + this.seed.get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_SENIOR) +" peer '" + this.seed.getName() + "' at " + this.seed.getPublicAddress() + " with old LastSeen: '" +DateFormatter.formatShortSecond(new Date(newSeed.getLastSeenUTC())) + "', this is more recent: '" +DateFormatter.formatShortSecond(new Date(this.seed.getLastSeenUTC())) + "'");this.seed.setLastSeenUTC();- sb.webIndex.peers().peerActions.peerArrival(this.seed, true);+ sb.peers.peerActions.peerArrival(this.seed, true);}}} else {@@ -300,13 +300,13 @@ public class yacyCore {// init yacyHello-processMap<String, yacySeed> seeds; // hash/yacySeed relation- int attempts = sb.webIndex.peers().sizeConnected();+ int attempts = sb.peers.sizeConnected();// getting a list of peers to contact- if (sb.webIndex.peers().mySeed().get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_VIRGIN).equals(yacySeed.PEERTYPE_VIRGIN)) {+ if (sb.peers.mySeed().get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_VIRGIN).equals(yacySeed.PEERTYPE_VIRGIN)) {if (attempts > PING_INITIAL) { attempts = PING_INITIAL; }final Map<byte[], String> ch = plasmaSwitchboard.getSwitchboard().clusterhashes;- seeds = PeerSelection.seedsByAge(sb.webIndex.peers(), true, attempts - ((ch == null) ? 0 : ch.size())); // best for fast connection+ seeds = PeerSelection.seedsByAge(sb.peers, true, attempts - ((ch == null) ? 0 : ch.size())); // best for fast connection// add also all peers from cluster if this is a public robinson clusterif (ch != null) {final Iterator<Map.Entry<byte[], String>> i = ch.entrySet().iterator();@@ -318,7 +318,7 @@ public class yacyCore {hash = new String(entry.getKey());seed = seeds.get(hash);if (seed == null) {- seed = sb.webIndex.peers().get(hash);+ seed = sb.peers.get(hash);if (seed == null) continue;}seed.setAlternativeAddress(entry.getValue());@@ -333,7 +333,7 @@ public class yacyCore {} else {if (attempts > PING_MIN_RUNNING) { attempts = PING_MIN_RUNNING; }}- seeds = PeerSelection.seedsByAge(sb.webIndex.peers(), false, attempts); // best for seed list maintenance/cleaning+ seeds = PeerSelection.seedsByAge(sb.peers, false, attempts); // best for seed list maintenance/cleaning}if ((seeds == null) || seeds.size() == 0) { return 0; }@@ -345,20 +345,20 @@ public class yacyCore {// include a YaCyNews record to my seedtry {- final yacyNewsRecord record = sb.webIndex.peers().newsPool.myPublication();+ final yacyNewsRecord record = sb.peers.newsPool.myPublication();if (record == null) {- sb.webIndex.peers().mySeed().put("news", "");+ sb.peers.mySeed().put("news", "");} else {- sb.webIndex.peers().mySeed().put("news", de.anomic.tools.crypt.simpleEncode(record.toString()));+ sb.peers.mySeed().put("news", de.anomic.tools.crypt.simpleEncode(record.toString()));}} catch (final IOException e) {log.logSevere("publishMySeed: problem with news encoding", e);}- sb.webIndex.peers().mySeed().setUnusedFlags();+ sb.peers.mySeed().setUnusedFlags();// include current citation-rank file count- sb.webIndex.peers().mySeed().put(yacySeed.CRWCNT, Integer.toString(sb.rankingOwnDistribution.size()));- sb.webIndex.peers().mySeed().put(yacySeed.CRTCNT, Integer.toString(sb.rankingOtherDistribution.size()));+ sb.peers.mySeed().put(yacySeed.CRWCNT, Integer.toString(sb.rankingOwnDistribution.size()));+ sb.peers.mySeed().put(yacySeed.CRTCNT, Integer.toString(sb.rankingOtherDistribution.size()));int newSeeds = -1;//if (seeds.length > 1) {// holding a reference to all started threads@@ -381,7 +381,7 @@ public class yacyCore {final String seederror = seed.isProper(false);if ((address == null) || (seederror != null)) {// we don't like that address, delete it- sb.webIndex.peers().peerActions.peerDeparture(seed, "peer ping to peer resulted in address = " + address + "; seederror = " + seederror);+ sb.peers.peerActions.peerDeparture(seed, "peer ping to peer resulted in address = " + address + "; seederror = " + seederror);sync.P();} else {// starting a new publisher thread@@ -446,7 +446,7 @@ public class yacyCore {if ((accessible >= PING_MIN_PEERSEEN) ||(accessible >= notaccessible)) {// We can be reached from a majority of other Peers- if (sb.webIndex.peers().mySeed().isPrincipal()) {+ if (sb.peers.mySeed().isPrincipal()) {newPeerType = yacySeed.PEERTYPE_PRINCIPAL;} else {newPeerType = yacySeed.PEERTYPE_SENIOR;@@ -455,23 +455,23 @@ public class yacyCore {// We cannot be reached from the outsidenewPeerType = yacySeed.PEERTYPE_JUNIOR;}- if (sb.webIndex.peers().mySeed().orVirgin().equals(newPeerType)) {- log.logInfo("PeerPing: myType is " + sb.webIndex.peers().mySeed().orVirgin());+ if (sb.peers.mySeed().orVirgin().equals(newPeerType)) {+ log.logInfo("PeerPing: myType is " + sb.peers.mySeed().orVirgin());} else {- log.logInfo("PeerPing: changing myType from '" + sb.webIndex.peers().mySeed().orVirgin() + "' to '" + newPeerType + "'");- sb.webIndex.peers().mySeed().put(yacySeed.PEERTYPE, newPeerType);+ log.logInfo("PeerPing: changing myType from '" + sb.peers.mySeed().orVirgin() + "' to '" + newPeerType + "'");+ sb.peers.mySeed().put(yacySeed.PEERTYPE, newPeerType);}} else {- log.logInfo("PeerPing: No data, staying at myType: " + sb.webIndex.peers().mySeed().orVirgin());+ log.logInfo("PeerPing: No data, staying at myType: " + sb.peers.mySeed().orVirgin());}// success! we have published our peer to a senior peer// update latest news from the other peer// log.logInfo("publish: handshaked " + t.seed.get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_SENIOR) + " peer '" + t.seed.getName() + "' at " + t.seed.getAddress());- sb.webIndex.peers().saveMySeed();+ sb.peers.saveMySeed();// if we have an address, we do nothing- if (sb.webIndex.peers().mySeed().isProper(true) == null && !force) { return 0; }+ if (sb.peers.mySeed().isProper(true) == null && !force) { return 0; }if (newSeeds > 0) return newSeeds;// still no success: ask own NAT or internet responder@@ -481,12 +481,12 @@ public class yacyCore {//if (ip.equals("")) ip = natLib.retrieveIP(DI604use, DI604pw);// yacyCore.log.logDebug("DEBUG: new IP=" + ip);- if (yacySeed.isProperIP(ip) == null) sb.webIndex.peers().mySeed().setIP(ip);- if (sb.webIndex.peers().mySeed().get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_JUNIOR).equals(yacySeed.PEERTYPE_JUNIOR)) // ???????????????- sb.webIndex.peers().mySeed().put(yacySeed.PEERTYPE, yacySeed.PEERTYPE_SENIOR); // to start bootstraping, we need to be recognised as PEERTYPE_SENIOR peer+ if (yacySeed.isProperIP(ip) == null) sb.peers.mySeed().setIP(ip);+ if (sb.peers.mySeed().get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_JUNIOR).equals(yacySeed.PEERTYPE_JUNIOR)) // ???????????????+ sb.peers.mySeed().put(yacySeed.PEERTYPE, yacySeed.PEERTYPE_SENIOR); // to start bootstraping, we need to be recognised as PEERTYPE_SENIOR peerlog.logInfo("publish: no recipient found, our address is " +- ((sb.webIndex.peers().mySeed().getPublicAddress() == null) ? "unknown" : sb.webIndex.peers().mySeed().getPublicAddress()));- sb.webIndex.peers().saveMySeed();+ ((sb.peers.mySeed().getPublicAddress() == null) ? "unknown" : sb.peers.mySeed().getPublicAddress()));+ sb.peers.saveMySeed();return 0;} catch (final InterruptedException e) {try {@@ -620,7 +620,7 @@ public class yacyCore {String logt;// be shure that we have something to say- if (sb.webIndex.peers().mySeed().getPublicAddress() == null) {+ if (sb.peers.mySeed().getPublicAddress() == null) {final String errorMsg = "We have no valid IP address until now";log.logWarning("SaveSeedList: " + errorMsg);return errorMsg;@@ -658,7 +658,7 @@ public class yacyCore {// ensure that the seed file url is configured properlyyacyURL seedURL;try {- final String seedURLStr = sb.webIndex.peers().mySeed().get(yacySeed.SEEDLIST, "");+ final String seedURLStr = sb.peers.mySeed().get(yacySeed.SEEDLIST, "");if (seedURLStr.length() == 0) { throw new MalformedURLException("The seed-file url must not be empty."); }if (!(seedURLStr.toLowerCase().startsWith("http://") ||@@ -668,26 +668,26 @@ public class yacyCore {}seedURL = new yacyURL(seedURLStr, null);} catch (final MalformedURLException e) {- final String errorMsg = "Malformed seed file URL '" + sb.webIndex.peers().mySeed().get(yacySeed.SEEDLIST, "") + "'. " + e.getMessage();+ final String errorMsg = "Malformed seed file URL '" + sb.peers.mySeed().get(yacySeed.SEEDLIST, "") + "'. " + e.getMessage();log.logWarning("SaveSeedList: " + errorMsg);return errorMsg;}// upload the seed-list using the configured uploader class- String prevStatus = sb.webIndex.peers().mySeed().get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_JUNIOR);+ String prevStatus = sb.peers.mySeed().get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_JUNIOR);if (prevStatus.equals(yacySeed.PEERTYPE_PRINCIPAL)) { prevStatus = yacySeed.PEERTYPE_SENIOR; }try {- sb.webIndex.peers().mySeed().put(yacySeed.PEERTYPE, yacySeed.PEERTYPE_PRINCIPAL); // this information shall also be uploaded+ sb.peers.mySeed().put(yacySeed.PEERTYPE, yacySeed.PEERTYPE_PRINCIPAL); // this information shall also be uploadedif (log.isFine()) log.logFine("SaveSeedList: Using seed uploading method '" + seedUploadMethod + "' for seed-list uploading." +- "\n\tPrevious peerType is '" + sb.webIndex.peers().mySeed().get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_JUNIOR) + "'.");+ "\n\tPrevious peerType is '" + sb.peers.mySeed().get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_JUNIOR) + "'.");// logt = seedDB.uploadCache(seedFTPServer, seedFTPAccount, seedFTPPassword, seedFTPPath, seedURL);- logt = sb.webIndex.peers().uploadCache(uploader, sb, sb.webIndex.peers(), seedURL);+ logt = sb.peers.uploadCache(uploader, sb, sb.peers, seedURL);if (logt != null) {if (logt.indexOf("Error") >= 0) {- sb.webIndex.peers().mySeed().put(yacySeed.PEERTYPE, prevStatus);+ sb.peers.mySeed().put(yacySeed.PEERTYPE, prevStatus);final String errorMsg = "SaveSeedList: seed upload failed using " + uploader.getClass().getName() + " (error): " + logt.substring(logt.indexOf("Error") + 6);log.logSevere(errorMsg);return errorMsg;@@ -699,16 +699,16 @@ public class yacyCore {sb.setConfig("yacyStatus", yacySeed.PEERTYPE_PRINCIPAL);return null;} catch (final Exception e) {- sb.webIndex.peers().mySeed().put(yacySeed.PEERTYPE, prevStatus);+ sb.peers.mySeed().put(yacySeed.PEERTYPE, prevStatus);sb.setConfig("yacyStatus", prevStatus);final String errorMsg = "SaveSeedList: Seed upload failed (IO error): " + e.getMessage();log.logInfo(errorMsg, e);return errorMsg;}} finally {- sb.webIndex.peers().lastSeedUpload_seedDBSize = sb.webIndex.peers().sizeConnected();- sb.webIndex.peers().lastSeedUpload_timeStamp = System.currentTimeMillis();- sb.webIndex.peers().lastSeedUpload_myIP = sb.webIndex.peers().mySeed().getIP();+ sb.peers.lastSeedUpload_seedDBSize = sb.peers.sizeConnected();+ sb.peers.lastSeedUpload_timeStamp = System.currentTimeMillis();+ sb.peers.lastSeedUpload_myIP = sb.peers.mySeed().getIP();}}diff --git a/source/de/anomic/yacy/yacyNetwork.java b/source/de/anomic/yacy/yacyNetwork.javaindex bb5e8607c..cc5e6b941 100644--- a/source/de/anomic/yacy/yacyNetwork.java+++ b/source/de/anomic/yacy/yacyNetwork.java@@ -79,7 +79,7 @@ public class yacyNetwork {post.add(new DefaultCharsetStringPart("key", salt));// just standard identification essentials- post.add(new DefaultCharsetStringPart("iam", sb.webIndex.peers().mySeed().hash));+ post.add(new DefaultCharsetStringPart("iam", sb.peers.mySeed().hash));if (targetHash != null) post.add(new DefaultCharsetStringPart("youare", targetHash));// time information for synchronization@@ -96,7 +96,7 @@ public class yacyNetwork {if (authentificationMethod.equals("salted-magic-sim")) {// generate an authentification essential using the salt, the iam-hash and the network magicfinal String magic = sb.getConfig("network.unit.protocol.request.authentification.essentials", "");- final String md5 = Digest.encodeMD5Hex(salt + sb.webIndex.peers().mySeed().hash + magic);+ final String md5 = Digest.encodeMD5Hex(salt + sb.peers.mySeed().hash + magic);post.add(new DefaultCharsetStringPart("magicmd5", md5));}}diff --git a/source/de/anomic/yacy/yacySearch.java b/source/de/anomic/yacy/yacySearch.javaindex e9bc3fa13..599c7bd07 100644--- a/source/de/anomic/yacy/yacySearch.java+++ b/source/de/anomic/yacy/yacySearch.java@@ -34,12 +34,12 @@ import java.util.TreeSet;import de.anomic.crawler.ResultURLs;import de.anomic.data.Blacklist;import de.anomic.kelondro.order.Bitfield;+import de.anomic.kelondro.text.Segment;import de.anomic.kelondro.util.ScoreCluster;import de.anomic.kelondro.util.Log;import de.anomic.plasma.plasmaSearchQuery;import de.anomic.plasma.plasmaSearchRankingProcess;import de.anomic.plasma.plasmaSearchRankingProfile;-import de.anomic.plasma.plasmaWordIndex;import de.anomic.yacy.dht.PeerSelection;public class yacySearch extends Thread {@@ -47,7 +47,7 @@ public class yacySearch extends Thread {final private String wordhashes, excludehashes, urlhashes;final private boolean global;final private int partitions;- final private plasmaWordIndex wordIndex;+ final private Segment indexSegment;final private plasmaSearchRankingProcess containerCache;final private Map<String, TreeMap<String, String>> abstractCache;final private Blacklist blacklist;@@ -57,19 +57,25 @@ public class yacySearch extends Thread {final private plasmaSearchRankingProfile rankingProfile;final private String prefer, filter, language;final private Bitfield constraint;+ final private yacySeedDB peers;ResultURLs crawlResults;- public yacySearch(final String wordhashes, final String excludehashes, final String urlhashes,- final String prefer, final String filter, final String language,- final int count, final int maxDistance,- final boolean global, final int partitions, final yacySeed targetPeer, final plasmaWordIndex wordIndex,- final ResultURLs crawlResults,- final plasmaSearchRankingProcess containerCache,- final Map<String, TreeMap<String, String>> abstractCache,- final Blacklist blacklist,- final plasmaSearchRankingProfile rankingProfile,- final Bitfield constraint) {+ public yacySearch(+ final String wordhashes, final String excludehashes,+ final String urlhashes,+ final String prefer, final String filter, final String language,+ final int count, final int maxDistance,+ final boolean global, final int partitions,+ final yacySeed targetPeer,+ final Segment indexSegment,+ final yacySeedDB peers,+ final ResultURLs crawlResults,+ final plasmaSearchRankingProcess containerCache,+ final Map<String, TreeMap<String, String>> abstractCache,+ final Blacklist blacklist,+ final plasmaSearchRankingProfile rankingProfile,+ final Bitfield constraint) {super("yacySearch_" + targetPeer.getName());//System.out.println("DEBUG - yacySearch thread " + this.getName() + " initialized " + ((urlhashes.length() == 0) ? "(primary)" : "(secondary)"));this.wordhashes = wordhashes;@@ -80,7 +86,8 @@ public class yacySearch extends Thread {this.language = language;this.global = global;this.partitions = partitions;- this.wordIndex = wordIndex;+ this.indexSegment = indexSegment;+ this.peers = peers;this.crawlResults = crawlResults;this.containerCache = containerCache;this.abstractCache = abstractCache;@@ -96,17 +103,17 @@ public class yacySearch extends Thread {public void run() {try {this.urls = yacyClient.search(- wordIndex.peers().mySeed(),+ peers.mySeed(),wordhashes, excludehashes, urlhashes, prefer, filter, language, count, maxDistance, global, partitions,- targetPeer, wordIndex, crawlResults, containerCache, abstractCache,+ targetPeer, indexSegment, crawlResults, containerCache, abstractCache,blacklist, rankingProfile, constraint);if (urls != null) {// urls is an array of url hashes. this is only used for log outputfinal StringBuilder urllist = new StringBuilder(this.urls.length * 13);for (int i = 0; i < this.urls.length; i++) urllist.append(this.urls[i]).append(' ');yacyCore.log.logInfo("REMOTE SEARCH - remote peer " + targetPeer.hash + ":" + targetPeer.getName() + " contributed " + urls.length + " links for word hash " + wordhashes + ": " + new String(urllist));- wordIndex.peers().mySeed().incRI(urls.length);- wordIndex.peers().mySeed().incRU(urls.length);+ peers.mySeed().incRI(urls.length);+ peers.mySeed().incRU(urls.length);} else {yacyCore.log.logInfo("REMOTE SEARCH - no answer from remote peer " + targetPeer.hash + ":" + targetPeer.getName());}@@ -234,7 +241,8 @@ public class yacySearch extends Thread {final String wordhashes, final String excludehashes, final String urlhashes,final String prefer, final String filter, String language,final int count, final int maxDist,- final plasmaWordIndex wordIndex,+ final Segment indexSegment,+ final yacySeedDB peers,final ResultURLs crawlResults,final plasmaSearchRankingProcess containerCache,final Map<String, TreeMap<String, String>> abstractCache,@@ -251,11 +259,11 @@ public class yacySearch extends Thread {final yacySeed[] targetPeers =(clusterselection == null) ?selectSearchTargets(- wordIndex.peers(),+ peers,plasmaSearchQuery.hashes2Set(wordhashes),targets,- wordIndex.peers().redundancy())- : selectClusterPeers(wordIndex.peers(), clusterselection);+ peers.redundancy())+ : selectClusterPeers(peers, clusterselection);if (targetPeers == null) return new yacySearch[0];targets = targetPeers.length;if (targets == 0) return new yacySearch[0];@@ -263,7 +271,7 @@ public class yacySearch extends Thread {for (int i = 0; i < targets; i++) {if (targetPeers[i] == null || targetPeers[i].hash == null) continue;searchThreads[i] = new yacySearch(wordhashes, excludehashes, urlhashes, prefer, filter, language, count, maxDist, true, targets, targetPeers[i],- wordIndex, crawlResults, containerCache, abstractCache, blacklist, rankingProfile, constraint);+ indexSegment, peers, crawlResults, containerCache, abstractCache, blacklist, rankingProfile, constraint);searchThreads[i].start();//try {Thread.sleep(20);} catch (InterruptedException e) {}}@@ -272,21 +280,22 @@ public class yacySearch extends Thread {public static yacySearch secondaryRemoteSearch(final String wordhashes, final String excludehashes, final String urlhashes,- final plasmaWordIndex wordIndex,+ final Segment indexSegment,+ final yacySeedDB peers,final ResultURLs crawlResults,final plasmaSearchRankingProcess containerCache,final String targethash, final Blacklist blacklist,final plasmaSearchRankingProfile rankingProfile,final Bitfield constraint, final TreeMap<byte[], String> clusterselection) {// check own peer status- if (wordIndex.peers().mySeed() == null || wordIndex.peers().mySeed().getPublicAddress() == null) { return null; }+ if (peers.mySeed() == null || peers.mySeed().getPublicAddress() == null) { return null; }// prepare seed targets and threads- final yacySeed targetPeer = wordIndex.peers().getConnected(targethash);+ final yacySeed targetPeer = peers.getConnected(targethash);if (targetPeer == null || targetPeer.hash == null) return null;if (clusterselection != null) targetPeer.setAlternativeAddress(clusterselection.get(targetPeer.hash.getBytes()));final yacySearch searchThread = new yacySearch(wordhashes, excludehashes, urlhashes, "", "", "en", 0, 9999, true, 0, targetPeer,- wordIndex, crawlResults, containerCache, new TreeMap<String, TreeMap<String, String>>(), blacklist, rankingProfile, constraint);+ indexSegment, peers, 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 2a94d7a9d..361829038 100644--- a/source/yacy.java+++ b/source/yacy.java@@ -59,6 +59,7 @@ import de.anomic.kelondro.order.Base64Order;import de.anomic.kelondro.text.Reference;import de.anomic.kelondro.text.ReferenceContainer;import de.anomic.kelondro.text.MetadataRepository;+import de.anomic.kelondro.text.Segment;import de.anomic.kelondro.text.metadataPrototype.URLMetadataRow;import de.anomic.kelondro.text.referencePrototype.WordReference;import de.anomic.kelondro.util.DateFormatter;@@ -68,7 +69,6 @@ import de.anomic.kelondro.util.Log;import de.anomic.kelondro.util.FileUtils;import de.anomic.plasma.plasmaSwitchboard;import de.anomic.plasma.plasmaSwitchboardConstants;-import de.anomic.plasma.plasmaWordIndex;import de.anomic.plasma.parser.Word;import de.anomic.server.serverCore;import de.anomic.server.serverSemaphore;@@ -661,14 +661,13 @@ public final class yacy {// run with "java -classpath classes yacy -minimizeUrlDB"try {Log.configureLogging(homePath, new File(homePath, "DATA/LOG/yacy.logging"));} catch (final Exception e) {}final File indexPrimaryRoot = new File(homePath, "DATA/INDEX");- final File indexSecondaryRoot = new File(homePath, "DATA/INDEX");final File indexRoot2 = new File(homePath, "DATA/INDEX2");final Log log = new Log("URL-CLEANUP");try {log.logInfo("STARTING URL CLEANUP");// db containing all currently loades urls- final MetadataRepository currentUrlDB = new MetadataRepository(new File(new File(indexSecondaryRoot, networkName), "TEXT"));+ final MetadataRepository currentUrlDB = new MetadataRepository(new File(new File(indexPrimaryRoot, networkName), "TEXT"));// db used to hold all neede urlsfinal MetadataRepository minimizedUrlDB = new MetadataRepository(new File(new File(indexRoot2, networkName), "TEXT"));@@ -676,15 +675,11 @@ public final class yacy {final int cacheMem = (int)(MemoryControl.maxMemory - MemoryControl.total());if (cacheMem < 2048000) throw new OutOfMemoryError("Not enough memory available to start clean up.");- final plasmaWordIndex wordIndex = new plasmaWordIndex(- networkName,+ final Segment wordIndex = new Segment(log,- indexPrimaryRoot,- indexSecondaryRoot,+ new File(new File(indexPrimaryRoot, "freeworld"), "TEXT"),10000,- (long) Integer.MAX_VALUE,- 0,- 0);+ (long) Integer.MAX_VALUE);final Iterator<ReferenceContainer<WordReference>> indexContainerIterator = wordIndex.index().references("AAAAAAAAAAAA".getBytes(), false, false);long urlCounter = 0, wordCounter = 0;@@ -864,10 +859,9 @@ public final class yacy {}private static void RWIHashList(final File homePath, final String targetName, final String resource, final String format) {- plasmaWordIndex WordIndex = null;+ Segment WordIndex = null;final Log log = new Log("HASHLIST");final File indexPrimaryRoot = new File(homePath, "DATA/INDEX");- final File indexSecondaryRoot = new File(homePath, "DATA/INDEX");final String wordChunkStartHash = "AAAAAAAAAAAA";try {Log.configureLogging(homePath, new File(homePath, "DATA/LOG/yacy.logging"));} catch (final Exception e) {}log.logInfo("STARTING CREATION OF RWI-HASHLIST");@@ -875,15 +869,11 @@ public final class yacy {try {Iterator<ReferenceContainer<WordReference>> indexContainerIterator = null;if (resource.equals("all")) {- WordIndex = new plasmaWordIndex(- "freeworld",- log,- indexPrimaryRoot,- indexSecondaryRoot,+ WordIndex = new Segment(+ log,+ new File(new File(indexPrimaryRoot, "freeworld"), "TEXT"),10000,- (long) Integer.MAX_VALUE,- 1,- 0);+ (long) Integer.MAX_VALUE);indexContainerIterator = WordIndex.index().references(wordChunkStartHash.getBytes(), false, false);}int counter = 0;