Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
refactoring
orbiter497428c8ec7c
diff --git a/htroot/IndexControl_p.java b/htroot/IndexControl_p.javaindex 86f3b8561..f0792243a 100644--- a/htroot/IndexControl_p.java+++ b/htroot/IndexControl_p.java@@ -58,8 +58,7 @@ import java.util.TreeMap;import de.anomic.http.httpHeader;import de.anomic.index.indexContainer;import de.anomic.index.indexRWIEntry;-import de.anomic.index.indexEntryAttribute;-import de.anomic.index.indexURL;+import de.anomic.plasma.plasmaURL;import de.anomic.index.indexURLEntry;import de.anomic.net.URL;import de.anomic.plasma.plasmaSwitchboard;@@ -176,7 +175,7 @@ public class IndexControl_p {switchboard.wordIndex.deleteContainer(keyhash);post.remove("keyhashdeleteall");if (keystring.length() > 0 &&- indexEntryAttribute.word2hash(keystring).equals(keyhash)) {+ plasmaURL.word2hash(keystring).equals(keyhash)) {post.put("keystringsearch", "generated");} else {post.put("keyhashsearch", "generated");@@ -199,8 +198,7 @@ public class IndexControl_p {// 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");- if (keystring.length() > 0 &&- indexEntryAttribute.word2hash(keystring).equals(keyhash)) {+ if (keystring.length() > 0 && plasmaURL.word2hash(keystring).equals(keyhash)) {post.put("keystringsearch", "generated");} else {post.put("keyhashsearch", "generated");@@ -230,7 +228,7 @@ public class IndexControl_p {}if (post.containsKey("keystringsearch")) {- keyhash = indexEntryAttribute.word2hash(keystring);+ keyhash = plasmaURL.word2hash(keystring);prop.put("keyhash", keyhash);prop.put("urlstring", "");prop.put("urlhash", "");@@ -238,8 +236,7 @@ public class IndexControl_p {}if (post.containsKey("keyhashsearch")) {- if (keystring.length() == 0 ||- !indexEntryAttribute.word2hash(keystring).equals(keyhash)) {+ if (keystring.length() == 0 || !plasmaURL.word2hash(keystring).equals(keyhash)) {prop.put("keystring", "<not possible to compute word from hash>");}prop.put("urlstring", "");@@ -249,8 +246,7 @@ public class IndexControl_p {// transfer to other peerif (post.containsKey("keyhashtransfer")) {- if (keystring.length() == 0 ||- !indexEntryAttribute.word2hash(keystring).equals(keyhash)) {+ if (keystring.length() == 0 || !plasmaURL.word2hash(keystring).equals(keyhash)) {prop.put("keystring", "<not possible to compute word from hash>");}prop.put("urlstring", "");@@ -318,7 +314,7 @@ public class IndexControl_p {if (post.containsKey("urlstringsearch")) {try {URL url = new URL(urlstring);- urlhash = indexURL.urlHash(url);+ urlhash = plasmaURL.urlHash(url);prop.put("urlhash", urlhash);indexURLEntry entry = switchboard.urlPool.loadedURL.load(urlhash, null);if (entry == null) {diff --git a/htroot/IndexCreate_p.java b/htroot/IndexCreate_p.javaindex ba7d831c8..a92d513f6 100644--- a/htroot/IndexCreate_p.java+++ b/htroot/IndexCreate_p.java@@ -59,7 +59,7 @@ import de.anomic.data.wikiCode;import de.anomic.htmlFilter.htmlFilterContentScraper;import de.anomic.htmlFilter.htmlFilterWriter;import de.anomic.http.httpHeader;-import de.anomic.index.indexURL;+import de.anomic.plasma.plasmaURL;import de.anomic.net.URL;import de.anomic.plasma.plasmaCrawlEURL;import de.anomic.plasma.plasmaCrawlProfile;@@ -167,7 +167,7 @@ public class IndexCreate_p {// stack request// first delete old entry, if exists- String urlhash = indexURL.urlHash(crawlingStart);+ String urlhash = plasmaURL.urlHash(crawlingStart);switchboard.urlPool.loadedURL.remove(urlhash);switchboard.urlPool.noticeURL.remove(urlhash);switchboard.urlPool.errorURL.remove(urlhash);@@ -517,8 +517,8 @@ public class IndexCreate_p {//table += "Sorry, cannot show any crawl output now because the system is not completely initialised. Please re-try.";prop.put("error", 3);} else {- Enumeration crawlavail = yacyCore.dhtAgent.getAcceptRemoteCrawlSeeds(indexURL.dummyHash, true);- Enumeration crawlpendi = yacyCore.dhtAgent.getAcceptRemoteCrawlSeeds(indexURL.dummyHash, false);+ Enumeration crawlavail = yacyCore.dhtAgent.getAcceptRemoteCrawlSeeds(plasmaURL.dummyHash, true);+ Enumeration crawlpendi = yacyCore.dhtAgent.getAcceptRemoteCrawlSeeds(plasmaURL.dummyHash, false);if ((!(crawlavail.hasMoreElements())) && (!(crawlpendi.hasMoreElements()))) {prop.put("remoteCrawlPeers", 0); //no peers availible} else {diff --git a/htroot/QuickCrawlLink_p.java b/htroot/QuickCrawlLink_p.javaindex b29960c08..27d205924 100644--- a/htroot/QuickCrawlLink_p.java+++ b/htroot/QuickCrawlLink_p.java@@ -54,7 +54,7 @@ import java.net.URLDecoder;import java.util.Date;import de.anomic.http.httpHeader;-import de.anomic.index.indexURL;+import de.anomic.plasma.plasmaURL;import de.anomic.net.URL;import de.anomic.plasma.plasmaCrawlProfile;import de.anomic.plasma.plasmaSwitchboard;@@ -148,7 +148,7 @@ public class QuickCrawlLink_p {return prop;}- String urlhash = indexURL.urlHash(crawlingStart);+ String urlhash = plasmaURL.urlHash(crawlingStart);switchboard.urlPool.loadedURL.remove(urlhash);switchboard.urlPool.noticeURL.remove(urlhash);switchboard.urlPool.errorURL.remove(urlhash);diff --git a/htroot/Surftips.java b/htroot/Surftips.javaindex 5da6be93d..a6ac74347 100644--- a/htroot/Surftips.java+++ b/htroot/Surftips.java@@ -31,7 +31,7 @@ import java.util.HashMap;import java.util.Iterator;import de.anomic.http.httpHeader;-import de.anomic.index.indexURL;+import de.anomic.plasma.plasmaURL;import de.anomic.kelondro.kelondroMScoreCluster;import de.anomic.kelondro.kelondroRow;import de.anomic.plasma.plasmaSwitchboard;@@ -290,7 +290,7 @@ public class Surftips {// add/subtract votes and write recordif (entry != null) {- urlhash = indexURL.urlHash(url);+ urlhash = plasmaURL.urlHash(url);if (urlhash == null) {System.out.println("Surftips: bad url '" + url + "' from news record " + record.toString());continue;diff --git a/htroot/htdocsdefault/dir.java b/htroot/htdocsdefault/dir.javaindex 8e347ddde..d09d1a01f 100644--- a/htroot/htdocsdefault/dir.java+++ b/htroot/htdocsdefault/dir.java@@ -59,8 +59,7 @@ import java.util.Map;import de.anomic.data.userDB;import de.anomic.http.httpHeader;-import de.anomic.index.indexEntryAttribute;-import de.anomic.index.indexURL;+import de.anomic.plasma.plasmaURL;import de.anomic.index.indexURLEntry;import de.anomic.kelondro.kelondroBase64Order;import de.anomic.net.URL;@@ -375,7 +374,7 @@ public class dir {md5, // md5(long) phrase.length(), // sizecondenser.RESULT_NUMB_WORDS, // word count- indexEntryAttribute.DT_SHARE, // doctype+ plasmaURL.DT_SHARE, // doctypenew bitfield(4),"**", // language0,0,0,0,0,0@@ -389,18 +388,18 @@ public class dir {);final String urlHash = newEntry.hash();- /*final int words =*/ switchboard.wordIndex.addPageIndex(url, urlHash, new Date(), phrase.length() + descr.length() + 13, null, condenser, "**", indexEntryAttribute.DT_SHARE, 0, 0);+ /*final int words =*/ switchboard.wordIndex.addPageIndex(url, urlHash, new Date(), phrase.length() + descr.length() + 13, null, condenser, "**", plasmaURL.DT_SHARE, 0, 0);} catch (IOException e) {}}public static void deletePhrase(plasmaSwitchboard switchboard, String urlstring, String phrase, String descr) {try {- final String urlhash = indexURL.urlHash(new URL(urlstring));+ final String urlhash = plasmaURL.urlHash(new URL(urlstring));final Iterator words = plasmaCondenser.getWords(("yacyshare " + phrase + " " + descr).getBytes("UTF-8"));Map.Entry entry;while (words.hasNext()) {entry = (Map.Entry) words.next();- switchboard.wordIndex.removeEntry(indexEntryAttribute.word2hash((String) entry.getKey()), urlhash, true);+ switchboard.wordIndex.removeEntry(plasmaURL.word2hash((String) entry.getKey()), urlhash, true);}switchboard.urlPool.loadedURL.remove(urlhash);} catch (Exception e) {diff --git a/htroot/xml/bookmarks/posts/delete_p.java b/htroot/xml/bookmarks/posts/delete_p.javaindex 2d9fdea76..dd73a4d3e 100644--- a/htroot/xml/bookmarks/posts/delete_p.java+++ b/htroot/xml/bookmarks/posts/delete_p.java@@ -43,7 +43,7 @@package xml.bookmarks.posts;import de.anomic.http.httpHeader;-import de.anomic.index.indexURL;+import de.anomic.plasma.plasmaURL;import de.anomic.plasma.plasmaSwitchboard;import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;@@ -54,7 +54,7 @@ public class delete_p {plasmaSwitchboard switchboard = (plasmaSwitchboard) env;serverObjects prop = new serverObjects();if(post!= null){- if( post.containsKey("url") && switchboard.bookmarksDB.removeBookmark(indexURL.urlHash(post.get("url", "nourl"))) ){+ if( post.containsKey("url") && switchboard.bookmarksDB.removeBookmark(plasmaURL.urlHash(post.get("url", "nourl"))) ){prop.put("result", 1);}else if(post.containsKey("urlhash") && switchboard.bookmarksDB.removeBookmark(post.get("urlhash", "nohash"))){prop.put("result", 1);diff --git a/htroot/xml/snippet.java b/htroot/xml/snippet.javaindex 421e76ad2..ac08dc0ff 100644--- a/htroot/xml/snippet.java+++ b/htroot/xml/snippet.java@@ -5,7 +5,7 @@ import java.util.Set;import java.util.TreeSet;import de.anomic.http.httpHeader;-import de.anomic.index.indexURL;+import de.anomic.plasma.plasmaURL;import de.anomic.kelondro.kelondroMSetTools;import de.anomic.net.URL;import de.anomic.plasma.plasmaSearchQuery;@@ -47,11 +47,11 @@ public class snippet {} else {String error = snippet.getError();if (error.equals("no matching snippet found")) {- switchboard.removeReferences(indexURL.urlHash(url), query);+ switchboard.removeReferences(plasmaURL.urlHash(url), query);}prop.put("text", error);}- prop.put("urlHash",indexURL.urlHash(url));+ prop.put("urlHash",plasmaURL.urlHash(url));// return rewrite propertiesdiff --git a/htroot/yacy/crawlOrder.java b/htroot/yacy/crawlOrder.javaindex fad5b9b39..c9add44ae 100644--- a/htroot/yacy/crawlOrder.java+++ b/htroot/yacy/crawlOrder.java@@ -49,7 +49,7 @@ import java.util.ArrayList;import java.util.Date;import de.anomic.http.httpHeader;-import de.anomic.index.indexURL;+import de.anomic.plasma.plasmaURL;import de.anomic.index.indexURLEntry;import de.anomic.net.URL;import de.anomic.plasma.plasmaSwitchboard;@@ -249,7 +249,7 @@ public final class crawlOrder {// case where we have already the url loaded;reason = reasonString;// send lurl-Entry as response- indexURLEntry entry = switchboard.urlPool.loadedURL.load(indexURL.urlHash(url), null);+ indexURLEntry entry = switchboard.urlPool.loadedURL.load(plasmaURL.urlHash(url), null);if (entry == null) {response = "rejected";lurl = "";diff --git a/htroot/yacy/crawlReceipt.java b/htroot/yacy/crawlReceipt.javaindex 5409041e5..1d573deb5 100644--- a/htroot/yacy/crawlReceipt.java+++ b/htroot/yacy/crawlReceipt.java@@ -49,7 +49,7 @@import java.io.IOException;import de.anomic.http.httpHeader;-import de.anomic.index.indexURL;+import de.anomic.plasma.plasmaURL;import de.anomic.index.indexURLEntry;import de.anomic.plasma.plasmaCrawlEURL;import de.anomic.plasma.plasmaCrawlNURL;@@ -139,8 +139,8 @@ public final class crawlReceipt {switchboard.urlPool.loadedURL.stack(entry, youare, iam, 1);// generating url hash- String newUrlHash = indexURL.urlHash(comp.url());- String oldUrlHash = indexURL.oldurlHash(comp.url());+ String newUrlHash = plasmaURL.urlHash(comp.url());+ String oldUrlHash = plasmaURL.oldurlHash(comp.url());// removing URL from notice URLswitchboard.urlPool.noticeURL.remove(newUrlHash);diff --git a/htroot/yacy/search.java b/htroot/yacy/search.javaindex 7ae96f71b..29af5dfe3 100644--- a/htroot/yacy/search.java+++ b/htroot/yacy/search.java@@ -53,7 +53,7 @@ import java.util.Set;import de.anomic.http.httpHeader;import de.anomic.index.indexContainer;-import de.anomic.index.indexURL;+import de.anomic.plasma.plasmaURL;import de.anomic.index.indexURLEntry;import de.anomic.plasma.plasmaSearchEvent;import de.anomic.plasma.plasmaSearchQuery;@@ -150,7 +150,7 @@ public final class search {entry = (Map.Entry) ci.next();wordhash = (String) entry.getKey();indexContainer container = (indexContainer) entry.getValue();- indexabstract.append("indexabstract." + wordhash + "=").append(indexURL.compressIndex(container, null, 1000).toString()).append(serverCore.crlfString);+ indexabstract.append("indexabstract." + wordhash + "=").append(plasmaURL.compressIndex(container, null, 1000).toString()).append(serverCore.crlfString);}}@@ -200,7 +200,7 @@ public final class search {}indexcount.append("indexcount.").append(container.getWordHash()).append('=').append(Integer.toString(container.size())).append(serverCore.crlfString);if ((abstractSet != null) && (abstractSet.contains(wordhash))) {- indexabstract.append("indexabstract." + wordhash + "=").append(indexURL.compressIndex(container, null,1000).toString()).append(serverCore.crlfString);+ indexabstract.append("indexabstract." + wordhash + "=").append(plasmaURL.compressIndex(container, null,1000).toString()).append(serverCore.crlfString);}}prop.put("indexcount", new String(indexcount));@@ -222,10 +222,10 @@ public final class search {if ((maxcounthash == null) || (urls.length() != 0) || (keyhashes.size() == 1) || (abstracts.length() == 0)) {prop.put("indexabstract", "");} else if (abstracts.equals("auto")) {- indexabstract.append("indexabstract." + maxcounthash + "=").append(indexURL.compressIndex(((indexContainer) containers.get(maxcounthash)),localResults, 1000).toString()).append(serverCore.crlfString);+ indexabstract.append("indexabstract." + maxcounthash + "=").append(plasmaURL.compressIndex(((indexContainer) containers.get(maxcounthash)),localResults, 1000).toString()).append(serverCore.crlfString);if ((neardhthash != null)&& (!(neardhthash.equals(maxcounthash)))) {- indexabstract.append("indexabstract." + neardhthash + "=").append(indexURL.compressIndex(((indexContainer) containers.get(neardhthash)), localResults, 1000).toString()).append(serverCore.crlfString);+ indexabstract.append("indexabstract." + neardhthash + "=").append(plasmaURL.compressIndex(((indexContainer) containers.get(neardhthash)), localResults, 1000).toString()).append(serverCore.crlfString);}//System.out.println("DEBUG-ABSTRACTGENERATION: maxcounthash = " + maxcounthash);//System.out.println("DEBUG-ABSTRACTGENERATION: neardhthash = "+ neardhthash);diff --git a/source/de/anomic/data/bookmarksDB.java b/source/de/anomic/data/bookmarksDB.javaindex 85c0dbf2f..abf8f29eb 100644--- a/source/de/anomic/data/bookmarksDB.java+++ b/source/de/anomic/data/bookmarksDB.java@@ -72,8 +72,7 @@ import org.xml.sax.SAXException;import de.anomic.htmlFilter.htmlFilterContentScraper;import de.anomic.htmlFilter.htmlFilterWriter;-import de.anomic.index.indexEntryAttribute;-import de.anomic.index.indexURL;+import de.anomic.plasma.plasmaURL;import de.anomic.kelondro.kelondroDyn;import de.anomic.kelondro.kelondroException;import de.anomic.kelondro.kelondroMap;@@ -89,7 +88,7 @@ public class bookmarksDB {HashMap bookmarkCache;public static String tagHash(String tagName){- return indexEntryAttribute.word2hash(tagName.toLowerCase());+ return plasmaURL.word2hash(tagName.toLowerCase());}public static String dateToiso8601(Date date){return new SimpleDateFormat("yyyy-MM-dd").format(date)+"T"+(new SimpleDateFormat("HH:mm:ss")).format(date)+"Z";@@ -749,7 +748,7 @@ public class bookmarksDB {if(!url.toLowerCase().startsWith("http://")){url="http://"+url;}- this.urlHash=indexURL.urlHash(url);+ this.urlHash=plasmaURL.urlHash(url);mem=new HashMap();mem.put(BOOKMARK_URL, url);this.timestamp=System.currentTimeMillis();diff --git a/source/de/anomic/index/indexEntryAttribute.java b/source/de/anomic/index/indexEntryAttribute.javadeleted file mode 100644index 2156cad4b..000000000--- a/source/de/anomic/index/indexEntryAttribute.java+++ /dev/null@@ -1,166 +0,0 @@-// indexEntryAttribute.java-// (C) 2006 by Michael Peter Christen; [email protected], Frankfurt a. M., Germany-// first published 16.05.2006 on http://www.anomic.de-//-// This is a part of YaCy, a peer-to-peer based web search engine-//-// $LastChangedDate: 2006-04-02 22:40:07 +0200 (So, 02 Apr 2006) $-// $LastChangedRevision: 1986 $-// $LastChangedBy: orbiter $-//-// LICENSE-//-// This program is free software; you can redistribute it and/or modify-// it under the terms of the GNU General Public License as published by-// the Free Software Foundation; either version 2 of the License, or-// (at your option) any later version.-//-// This program is distributed in the hope that it will be useful,-// but WITHOUT ANY WARRANTY; without even the implied warranty of-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-// GNU General Public License for more details.-//-// You should have received a copy of the GNU General Public License-// along with this program; if not, write to the Free Software-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA----package de.anomic.index;--import de.anomic.kelondro.kelondroBase64Order;-import de.anomic.net.URL;-import de.anomic.server.serverCodings;-import de.anomic.yacy.yacySeedDB;--public class indexEntryAttribute {-- // doctypes:- public static final char DT_PDFPS = 'p';- public static final char DT_TEXT = 't';- public static final char DT_HTML = 'h';- public static final char DT_DOC = 'd';- public static final char DT_IMAGE = 'i';- public static final char DT_MOVIE = 'm';- public static final char DT_FLASH = 'f';- public static final char DT_SHARE = 's';- public static final char DT_AUDIO = 'a';- public static final char DT_BINARY = 'b';- public static final char DT_UNKNOWN = 'u';-- // appearance locations: (used for flags)- public static final int AP_TITLE = 0; // title tag from html header- public static final int AP_H1 = 1; // headline - top level- public static final int AP_H2 = 2; // headline, second level- public static final int AP_H3 = 3; // headline, 3rd level- public static final int AP_H4 = 4; // headline, 4th level- public static final int AP_H5 = 5; // headline, 5th level- public static final int AP_H6 = 6; // headline, 6th level- public static final int AP_TEXT = 7; // word appears in text (used to check validation of other appearances against spam)- public static final int AP_DOM = 8; // word inside an url: in Domain- public static final int AP_PATH = 9; // word inside an url: in path- public static final int AP_IMG = 10; // tag inside image references- public static final int AP_ANCHOR = 11; // anchor description- public static final int AP_ENV = 12; // word appears in environment (similar to anchor appearance)- public static final int AP_BOLD = 13; // may be interpreted as emphasized- public static final int AP_ITALICS = 14; // may be interpreted as emphasized- public static final int AP_WEAK = 15; // for Text that is small or bareley visible- public static final int AP_INVISIBLE = 16; // good for spam detection- public static final int AP_TAG = 17; // for tagged indexeing (i.e. using mp3 tags)- public static final int AP_AUTHOR = 18; // word appears in author name- public static final int AP_OPUS = 19; // word appears in name of opus, which may be an album name (in mp3 tags)- public static final int AP_TRACK = 20; // word appears in track name (i.e. in mp3 tags)-- // URL attributes- public static final int UA_LOCAL = 0; // URL was crawled locally- public static final int UA_TILDE = 1; // tilde appears in URL- public static final int UA_REDIRECT = 2; // The URL is a redirection-- // local flag attributes- public static final char LT_LOCAL = 'L';- public static final char LT_GLOBAL = 'G';-- // create a word hash- public static String word2hash(String word) {- return kelondroBase64Order.enhancedCoder.encode(serverCodings.encodeMD5Raw(word.toLowerCase())).substring(0, yacySeedDB.commonHashLength);- }-- // doctype calculation- public static char docType(URL url) {- String path = url.getPath();- // serverLog.logFinest("PLASMA", "docType URL=" + path);- char doctype = indexEntryAttribute.DT_UNKNOWN;- if (path.endsWith(".gif")) { doctype = indexEntryAttribute.DT_IMAGE; }- else if (path.endsWith(".jpg")) { doctype = indexEntryAttribute.DT_IMAGE; }- else if (path.endsWith(".jpeg")) { doctype = indexEntryAttribute.DT_IMAGE; }- else if (path.endsWith(".png")) { doctype = indexEntryAttribute.DT_IMAGE; }- else if (path.endsWith(".html")) { doctype = indexEntryAttribute.DT_HTML; }- else if (path.endsWith(".txt")) { doctype = indexEntryAttribute.DT_TEXT; }- else if (path.endsWith(".doc")) { doctype = indexEntryAttribute.DT_DOC; }- else if (path.endsWith(".rtf")) { doctype = indexEntryAttribute.DT_DOC; }- else if (path.endsWith(".pdf")) { doctype = indexEntryAttribute.DT_PDFPS; }- else if (path.endsWith(".ps")) { doctype = indexEntryAttribute.DT_PDFPS; }- else if (path.endsWith(".avi")) { doctype = indexEntryAttribute.DT_MOVIE; }- else if (path.endsWith(".mov")) { doctype = indexEntryAttribute.DT_MOVIE; }- else if (path.endsWith(".qt")) { doctype = indexEntryAttribute.DT_MOVIE; }- else if (path.endsWith(".mpg")) { doctype = indexEntryAttribute.DT_MOVIE; }- else if (path.endsWith(".md5")) { doctype = indexEntryAttribute.DT_SHARE; }- else if (path.endsWith(".mpeg")) { doctype = indexEntryAttribute.DT_MOVIE; }- else if (path.endsWith(".asf")) { doctype = indexEntryAttribute.DT_FLASH; }- return doctype;- }-- public static char docType(String mime) {- // serverLog.logFinest("PLASMA", "docType mime=" + mime);- char doctype = indexEntryAttribute.DT_UNKNOWN;- if (mime == null) doctype = indexEntryAttribute.DT_UNKNOWN;- else if (mime.startsWith("image/")) doctype = indexEntryAttribute.DT_IMAGE;- else if (mime.endsWith("/gif")) doctype = indexEntryAttribute.DT_IMAGE;- else if (mime.endsWith("/jpeg")) doctype = indexEntryAttribute.DT_IMAGE;- else if (mime.endsWith("/png")) doctype = indexEntryAttribute.DT_IMAGE;- else if (mime.endsWith("/html")) doctype = indexEntryAttribute.DT_HTML;- else if (mime.endsWith("/rtf")) doctype = indexEntryAttribute.DT_DOC;- else if (mime.endsWith("/pdf")) doctype = indexEntryAttribute.DT_PDFPS;- else if (mime.endsWith("/octet-stream")) doctype = indexEntryAttribute.DT_BINARY;- else if (mime.endsWith("/x-shockwave-flash")) doctype = indexEntryAttribute.DT_FLASH;- else if (mime.endsWith("/msword")) doctype = indexEntryAttribute.DT_DOC;- else if (mime.endsWith("/mspowerpoint")) doctype = indexEntryAttribute.DT_DOC;- else if (mime.endsWith("/postscript")) doctype = indexEntryAttribute.DT_PDFPS;- else if (mime.startsWith("text/")) doctype = indexEntryAttribute.DT_TEXT;- else if (mime.startsWith("image/")) doctype = indexEntryAttribute.DT_IMAGE;- else if (mime.startsWith("audio/")) doctype = indexEntryAttribute.DT_AUDIO;- else if (mime.startsWith("video/")) doctype = indexEntryAttribute.DT_MOVIE;- //bz2 = application/x-bzip2- //dvi = application/x-dvi- //gz = application/gzip- //hqx = application/mac-binhex40- //lha = application/x-lzh- //lzh = application/x-lzh- //pac = application/x-ns-proxy-autoconfig- //php = application/x-httpd-php- //phtml = application/x-httpd-php- //rss = application/xml- //tar = application/tar- //tex = application/x-tex- //tgz = application/tar- //torrent = application/x-bittorrent- //xhtml = application/xhtml+xml- //xla = application/msexcel- //xls = application/msexcel- //xsl = application/xml- //xml = application/xml- //Z = application/x-compress- //zip = application/zip- return doctype;- }-- // language calculation- public static String language(URL url) {- String language = "uk";- String host = url.getHost();- int pos = host.lastIndexOf(".");- if ((pos > 0) && (host.length() - pos == 3)) language = host.substring(pos + 1).toLowerCase();- return language;- }--}diff --git a/source/de/anomic/index/indexRWIEntryOld.java b/source/de/anomic/index/indexRWIEntryOld.javaindex 0d56ac0f1..399df2144 100644--- a/source/de/anomic/index/indexRWIEntryOld.java+++ b/source/de/anomic/index/indexRWIEntryOld.java@@ -30,6 +30,7 @@ package de.anomic.index;import de.anomic.kelondro.kelondroColumn;import de.anomic.kelondro.kelondroRow;import de.anomic.kelondro.kelondroRow.Entry;+import de.anomic.plasma.plasmaURL;import de.anomic.plasma.plasmaWordIndex;import de.anomic.yacy.yacySeedDB;@@ -105,7 +106,7 @@ public class indexRWIEntryOld implements Cloneable, indexRWIEntry {this.entry.setCol(col_hitcount, hitcount);this.entry.setCol(col_language, language, null);this.entry.setCol(col_doctype, (byte) doctype);- this.entry.setCol(col_localflag, (byte) ((local) ? indexEntryAttribute.LT_LOCAL : indexEntryAttribute.LT_GLOBAL));+ this.entry.setCol(col_localflag, (byte) ((local) ? plasmaURL.LT_LOCAL : plasmaURL.LT_GLOBAL));this.entry.setCol(col_posintext, posintext);this.entry.setCol(col_posinphrase, posinphrase);this.entry.setCol(col_posofphrase, posofphrase);@@ -196,7 +197,7 @@ public class indexRWIEntryOld implements Cloneable, indexRWIEntry {}public boolean isLocal() {- return this.entry.getColByte(col_localflag) == indexEntryAttribute.LT_LOCAL;+ return this.entry.getColByte(col_localflag) == plasmaURL.LT_LOCAL;}public static indexRWIEntryOld combineDistance(indexRWIEntryOld ie1, indexRWIEntry ie2) {diff --git a/source/de/anomic/index/indexURL.java b/source/de/anomic/index/indexURL.javadeleted file mode 100644index fc2e09979..000000000--- a/source/de/anomic/index/indexURL.java+++ /dev/null@@ -1,655 +0,0 @@-// indexURL.java-// (C) 2006 by Michael Peter Christen; [email protected], Frankfurt a. M., Germany-// first published 20.05.2006 on http://www.anomic.de-//-// This is a part of YaCy, a peer-to-peer based web search engine-//-// $LastChangedDate: 2006-04-02 22:40:07 +0200 (So, 02 Apr 2006) $-// $LastChangedRevision: 1986 $-// $LastChangedBy: orbiter $-//-// LICENSE-//-// This program is free software; you can redistribute it and/or modify-// it under the terms of the GNU General Public License as published by-// the Free Software Foundation; either version 2 of the License, or-// (at your option) any later version.-//-// This program is distributed in the hope that it will be useful,-// but WITHOUT ANY WARRANTY; without even the implied warranty of-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-// GNU General Public License for more details.-//-// You should have received a copy of the GNU General Public License-// along with this program; if not, write to the Free Software-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA--package de.anomic.index;--import java.io.IOException;-import java.net.MalformedURLException;-import java.text.SimpleDateFormat;-import java.util.HashMap;-import java.util.Iterator;-import java.util.Map;-import java.util.TreeMap;--import de.anomic.kelondro.kelondroBase64Order;-import de.anomic.kelondro.kelondroCache;-import de.anomic.kelondro.kelondroFlexTable;-import de.anomic.kelondro.kelondroIndex;-import de.anomic.kelondro.kelondroTree;-import de.anomic.net.URL;-import de.anomic.server.serverByteBuffer;-import de.anomic.server.serverCodings;-import de.anomic.server.serverCore;-import de.anomic.yacy.yacySeedDB;--public class indexURL {-- // day formatter for entry export- public static final SimpleDateFormat shortDayFormatter = new SimpleDateFormat("yyyyMMdd");-- private static final String[] TLD_NorthAmericaOceania={- // primary english-speaking countries- // english-speaking countries from central america are also included- // includes also dutch and french colonies in the caribbean sea- "EDU=US Educational",- "GOV=US Government",- "MIL=US Military",- "NET=Network",- "ORG=Non-Profit Organization",- "AG=Antigua and Barbuda",- "AI=Anguilla",- "AU=Australia",- "BB=Barbados",- "BZ=Belize",- "BM=Bermuda",- "BS=Bahamas",- "CA=Canada",- "DM=Dominica",- "GD=Grenada",- "GP=Guadeloupe",- "KY=Cayman Islands",- "NZ=New Zealand (Aotearoa)",- "PM=St. Pierre and Miquelon",- "US=United States",- "VC=Saint Vincent and the Grenadines",- "VG=Virgin Islands (British)",- "VI=Virgin Islands (U.S.)",- "VU=Vanuatu",- "WF=Wallis and Futuna Islands",- "WS=Samoa"- };- private static final String[] TLD_MiddleSouthAmerica = {- // primary spanish and portugese-speaking- "AR=Argentina",- "AW=Aruba",- "BR=Brazil",- "BO=Bolivia",- "CL=Chile",- "CO=Colombia",- "CR=Costa Rica",- "CU=Cuba",- "DO=Dominican Republic",- "EC=Ecuador",- "GF=French Guiana",- "FK=Falkland Islands (Malvinas)",- "GY=Guyana",- "HN=Honduras",- "JM=Jamaica",- "MX=Mexico",- "NI=Nicaragua",- "PA=Panama",- "PE=Peru",- "PY=Paraguay",- "SR=Suriname",- "SV=El Salvador",- "UY=Uruguay",- "VE=Venezuela"- };- private static final String[] TLD_EuropaRussia = {- // includes also countries that are mainly french- dutch- speaking- // and culturally close to europe- "AD=Andorra",- "AL=Albania",- "AQ=Antarctica",- "AT=Austria",- "BA=Bosnia and Herzegovina",- "BE=Belgium",- "BG=Bulgaria",- "CH=Switzerland",- "CS=Czechoslovakia (former)",- "CZ=Czech Republic",- "CY=Cyprus",- "DE=Germany",- "DK=Denmark",- "ES=Spain",- "EE=Estonia",- "FI=Finland",- "FR=France",- "FX=France, Metropolitan",- "GB=Great Britain (UK)",- "GI=Gibraltar",- "GL=Greenland",- "GR=Greece",- "HR=Croatia (Hrvatska)",- "HU=Hungary",- "IE=Ireland",- "IS=Iceland",- "IT=Italy",- "LI=Liechtenstein",- "LT=Lithuania",- "LU=Luxembourg",- "LV=Latvia",- "MD=Moldova",- "MC=Monaco",- "MK=Macedonia",- "MN=Mongolia",- "MT=Malta",- "NATO=Nato field",- "NL=Netherlands",- "NO=Norway",- "PL=Poland",- "PT=Portugal",- "RO=Romania",- "RU=Russia",- "SE=Sweden",- "SI=Slovenia",- "SK=Slovak Republic",- "SU=USSR (former)",- "UK=United Kingdom",- "VA=Vatican City State (Holy See)",- "YU=Yugoslavia"- };- private static final String[] TLD_MiddleEastWestAsia = {- "AE=United Arab Emirates",- "AF=Afghanistan",- "AZ=Azerbaijan",- "BH=Bahrain",- "IL=Israel",- "IQ=Iraq",- "IR=Iran",- "PK=Pakistan",- "TR=Turkey",- "YE=Yemen"- };- private static final String[] TLD_SouthEastAsia = {- "BD=Bangladesh",- "BT=Bhutan",- "CN=China",- "HK=Hong Kong",- "ID=Indonesia",- "IN=India",- "NP=Nepal",- "JP=Japan",- "KH=Cambodia",- "KP=Korea (North)",- "KR=Korea (South)",- "LK=Sri Lanka",- "SG=Singapore",- "VN=Viet Nam"- };- private static final String[] TLD_Africa = {- "AO=Angola",- "BF=Burkina Faso",- "BI=Burundi",- "BJ=Benin",- "BW=Botswana",- "CF=Central African Republic",- "CG=Congo",- "CI=Cote D'Ivoire (Ivory Coast)",- "CM=Cameroon",- "DZ=Algeria",- "EG=Egypt",- "EH=Western Sahara",- "ER=Eritrea",- "ET=Ethiopia",- "GA=Gabon",- "GH=Ghana",- "GM=Gambia",- "GN=Guinea",- "KE=Kenya",- "LR=Liberia",- "LS=Lesotho",- "LY=Libya",- "MA=Morocco",- "MG=Madagascar",- "ML=Mali",- "MR=Mauritania",- "MU=Mauritius",- "MW=Malawi",- "MZ=Mozambique",- "NA=Namibia",- "NE=Niger",- "NG=Nigeria",- "RE=Reunion",- "RW=Rwanda",- "SH=St. Helena",- "SL=Sierra Leone",- "SN=Senegal",- "SO=Somalia",- "ST=Sao Tome and Principe",- "SZ=Swaziland",- "TG=Togo",- "TN=Tunisia",- "TZ=Tanzania",- "UG=Uganda",- "ZA=South Africa",- "ZM=Zambia",- "ZR=Zaire",- "ZW=Zimbabwe",- "YT=Mayotte"- };- private static final String[] TLD_Generic = {- "COM=US Commercial",- "AERO=",- "BIZ=",- "COOP=",- "INFO=",- "MUSEUM=",- "NAME=",- "PRO=",- "ARPA=",- "INT=International",- "ARPA=Arpanet",- "NT=Neutral Zone"- };-- /*- http://www.odci.gov/cia/publications/factbook/- http://en.wikipedia.org/wiki/List_of_countries_by_continent- "AM=Armenia",- "AN=Netherlands Antilles",- "AS=American Samoa",- "BN=Brunei Darussalam",- "BV=Bouvet Island",- "BY=Belarus",- "CC=Cocos (Keeling) Islands",- "CK=Cook Islands",- "CV=Cape Verde",- "CX=Christmas Island",- "DJ=Djibouti",- "FJ=Fiji",- "FM=Micronesia",- "FO=Faroe Islands",- "GE=Georgia",- "GQ=Equatorial Guinea",- "GS=S. Georgia and S. Sandwich Isls.",- "GT=Guatemala",- "GU=Guam",- "GW=Guinea-Bissau",- "HM=Heard and McDonald Islands",- "HT=Haiti",- "IO=British Indian Ocean Territory",- "JO=Jordan",- "KG=Kyrgyzstan",- "KI=Kiribati",- "KM=Comoros",- "KN=Saint Kitts and Nevis",- "KW=Kuwait",- "KZ=Kazakhstan",- "LA=Laos",- "LB=Lebanon",- "LC=Saint Lucia",- "MH=Marshall Islands",- "MM=Myanmar",- "MO=Macau",- "MP=Northern Mariana Islands",- "MQ=Martinique",- "MS=Montserrat",- "MV=Maldives",- "MY=Malaysia",- "NC=New Caledonia",- "NF=Norfolk Island",- "NR=Nauru",- "NU=Niue",- "OM=Oman",- "PF=French Polynesia",- "PG=Papua New Guinea",- "PH=Philippines",- "PN=Pitcairn",- "PR=Puerto Rico",- "PW=Palau",- "QA=Qatar",- "SA=Saudi Arabia",- "Sb=Solomon Islands",- "SC=Seychelles",- "SD=Sudan",- "SJ=Svalbard and Jan Mayen Islands",- "SM=San Marino",- "SY=Syria",- "TC=Turks and Caicos Islands",- "TD=Chad",- "TF=French Southern Territories",- "TH=Thailand",- "TJ=Tajikistan",- "TK=Tokelau",- "TM=Turkmenistan",- "TO=Tonga",- "TP=East Timor",- "TT=Trinidad and Tobago",- "TV=Tuvalu",- "TW=Taiwan",- "UA=Ukraine",- "UM=US Minor Outlying Islands",- "UZ=Uzbekistan",- */-- /* TLDs:- aero, biz, com, coop, edu, gov, info, int, mil, museum, name, net, org, pro, arpa- AC, AD, AE, AERO, AF, AG, AI, AL, AM, AN, AO, AQ, AR, ARPA, AS, AT, AU, AW, AZ,- BA, BB, BD, BE, BF, BG, BH, BI, BIZ, BJ, BM, BN, BO, BR, BS, BT, BV, BW, BY, BZ,- CA, CC, CD, CF, CG, CH, CI, CK, CL, CM, CN, CO, COM, COOP, CR, CU, CV, CX, CY, CZ,- DE, DJ, DK, DM, DO, DZ, EC, EDU, EE, EG, ER, ES, ET, EU, FI, FJ, FK, FM, FO, FR,- GA, GB, GD, GE, GF, GG, GH, GI, GL, GM, GN, GOV, GP, GQ, GR, GS, GT, GU, GW, GY,- HK, HM, HN, HR, HT, HU, ID, IE, IL, IM, IN, INFO, INT, IO, IQ, IR, IS, IT,- JE, JM, JO, JOBS, JP, KE, KG, KH, KI, KM, KN, KR, KW, KY, KZ,- LA, LB, LC, LI, LK, LR, LS, LT, LU, LV, LY,- MA, MC, MD, MG, MH, MIL, MK, ML, MM, MN, MO, MOBI, MP, MQ, MR, MS, MT, MU, MUSEUM, MV, MW, MX, MY, MZ,- NA, NAME, NC, NE, NET, NF, NG, NI, NL, NO, NP, NR, NU, NZ, OM, ORG,- PA, PE, PF, PG, PH, PK, PL, PM, PN, PR, PRO, PS, PT, PW, PY, QA, RE, RO, RU, RW,- SA, SB, SC, SD, SE, SG, SH, SI, SJ, SK, SL, SM, SN, SO, SR, ST, SU, SV, SY, SZ,- TC, TD, TF, TG, TH, TJ, TK, TL, TM, TN, TO, TP, TR, TRAVEL, TT, TV, TW, TZ,- UA, UG, UK, UM, US, UY, UZ, VA, VC, VE, VG, VI, VN, VU, WF, WS, YE, YT, YU, ZA, ZM, ZW- */-- public static String dummyHash;- private static HashMap TLDID = new HashMap();- private static HashMap TLDName = new HashMap();- private static void insertTLDProps(String[] TLDList, int id) {- int p;- String tld, name;- Integer ID = new Integer(id);- for (int i = 0; i < TLDList.length; i++) {- p = TLDList[i].indexOf('=');- if (p > 0) {- tld = TLDList[i].substring(0, p).toLowerCase();- name = TLDList[i].substring(p + 1);- TLDID.put(tld, ID);- TLDName.put(tld, name);- }- }- }- static {- // create a dummy hash- dummyHash = "";- for (int i = 0; i < yacySeedDB.commonHashLength; i++) dummyHash += "-";-- // assign TLD-ids and names- insertTLDProps(TLD_EuropaRussia, 0);- insertTLDProps(TLD_MiddleSouthAmerica, 1);- insertTLDProps(TLD_SouthEastAsia, 2);- insertTLDProps(TLD_MiddleEastWestAsia, 3);- insertTLDProps(TLD_NorthAmericaOceania, 4);- insertTLDProps(TLD_Africa, 5);- insertTLDProps(TLD_Generic, 6);- // the id=7 is used to flag local addresses- }--- // the class object- protected kelondroIndex urlIndexFile = null;-- public indexURL() {- urlIndexFile = null;- }-- public int size() {- try {- return urlIndexFile.size() ;- } catch (IOException e) {- return 0;- }- }-- public void close() throws IOException {- if (urlIndexFile != null) {- urlIndexFile.close();- urlIndexFile = null;- }- }-- public int cacheNodeChunkSize() {- if (urlIndexFile instanceof kelondroTree) return ((kelondroTree) urlIndexFile).cacheNodeChunkSize();- if (urlIndexFile instanceof kelondroCache) return ((kelondroCache) urlIndexFile).cacheNodeChunkSize();- if (urlIndexFile instanceof kelondroFlexTable) return ((kelondroFlexTable) urlIndexFile).cacheNodeChunkSize();- return 0;- }-- public int[] cacheNodeStatus() {- if (urlIndexFile instanceof kelondroTree) return ((kelondroTree) urlIndexFile).cacheNodeStatus();- if (urlIndexFile instanceof kelondroCache) return ((kelondroCache) urlIndexFile).cacheNodeStatus();- if (urlIndexFile instanceof kelondroFlexTable) return ((kelondroFlexTable) urlIndexFile).cacheNodeStatus();- return new int[]{0,0,0,0,0,0,0,0,0,0};- }-- public int cacheObjectChunkSize() {- if (urlIndexFile instanceof kelondroTree) return ((kelondroTree) urlIndexFile).cacheObjectChunkSize();- if (urlIndexFile instanceof kelondroCache) return ((kelondroCache) urlIndexFile).cacheObjectChunkSize();- if (urlIndexFile instanceof kelondroFlexTable) return ((kelondroFlexTable) urlIndexFile).cacheObjectChunkSize();- return 0;- }-- public long[] cacheObjectStatus() {- if (urlIndexFile instanceof kelondroTree) return ((kelondroTree) urlIndexFile).cacheObjectStatus();- if (urlIndexFile instanceof kelondroCache) return ((kelondroCache) urlIndexFile).cacheObjectStatus();- if (urlIndexFile instanceof kelondroFlexTable) return ((kelondroFlexTable) urlIndexFile).cacheObjectStatus();- return new long[]{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};- }-- public static final int flagTypeID(String hash) {- return (kelondroBase64Order.enhancedCoder.decodeByte(hash.charAt(11)) & 32) >> 5;- }- public static final int flagTLDID(String hash) {- return (kelondroBase64Order.enhancedCoder.decodeByte(hash.charAt(11)) & 28) >> 2;- }- public static final int flagLengthID(String hash) {- return (kelondroBase64Order.enhancedCoder.decodeByte(hash.charAt(11)) & 3);- }-- public static final String urlHash(String url) {- if ((url == null) || (url.length() == 0)) return null;- try {- return urlHash(new URL(url));- } catch (MalformedURLException e) {- return null;- }- }- public static final String urlHash(URL url) {- if (url == null) return null;- String host = url.getHost().toLowerCase();- int p = host.lastIndexOf('.');- String tld = "", dom = tld;- if (p > 0) {- tld = host.substring(p + 1);- dom = host.substring(0, p);- }- Integer ID = (serverCore.isNotLocal(tld)) ? (Integer) TLDID.get(tld) : null; // identify local addresses- int id = (ID == null) ? 7 : ID.intValue(); // local addresses are flagged with id=7- boolean isHTTP = url.getProtocol().equals("http");- p = dom.lastIndexOf('.'); // locate subdomain- String subdom = "";- if (p > 0) {- subdom = dom.substring(0, p);- dom = dom.substring(p + 1);- }- int port = url.getPort();- if (port <= 0) {- if (isHTTP) {- port = 80;- } else if (url.getProtocol().equalsIgnoreCase("https")) {- port = 443;- } else {- port = 21;- }- }- String path = url.getPath();- if (path.startsWith("/")) path = path.substring(1);- if (path.endsWith("/")) path = path.substring(0, path.length() - 1);- p = path.indexOf('/');- String rootpath = "";- if (p > 0) {- rootpath = path.substring(0, p);- }-- // we collected enough information to compute the fragments that are basis for hashes- int l = dom.length();- int domlengthKey = (l <= 8) ? 0 : (l <= 12) ? 1 : (l <= 16) ? 2 : 3;- byte flagbyte = (byte) (((isHTTP) ? 0 : 32) | (id << 2) | domlengthKey);-- // combine the attributes- StringBuffer hash = new StringBuffer(12);- // form the 'local' part of the hash- hash.append(kelondroBase64Order.enhancedCoder.encode(serverCodings.encodeMD5Raw(url.toNormalform())).substring(0, 5)); // 5 chars- hash.append(subdomPortPath(subdom, port, rootpath)); // 1 char- // form the 'global' part of the hash- hash.append(protocolHostPort(url.getProtocol(), host, port)); // 5 chars- hash.append(kelondroBase64Order.enhancedCoder.encodeByte(flagbyte)); // 1 char-- // return result hash- return new String(hash);- }-- private static char subdomPortPath(String subdom, int port, String rootpath) {- return kelondroBase64Order.enhancedCoder.encode(serverCodings.encodeMD5Raw(subdom + ":" + port + ":" + rootpath)).charAt(0);- }-- private static final char rootURLFlag = subdomPortPath("www", 80, "");- public static final boolean probablyRootURL(String urlHash) {- return (urlHash.charAt(5) == rootURLFlag);- }-- private static String protocolHostPort(String protocol, String host, int port) {- return kelondroBase64Order.enhancedCoder.encode(serverCodings.encodeMD5Raw(protocol + ":" + host + ":" + port)).substring(0, 5);- }-- private static String[] testTLDs = new String[] {"com", "net", "org", "uk", "fr", "de", "es", "it"};- public static final URL probablyWordURL(String urlHash, String word) {- if ((word == null) || (word.length() == 0)) return null;- String pattern = urlHash.substring(6, 11);- for (int i = 0; i < testTLDs.length; i++) {- if (pattern.equals(protocolHostPort("http", "www." + word.toLowerCase() + "." + testTLDs[i], 80)))- try {- return new URL("http://www." + word.toLowerCase() + "." + testTLDs[i]);- } catch (MalformedURLException e) {- return null;- }- }- return null;- }-- public static final boolean isWordRootURL(String givenURLHash, String word) {- if (!(probablyRootURL(givenURLHash))) return false;- URL wordURL = probablyWordURL(givenURLHash, word);- if (wordURL == null) return false;- return urlHash(wordURL).equals(givenURLHash);- }-- public static final int domLengthEstimation(String urlHash) {- // generates an estimation of the original domain length- assert (urlHash != null);- assert (urlHash.length() == 12) : "urlhash = " + urlHash;- int flagbyte = kelondroBase64Order.enhancedCoder.decodeByte(urlHash.charAt(11));- int domLengthKey = flagbyte & 3;- switch (domLengthKey) {- case 0: return 4;- case 1: return 10;- case 2: return 14;- case 3: return 20;- }- return 20;- }-- public static int domLengthNormalized(String urlHash) {- return 255 * domLengthEstimation(urlHash) / 30;- }-- public static final int domDomain(String urlHash) {- // returns the ID of the domain of the domain- assert (urlHash != null);- assert (urlHash.length() == 12) : "urlhash = " + urlHash;- int flagbyte = kelondroBase64Order.enhancedCoder.decodeByte(urlHash.charAt(11));- return (flagbyte & 12) >> 2;- }-- public static boolean isGlobalDomain(String urlhash) {- return domDomain(urlhash) != 7;- }-- public static final String oldurlHash(URL url) {- if (url == null) return null;- String hash = kelondroBase64Order.enhancedCoder.encode(serverCodings.encodeMD5Raw(url.toNormalform())).substring(0, yacySeedDB.commonHashLength);- return hash;- }-- public static final String oldurlHash(String url) throws MalformedURLException {- if ((url == null) || (url.length() < 10)) return null;- String hash = kelondroBase64Order.enhancedCoder.encode(serverCodings.encodeMD5Raw(new URL(url).toNormalform())).substring(0, yacySeedDB.commonHashLength);- return hash;- }-- public static final serverByteBuffer compressIndex(indexContainer inputContainer, indexContainer excludeContainer, long maxtime) {- // collect references according to domains- long timeout = (maxtime < 0) ? Long.MAX_VALUE : System.currentTimeMillis() + maxtime;- TreeMap doms = new TreeMap();- synchronized(inputContainer) {- Iterator i = inputContainer.entries();- indexRWIEntry iEntry;- String dom, paths;- while (i.hasNext()) {- iEntry = (indexRWIEntry) i.next();- if ((excludeContainer != null) && (excludeContainer.get(iEntry.urlHash()) != null)) continue; // do not include urls that are in excludeContainer- dom = iEntry.urlHash().substring(6);- if ((paths = (String) doms.get(dom)) == null) {- doms.put(dom, iEntry.urlHash().substring(0, 6));- } else {- doms.put(dom, paths + iEntry.urlHash().substring(0, 6));- }- if (System.currentTimeMillis() > timeout) break;- }- }- // construct a result string- serverByteBuffer bb = new serverByteBuffer(inputContainer.size() * 6);- bb.append('{');- Iterator i = doms.entrySet().iterator();- Map.Entry entry;- while (i.hasNext()) {- entry = (Map.Entry) i.next();- bb.append((String) entry.getKey());- bb.append(':');- bb.append((String) entry.getValue());- if (System.currentTimeMillis() > timeout) break;- if (i.hasNext()) bb.append(',');- }- bb.append('}');- bb.trim();- return bb;- }-- public static final void decompressIndex(TreeMap target, serverByteBuffer ci, String peerhash) {- // target is a mapping from url-hashes to a string of peer-hashes- if ((ci.byteAt(0) == '{') && (ci.byteAt(ci.length() - 1) == '}')) {- //System.out.println("DEBUG-DECOMPRESS: input is " + ci.toString());- ci = ci.trim(1, ci.length() - 1);- String dom, url, peers;- while ((ci.length() >= 13) && (ci.byteAt(6) == ':')) {- dom = ci.toString(0, 6);- ci.trim(7);- while ((ci.length() > 0) && (ci.byteAt(0) != ',')) {- url = ci.toString(0, 6) + dom;- ci.trim(6);- peers = (String) target.get(url);- if (peers == null) {- target.put(url, peerhash);- } else {- target.put(url, peers + peerhash);- }- //System.out.println("DEBUG-DECOMPRESS: " + url + ":" + target.get(url));- }- if (ci.byteAt(0) == ',') ci.trim(1);- }- }- }--}diff --git a/source/de/anomic/index/indexURLEntryNew.java b/source/de/anomic/index/indexURLEntryNew.javaindex 2cc9dcf34..dfb5f3648 100644--- a/source/de/anomic/index/indexURLEntryNew.java+++ b/source/de/anomic/index/indexURLEntryNew.java@@ -11,6 +11,7 @@ import de.anomic.kelondro.kelondroNaturalOrder;import de.anomic.kelondro.kelondroBase64Order;import de.anomic.kelondro.kelondroRow;import de.anomic.net.URL;+import de.anomic.plasma.plasmaURL;import de.anomic.server.serverCharBuffer;import de.anomic.server.serverCodings;import de.anomic.tools.crypt;@@ -69,7 +70,7 @@ public class indexURLEntryNew implements indexURLEntry {int lapp) {// create new entry and store it into databasethis.entry = rowdef.newEntry();- this.entry.setCol("hash", indexURL.urlHash(url), null);+ this.entry.setCol("hash", plasmaURL.urlHash(url), null);this.entry.setCol("comp", encodeComp(url, descr, author, tags, ETag));this.entry.setCol("mod", encodeDate(mod));this.entry.setCol("load", encodeDate(load));@@ -127,24 +128,24 @@ public class indexURLEntryNew implements indexURLEntry {String ETag = crypt.simpleDecode(prop.getProperty("ETag", ""), null); if (ETag == null) ETag = "";this.entry = rowdef.newEntry();- this.entry.setCol("hash", indexURL.urlHash(url), null);+ this.entry.setCol("hash", plasmaURL.urlHash(url), null);this.entry.setCol("comp", encodeComp(url, descr, author, tags, ETag));try {- this.entry.setCol("mod", encodeDate(indexURL.shortDayFormatter.parse(prop.getProperty("mod", "20000101"))));+ this.entry.setCol("mod", encodeDate(plasmaURL.shortDayFormatter.parse(prop.getProperty("mod", "20000101"))));} catch (ParseException e) {this.entry.setCol("mod", encodeDate(new Date()));}try {- this.entry.setCol("load", encodeDate(indexURL.shortDayFormatter.parse(prop.getProperty("load", "20000101"))));+ this.entry.setCol("load", encodeDate(plasmaURL.shortDayFormatter.parse(prop.getProperty("load", "20000101"))));} catch (ParseException e) {this.entry.setCol("load", encodeDate(new Date()));}try {- this.entry.setCol("fresh", encodeDate(indexURL.shortDayFormatter.parse(prop.getProperty("fresh", "20000101"))));+ this.entry.setCol("fresh", encodeDate(plasmaURL.shortDayFormatter.parse(prop.getProperty("fresh", "20000101"))));} catch (ParseException e) {this.entry.setCol("fresh", encodeDate(new Date()));}- this.entry.setCol("referrer", prop.getProperty("referrer", indexURL.dummyHash).getBytes());+ this.entry.setCol("referrer", prop.getProperty("referrer", plasmaURL.dummyHash).getBytes());this.entry.setCol("md5", serverCodings.decodeHex(prop.getProperty("md5", "")));this.entry.setCol("size", Integer.parseInt(prop.getProperty("size", "0")));this.entry.setCol("wc", Integer.parseInt(prop.getProperty("wc", "0")));@@ -172,9 +173,9 @@ public class indexURLEntryNew implements indexURLEntry {s.append(",author=").append(crypt.simpleEncode(comp.author()));s.append(",tags=").append(crypt.simpleEncode(comp.tags()));s.append(",ETag=").append(crypt.simpleEncode(comp.ETag()));- s.append(",mod=").append(indexURL.shortDayFormatter.format(moddate()));- s.append(",load=").append(indexURL.shortDayFormatter.format(loaddate()));- s.append(",fresh=").append(indexURL.shortDayFormatter.format(freshdate()));+ s.append(",mod=").append(plasmaURL.shortDayFormatter.format(moddate()));+ s.append(",load=").append(plasmaURL.shortDayFormatter.format(loaddate()));+ s.append(",fresh=").append(plasmaURL.shortDayFormatter.format(freshdate()));s.append(",referrer=").append(referrerHash());s.append(",md5=").append(md5());s.append(",size=").append(size());@@ -240,12 +241,12 @@ public class indexURLEntryNew implements indexURLEntry {public String referrerHash() {// return the creator's hash- return entry.getColString("referrer", indexURL.dummyHash, null);+ return entry.getColString("referrer", plasmaURL.dummyHash, null);}public String md5() {// returns the md5 in hex representation- return serverCodings.encodeHex(entry.getCol("md5", indexURL.dummyHash.getBytes()));+ return serverCodings.encodeHex(entry.getCol("md5", plasmaURL.dummyHash.getBytes()));}public char doctype() {diff --git a/source/de/anomic/index/indexURLEntryOld.java b/source/de/anomic/index/indexURLEntryOld.javaindex ae0feeb8f..1ad4527f7 100644--- a/source/de/anomic/index/indexURLEntryOld.java+++ b/source/de/anomic/index/indexURLEntryOld.java@@ -34,6 +34,7 @@ import de.anomic.http.httpc;import de.anomic.kelondro.kelondroBase64Order;import de.anomic.kelondro.kelondroRow;import de.anomic.net.URL;+import de.anomic.plasma.plasmaURL;import de.anomic.server.logging.serverLog;import de.anomic.tools.bitfield;import de.anomic.tools.crypt;@@ -95,12 +96,12 @@ public class indexURLEntryOld implements indexURLEntry {int lvideo,int lapp) {// create new entry and store it into database- this.urlHash = indexURL.urlHash(url);+ this.urlHash = plasmaURL.urlHash(url);this.url = url;this.descr = (descr == null) ? this.url.toString() : descr;this.moddate = mod;this.loaddate = load;- this.referrerHash = (referrerHash == null) ? indexURL.dummyHash : referrerHash;+ this.referrerHash = (referrerHash == null) ? plasmaURL.dummyHash : referrerHash;this.copyCount = 0; // the number of remote (global) copies of this object without this onethis.flags = " ";this.quality = 0;@@ -119,7 +120,7 @@ public class indexURLEntryOld implements indexURLEntry {this.descr = (entry.empty(2)) ? this.url.toString() : entry.getColString(2, "UTF-8").trim();this.moddate = new Date(86400000 * entry.getColLong(3));this.loaddate = new Date(86400000 * entry.getColLong(4));- this.referrerHash = (entry.empty(5)) ? indexURL.dummyHash : entry.getColString(5, "UTF-8");+ this.referrerHash = (entry.empty(5)) ? plasmaURL.dummyHash : entry.getColString(5, "UTF-8");this.copyCount = (int) entry.getColLong(6);this.flags = entry.getColString(7, "UTF-8");this.quality = (int) entry.getColLong(8);@@ -140,12 +141,12 @@ public class indexURLEntryOld implements indexURLEntry {// generates an plasmaLURLEntry using the properties from the argument// the property names must correspond to the one from toString//System.out.println("DEBUG-ENTRY: prop=" + prop.toString());- this.urlHash = prop.getProperty("hash", indexURL.dummyHash);+ this.urlHash = prop.getProperty("hash", plasmaURL.dummyHash);try {- this.referrerHash = prop.getProperty("referrer", indexURL.dummyHash);- this.moddate = indexURL.shortDayFormatter.parse(prop.getProperty("mod", "20000101"));+ this.referrerHash = prop.getProperty("referrer", plasmaURL.dummyHash);+ this.moddate = plasmaURL.shortDayFormatter.parse(prop.getProperty("mod", "20000101"));//System.out.println("DEBUG: moddate = " + moddate + ", prop=" + prop.getProperty("mod"));- this.loaddate = indexURL.shortDayFormatter.parse(prop.getProperty("load", "20000101"));+ this.loaddate = plasmaURL.shortDayFormatter.parse(prop.getProperty("load", "20000101"));this.copyCount = Integer.parseInt(prop.getProperty("cc", "0"));this.flags = ((prop.getProperty("local", "true").equals("true")) ? "L " : " ");this.url = new URL(crypt.simpleDecode(prop.getProperty("url", ""), null));@@ -282,9 +283,9 @@ public class indexURLEntryOld implements indexURLEntry {try {corePropStr.append("hash=").append(urlHash).append(",referrer=").append(referrerHash).append(",mod=").append(- indexURL.shortDayFormatter.format(moddate)).append(+ plasmaURL.shortDayFormatter.format(moddate)).append(",load=").append(- indexURL.shortDayFormatter.format(loaddate))+ plasmaURL.shortDayFormatter.format(loaddate)).append(",size=").append(size).append(",wc=").append(wordCount).append(",cc=").append(copyCount).append(",local=").append(((local()) ? "true" : "false"))diff --git a/source/de/anomic/plasma/cache/ftp/ResourceInfo.java b/source/de/anomic/plasma/cache/ftp/ResourceInfo.javaindex 89b86b357..176736c0e 100644--- a/source/de/anomic/plasma/cache/ftp/ResourceInfo.java+++ b/source/de/anomic/plasma/cache/ftp/ResourceInfo.java@@ -51,7 +51,7 @@ import java.util.Date;import java.util.HashMap;import java.util.Map;-import de.anomic.index.indexURL;+import de.anomic.plasma.plasmaURL;import de.anomic.net.URL;import de.anomic.plasma.cache.IResourceInfo;import de.anomic.plasma.cache.ResourceInfoFactory;@@ -77,7 +77,7 @@ public class ResourceInfo implements IResourceInfo {// generating the url hashthis.url = objectURL;- this.urlHash = indexURL.urlHash(this.url.toNormalform());+ this.urlHash = plasmaURL.urlHash(this.url.toNormalform());// create the http header objectthis.propertyMap = new HashMap(objectInfo);@@ -88,7 +88,7 @@ public class ResourceInfo implements IResourceInfo {// generating the url hashthis.url = objectURL;- this.urlHash = indexURL.urlHash(this.url.toNormalform());+ this.urlHash = plasmaURL.urlHash(this.url.toNormalform());// create the http header objectthis.propertyMap = new HashMap();diff --git a/source/de/anomic/plasma/cache/http/ResourceInfo.java b/source/de/anomic/plasma/cache/http/ResourceInfo.javaindex 83cce02d3..50842dddc 100644--- a/source/de/anomic/plasma/cache/http/ResourceInfo.java+++ b/source/de/anomic/plasma/cache/http/ResourceInfo.java@@ -52,7 +52,7 @@ import java.util.Date;import java.util.Map;import de.anomic.http.httpHeader;-import de.anomic.index.indexURL;+import de.anomic.plasma.plasmaURL;import de.anomic.net.URL;import de.anomic.plasma.plasmaHTCache;import de.anomic.plasma.cache.IResourceInfo;@@ -76,7 +76,7 @@ public class ResourceInfo implements IResourceInfo {// generating the url hashthis.url = objectURL;- this.urlHash = indexURL.urlHash(this.url.toNormalform());+ this.urlHash = plasmaURL.urlHash(this.url.toNormalform());// create the http header objectthis.responseHeader = new httpHeader(null, objectInfo);@@ -88,7 +88,7 @@ public class ResourceInfo implements IResourceInfo {// generating the url hashthis.url = objectURL;- this.urlHash = indexURL.urlHash(this.url.toNormalform());+ this.urlHash = plasmaURL.urlHash(this.url.toNormalform());this.requestHeader = requestHeaders;this.responseHeader = responseHeaders;diff --git a/source/de/anomic/plasma/crawler/AbstractCrawlWorker.java b/source/de/anomic/plasma/crawler/AbstractCrawlWorker.javaindex 1e4c806df..a82f2df55 100644--- a/source/de/anomic/plasma/crawler/AbstractCrawlWorker.java+++ b/source/de/anomic/plasma/crawler/AbstractCrawlWorker.java@@ -50,7 +50,7 @@ package de.anomic.plasma.crawler;import java.io.File;import java.io.IOException;-import de.anomic.index.indexURL;+import de.anomic.plasma.plasmaURL;import de.anomic.net.URL;import de.anomic.plasma.plasmaCrawlEURL;import de.anomic.plasma.plasmaCrawlLoaderMessage;@@ -287,7 +287,7 @@ public abstract class AbstractCrawlWorker extends Thread implements plasmaCrawlWthis.errorMessage = failreason;// convert the referrer URL into a hash value- String referrerHash = (this.refererURLString==null)?null:indexURL.urlHash(this.refererURLString);+ String referrerHash = (this.refererURLString==null)?null:plasmaURL.urlHash(this.refererURLString);// create a new errorURL DB entryplasmaCrawlEURL.Entry ee = this.sb.urlPool.errorURL.newEntry(diff --git a/source/de/anomic/plasma/crawler/http/CrawlWorker.java b/source/de/anomic/plasma/crawler/http/CrawlWorker.javaindex 912ca594e..1429f8e44 100644--- a/source/de/anomic/plasma/crawler/http/CrawlWorker.java+++ b/source/de/anomic/plasma/crawler/http/CrawlWorker.java@@ -60,7 +60,7 @@ import de.anomic.http.httpc;import de.anomic.http.httpdBoundedSizeOutputStream;import de.anomic.http.httpdLimitExceededException;import de.anomic.http.httpdProxyHandler;-import de.anomic.index.indexURL;+import de.anomic.plasma.plasmaURL;import de.anomic.net.URL;import de.anomic.plasma.plasmaCrawlEURL;import de.anomic.plasma.plasmaCrawlLoader;@@ -339,7 +339,7 @@ public final class CrawlWorker extends AbstractCrawlWorker {}// generating url hash- String urlhash = indexURL.urlHash(redirectionUrl);+ String urlhash = plasmaURL.urlHash(redirectionUrl);// removing url from loader queueplasmaCrawlLoader.switchboard.urlPool.noticeURL.remove(urlhash);diff --git a/source/de/anomic/plasma/plasmaCrawlEURL.java b/source/de/anomic/plasma/plasmaCrawlEURL.javaindex 52039c7d9..f190aa024 100644--- a/source/de/anomic/plasma/plasmaCrawlEURL.java+++ b/source/de/anomic/plasma/plasmaCrawlEURL.java@@ -53,16 +53,18 @@ import java.util.Date;import java.util.Iterator;import java.util.LinkedList;-import de.anomic.index.indexURL;+import de.anomic.plasma.plasmaURL;import de.anomic.kelondro.kelondroBase64Order;+import de.anomic.kelondro.kelondroCache;import de.anomic.kelondro.kelondroFlexTable;+import de.anomic.kelondro.kelondroIndex;import de.anomic.kelondro.kelondroRow;import de.anomic.kelondro.kelondroTree;import de.anomic.net.URL;import de.anomic.tools.bitfield;import de.anomic.yacy.yacySeedDB;-public class plasmaCrawlEURL extends indexURL {+public class plasmaCrawlEURL {/* =======================================================================* Failure reason constants@@ -144,7 +146,10 @@ public class plasmaCrawlEURL extends indexURL {"Cardinal retrycount-2 {b64e}, " + // number of load retries"String failcause-80, " + // string describing load failure"byte[] flags-2"); // extra space-++ // the class object+ private kelondroIndex urlIndexFile = null;+public plasmaCrawlEURL(File cachePath, int bufferkb, long preloadTime, boolean newdb) {super();@@ -165,11 +170,55 @@ public class plasmaCrawlEURL extends indexURL {}}++ public int size() {+ try {+ return urlIndexFile.size() ;+ } catch (IOException e) {+ return 0;+ }+ }++ public void close() throws IOException {+ if (urlIndexFile != null) {+ urlIndexFile.close();+ urlIndexFile = null;+ }+ }++ public int cacheNodeChunkSize() {+ if (urlIndexFile instanceof kelondroTree) return ((kelondroTree) urlIndexFile).cacheNodeChunkSize();+ if (urlIndexFile instanceof kelondroCache) return ((kelondroCache) urlIndexFile).cacheNodeChunkSize();+ if (urlIndexFile instanceof kelondroFlexTable) return ((kelondroFlexTable) urlIndexFile).cacheNodeChunkSize();+ return 0;+ }++ public int[] cacheNodeStatus() {+ if (urlIndexFile instanceof kelondroTree) return ((kelondroTree) urlIndexFile).cacheNodeStatus();+ if (urlIndexFile instanceof kelondroCache) return ((kelondroCache) urlIndexFile).cacheNodeStatus();+ if (urlIndexFile instanceof kelondroFlexTable) return ((kelondroFlexTable) urlIndexFile).cacheNodeStatus();+ return new int[]{0,0,0,0,0,0,0,0,0,0};+ }++ public int cacheObjectChunkSize() {+ if (urlIndexFile instanceof kelondroTree) return ((kelondroTree) urlIndexFile).cacheObjectChunkSize();+ if (urlIndexFile instanceof kelondroCache) return ((kelondroCache) urlIndexFile).cacheObjectChunkSize();+ if (urlIndexFile instanceof kelondroFlexTable) return ((kelondroFlexTable) urlIndexFile).cacheObjectChunkSize();+ return 0;+ }++ public long[] cacheObjectStatus() {+ if (urlIndexFile instanceof kelondroTree) return ((kelondroTree) urlIndexFile).cacheObjectStatus();+ if (urlIndexFile instanceof kelondroCache) return ((kelondroCache) urlIndexFile).cacheObjectStatus();+ if (urlIndexFile instanceof kelondroFlexTable) return ((kelondroFlexTable) urlIndexFile).cacheObjectStatus();+ return new long[]{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};+ }+public synchronized Entry newEntry(URL url, String referrer, String initiator, String executor,String name, String failreason, bitfield flags) {- if ((referrer == null) || (referrer.length() < yacySeedDB.commonHashLength)) referrer = dummyHash;- if ((initiator == null) || (initiator.length() < yacySeedDB.commonHashLength)) initiator = dummyHash;- if ((executor == null) || (executor.length() < yacySeedDB.commonHashLength)) executor = dummyHash;+ if ((referrer == null) || (referrer.length() < yacySeedDB.commonHashLength)) referrer = plasmaURL.dummyHash;+ if ((initiator == null) || (initiator.length() < yacySeedDB.commonHashLength)) initiator = plasmaURL.dummyHash;+ if ((executor == null) || (executor.length() < yacySeedDB.commonHashLength)) executor = plasmaURL.dummyHash;if (failreason == null) failreason = "unknown";return new Entry(url, referrer, initiator, executor, name, failreason, flags);}@@ -236,8 +285,8 @@ public class plasmaCrawlEURL extends indexURL {public Entry(URL url, String referrer, String initiator,String executor, String name, String failreason, bitfield flags) {// create new entry- this.hash = urlHash(url);- this.referrer = (referrer == null) ? dummyHash : referrer;+ this.hash = plasmaURL.urlHash(url);+ this.referrer = (referrer == null) ? plasmaURL.dummyHash : referrer;this.initiator = initiator;this.executor = executor;this.url = url;diff --git a/source/de/anomic/plasma/plasmaCrawlLURL.java b/source/de/anomic/plasma/plasmaCrawlLURL.javaindex a592cf8c2..84653d729 100644--- a/source/de/anomic/plasma/plasmaCrawlLURL.java+++ b/source/de/anomic/plasma/plasmaCrawlLURL.java@@ -63,13 +63,15 @@ import java.util.LinkedList;import de.anomic.http.httpc;import de.anomic.http.httpc.response;import de.anomic.index.indexRWIEntry;-import de.anomic.index.indexURL;+import de.anomic.plasma.plasmaURL;import de.anomic.index.indexURLEntry;import de.anomic.index.indexURLEntryNew;import de.anomic.index.indexURLEntryOld;import de.anomic.kelondro.kelondroCache;import de.anomic.kelondro.kelondroFlexSplitTable;import de.anomic.kelondro.kelondroBase64Order;+import de.anomic.kelondro.kelondroFlexTable;+import de.anomic.kelondro.kelondroIndex;import de.anomic.kelondro.kelondroRow;import de.anomic.kelondro.kelondroTree;import de.anomic.net.URL;@@ -79,7 +81,7 @@ import de.anomic.server.logging.serverLog;import de.anomic.tools.bitfield;import de.anomic.yacy.yacySeedDB;-public final class plasmaCrawlLURL extends indexURL {+public final class plasmaCrawlLURL {// result stacks;// these have all entries of form@@ -93,6 +95,9 @@ public final class plasmaCrawlLURL extends indexURL {private boolean newdb;+ // the class object+ private kelondroIndex urlIndexFile = null;+public plasmaCrawlLURL(File plasmaPath, File indexPath, int bufferkb, long preloadTime, boolean newdb) {super();this.newdb = newdb;@@ -119,11 +124,54 @@ public final class plasmaCrawlLURL extends indexURL {gcrawlResultStack = new LinkedList();}+ public int size() {+ try {+ return urlIndexFile.size() ;+ } catch (IOException e) {+ return 0;+ }+ }++ public void close() throws IOException {+ if (urlIndexFile != null) {+ urlIndexFile.close();+ urlIndexFile = null;+ }+ }++ public int cacheNodeChunkSize() {+ if (urlIndexFile instanceof kelondroTree) return ((kelondroTree) urlIndexFile).cacheNodeChunkSize();+ if (urlIndexFile instanceof kelondroCache) return ((kelondroCache) urlIndexFile).cacheNodeChunkSize();+ if (urlIndexFile instanceof kelondroFlexTable) return ((kelondroFlexTable) urlIndexFile).cacheNodeChunkSize();+ return 0;+ }++ public int[] cacheNodeStatus() {+ if (urlIndexFile instanceof kelondroTree) return ((kelondroTree) urlIndexFile).cacheNodeStatus();+ if (urlIndexFile instanceof kelondroCache) return ((kelondroCache) urlIndexFile).cacheNodeStatus();+ if (urlIndexFile instanceof kelondroFlexTable) return ((kelondroFlexTable) urlIndexFile).cacheNodeStatus();+ return new int[]{0,0,0,0,0,0,0,0,0,0};+ }++ public int cacheObjectChunkSize() {+ if (urlIndexFile instanceof kelondroTree) return ((kelondroTree) urlIndexFile).cacheObjectChunkSize();+ if (urlIndexFile instanceof kelondroCache) return ((kelondroCache) urlIndexFile).cacheObjectChunkSize();+ if (urlIndexFile instanceof kelondroFlexTable) return ((kelondroFlexTable) urlIndexFile).cacheObjectChunkSize();+ return 0;+ }++ public long[] cacheObjectStatus() {+ if (urlIndexFile instanceof kelondroTree) return ((kelondroTree) urlIndexFile).cacheObjectStatus();+ if (urlIndexFile instanceof kelondroCache) return ((kelondroCache) urlIndexFile).cacheObjectStatus();+ if (urlIndexFile instanceof kelondroFlexTable) return ((kelondroFlexTable) urlIndexFile).cacheObjectStatus();+ return new long[]{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};+ }+public synchronized void stack(indexURLEntry e, String initiatorHash, String executorHash, int stackType) {if (e == null) { return; }try {- if (initiatorHash == null) { initiatorHash = dummyHash; }- if (executorHash == null) { executorHash = dummyHash; }+ if (initiatorHash == null) { initiatorHash = plasmaURL.dummyHash; }+ if (executorHash == null) { executorHash = plasmaURL.dummyHash; }switch (stackType) {case 0: break;case 1: externResultStack.add(e.hash() + initiatorHash + executorHash); break;@@ -558,7 +606,7 @@ public final class plasmaCrawlLURL extends indexURL {// returns url-hashif (args[0].equals("-h")) try {// arg 1 is url- System.out.println("HASH: " + urlHash(new URL(args[1])));+ System.out.println("HASH: " + plasmaURL.urlHash(new URL(args[1])));} catch (MalformedURLException e) {}if (args[0].equals("-l")) try {// arg 1 is path to URLCachediff --git a/source/de/anomic/plasma/plasmaCrawlNURL.java b/source/de/anomic/plasma/plasmaCrawlNURL.javaindex 7b31da4cc..2fa856861 100644--- a/source/de/anomic/plasma/plasmaCrawlNURL.java+++ b/source/de/anomic/plasma/plasmaCrawlNURL.java@@ -50,11 +50,12 @@ import java.util.Date;import java.util.HashSet;import java.util.Iterator;-import de.anomic.index.indexURL;+import de.anomic.plasma.plasmaURL;import de.anomic.kelondro.kelondroBase64Order;import de.anomic.kelondro.kelondroCache;import de.anomic.kelondro.kelondroException;import de.anomic.kelondro.kelondroFlexTable;+import de.anomic.kelondro.kelondroIndex;import de.anomic.kelondro.kelondroRecords;import de.anomic.kelondro.kelondroRow;import de.anomic.kelondro.kelondroStack;@@ -64,7 +65,7 @@ import de.anomic.server.logging.serverLog;import de.anomic.tools.bitfield;import de.anomic.yacy.yacySeedDB;-public class plasmaCrawlNURL extends indexURL {+public class plasmaCrawlNURL {public static final int STACK_TYPE_NULL = 0; // do not stackpublic static final int STACK_TYPE_CORE = 1; // put on local stack@@ -108,6 +109,9 @@ public class plasmaCrawlNURL extends indexURL {private boolean newdb;initStackIndex initThead;+ // the class object+ private kelondroIndex urlIndexFile = null;+public plasmaCrawlNURL(File cachePath, int bufferkb, long preloadTime, boolean newdb) {super();this.cacheStacksPath = cachePath;@@ -139,6 +143,42 @@ public class plasmaCrawlNURL extends indexURL {stackIndex = new HashSet();(initThead = new initStackIndex()).start();}++ public int size() {+ try {+ return urlIndexFile.size() ;+ } catch (IOException e) {+ return 0;+ }+ }++ public int cacheNodeChunkSize() {+ if (urlIndexFile instanceof kelondroTree) return ((kelondroTree) urlIndexFile).cacheNodeChunkSize();+ if (urlIndexFile instanceof kelondroCache) return ((kelondroCache) urlIndexFile).cacheNodeChunkSize();+ if (urlIndexFile instanceof kelondroFlexTable) return ((kelondroFlexTable) urlIndexFile).cacheNodeChunkSize();+ return 0;+ }++ public int[] cacheNodeStatus() {+ if (urlIndexFile instanceof kelondroTree) return ((kelondroTree) urlIndexFile).cacheNodeStatus();+ if (urlIndexFile instanceof kelondroCache) return ((kelondroCache) urlIndexFile).cacheNodeStatus();+ if (urlIndexFile instanceof kelondroFlexTable) return ((kelondroFlexTable) urlIndexFile).cacheNodeStatus();+ return new int[]{0,0,0,0,0,0,0,0,0,0};+ }++ public int cacheObjectChunkSize() {+ if (urlIndexFile instanceof kelondroTree) return ((kelondroTree) urlIndexFile).cacheObjectChunkSize();+ if (urlIndexFile instanceof kelondroCache) return ((kelondroCache) urlIndexFile).cacheObjectChunkSize();+ if (urlIndexFile instanceof kelondroFlexTable) return ((kelondroFlexTable) urlIndexFile).cacheObjectChunkSize();+ return 0;+ }++ public long[] cacheObjectStatus() {+ if (urlIndexFile instanceof kelondroTree) return ((kelondroTree) urlIndexFile).cacheObjectStatus();+ if (urlIndexFile instanceof kelondroCache) return ((kelondroCache) urlIndexFile).cacheObjectStatus();+ if (urlIndexFile instanceof kelondroFlexTable) return ((kelondroFlexTable) urlIndexFile).cacheObjectStatus();+ return new long[]{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};+ }public void waitOnInitThread() {try {@@ -195,7 +235,10 @@ public class plasmaCrawlNURL extends indexURL {try {imageStack.close();} catch (IOException e) {}try {movieStack.close();} catch (IOException e) {}try {musicStack.close();} catch (IOException e) {}- try { super.close(); } catch (IOException e) {}+ if (urlIndexFile != null) try {+ urlIndexFile.close();+ urlIndexFile = null;+ } catch (IOException e) {}}public class initStackIndex extends Thread {@@ -471,10 +514,10 @@ public class plasmaCrawlNURL extends indexURL {int forkfactor) {// create new entry and store it into database- this.hash = urlHash(url);+ this.hash = plasmaURL.urlHash(url);this.initiator = initiator;this.url = url;- this.referrer = (referrer == null) ? dummyHash : referrer;+ this.referrer = (referrer == null) ? plasmaURL.dummyHash : referrer;this.name = (name == null) ? "" : name;this.loaddate = (loaddate == null) ? new Date() : loaddate;this.profileHandle = profileHandle; // must not be null@@ -520,7 +563,7 @@ public class plasmaCrawlNURL extends indexURL {this.hash = entry.getColString(0, null);this.initiator = entry.getColString(1, null);this.url = new URL(urlstring);- this.referrer = (entry.empty(3)) ? dummyHash : entry.getColString(3, null);+ this.referrer = (entry.empty(3)) ? plasmaURL.dummyHash : entry.getColString(3, null);this.name = (entry.empty(4)) ? "" : entry.getColString(4, "UTF-8").trim();this.loaddate = new Date(86400000 * entry.getColLong(5));this.profileHandle = (entry.empty(6)) ? null : entry.getColString(6, null).trim();@@ -573,7 +616,7 @@ public class plasmaCrawlNURL extends indexURL {str.append("hash: ").append(hash==null ? "null" : hash).append(" | ").append("initiator: ").append(initiator==null?"null":initiator).append(" | ").append("url: ").append(url==null?"null":url.toString()).append(" | ")- .append("referrer: ").append((referrer == null) ? dummyHash : referrer).append(" | ")+ .append("referrer: ").append((referrer == null) ? plasmaURL.dummyHash : referrer).append(" | ").append("name: ").append((name == null) ? "null" : name).append(" | ").append("loaddate: ").append((loaddate == null) ? new Date() : loaddate).append(" | ").append("profile: ").append(profileHandle==null?"null":profileHandle).append(" | ")diff --git a/source/de/anomic/plasma/plasmaCrawlStacker.java b/source/de/anomic/plasma/plasmaCrawlStacker.javaindex 8ea724ec9..9b1ec9f5b 100644--- a/source/de/anomic/plasma/plasmaCrawlStacker.java+++ b/source/de/anomic/plasma/plasmaCrawlStacker.java@@ -59,7 +59,7 @@ import org.apache.commons.pool.impl.GenericObjectPool;import de.anomic.data.robotsParser;import de.anomic.http.httpc;-import de.anomic.index.indexURL;+import de.anomic.plasma.plasmaURL;import de.anomic.index.indexURLEntry;import de.anomic.kelondro.kelondroBase64Order;import de.anomic.kelondro.kelondroCache;@@ -267,7 +267,7 @@ public final class plasmaCrawlStacker {String reason = null; // failure reason// getting the initiator peer hash- if ((initiatorHash == null) || (initiatorHash.length() == 0)) initiatorHash = indexURL.dummyHash;+ if ((initiatorHash == null) || (initiatorHash.length() == 0)) initiatorHash = plasmaURL.dummyHash;// strange errorsif (nexturlString == null) {@@ -286,7 +286,7 @@ public final class plasmaCrawlStacker {referrerString = null;}}- String referrerHash = (referrerString==null)?null:indexURL.urlHash(referrerString);+ String referrerHash = (referrerString==null)?null:plasmaURL.urlHash(referrerString);// check for malformed urlsURL nexturl = null;@@ -390,7 +390,7 @@ public final class plasmaCrawlStacker {// check if the url is double registeredcheckInterruption();- String nexturlhash = indexURL.urlHash(nexturl);+ String nexturlhash = plasmaURL.urlHash(nexturl);String dbocc = this.sb.urlPool.exists(nexturlhash);indexURLEntry oldEntry = null;oldEntry = this.sb.urlPool.loadedURL.load(nexturlhash, null);@@ -418,7 +418,7 @@ public final class plasmaCrawlStacker {}// store information- boolean local = ((initiatorHash.equals(indexURL.dummyHash)) || (initiatorHash.equals(yacyCore.seedDB.mySeed.hash)));+ boolean local = ((initiatorHash.equals(plasmaURL.dummyHash)) || (initiatorHash.equals(yacyCore.seedDB.mySeed.hash)));boolean global =(profile != null) &&(profile.remoteIndexing()) /* granted */ &&@@ -481,10 +481,10 @@ public final class plasmaCrawlStacker {int forkfactor) {try {// create new entry and store it into database- this.urlHash = indexURL.urlHash(urlString);+ this.urlHash = plasmaURL.urlHash(urlString);this.initiator = initiator;this.url = urlString;- this.referrerHash = (referrerUrlString == null) ? indexURL.dummyHash : indexURL.urlHash(referrerUrlString);+ this.referrerHash = (referrerUrlString == null) ? plasmaURL.dummyHash : plasmaURL.urlHash(referrerUrlString);this.name = (name == null) ? "" : name;this.loaddate = (loaddate == null) ? new Date() : loaddate;this.profileHandle = profileHandle; // must not be null@@ -506,7 +506,7 @@ public final class plasmaCrawlStacker {this.urlHash = urlHash;this.initiator = entry.getColString(1, "UTF-8");this.url = entry.getColString(2, "UTF-8").trim();- this.referrerHash = (entry.empty(3)) ? indexURL.dummyHash : entry.getColString(3, "UTF-8");+ this.referrerHash = (entry.empty(3)) ? plasmaURL.dummyHash : entry.getColString(3, "UTF-8");this.name = (entry.empty(4)) ? "" : entry.getColString(4, "UTF-8").trim();this.loaddate = new Date(86400000 * entry.getColLong(5));this.profileHandle = (entry.empty(6)) ? null : entry.getColString(6, "UTF-8").trim();@@ -561,7 +561,7 @@ public final class plasmaCrawlStacker {str.append("urlHash: ").append(urlHash==null ? "null" : urlHash).append(" | ").append("initiator: ").append(initiator==null?"null":initiator).append(" | ").append("url: ").append(url==null?"null":url).append(" | ")- .append("referrer: ").append((referrerHash == null) ? indexURL.dummyHash : referrerHash).append(" | ")+ .append("referrer: ").append((referrerHash == null) ? plasmaURL.dummyHash : referrerHash).append(" | ").append("name: ").append((name == null) ? "null" : name).append(" | ").append("loaddate: ").append((loaddate == null) ? new Date() : loaddate).append(" | ").append("profile: ").append(profileHandle==null?"null":profileHandle).append(" | ")diff --git a/source/de/anomic/plasma/plasmaHTCache.java b/source/de/anomic/plasma/plasmaHTCache.javaindex 701fa0318..42e377d1b 100644--- a/source/de/anomic/plasma/plasmaHTCache.java+++ b/source/de/anomic/plasma/plasmaHTCache.java@@ -73,8 +73,7 @@ import java.util.regex.Pattern;import de.anomic.http.httpc;import de.anomic.http.httpHeader;-import de.anomic.index.indexEntryAttribute;-import de.anomic.index.indexURL;+import de.anomic.plasma.plasmaURL;import de.anomic.kelondro.kelondroBase64Order;import de.anomic.kelondro.kelondroDyn;import de.anomic.kelondro.kelondroMScoreCluster;@@ -305,7 +304,7 @@ public final class plasmaHTCache {try {// As the file is gone, the entry in responseHeader.db is not needed anymorethis.log.logFinest("Trying to remove responseHeader from URL: " + url.toString());- this.responseHeaderDB.remove(indexURL.urlHash(url));+ this.responseHeaderDB.remove(plasmaURL.urlHash(url));} catch (IOException e) {this.log.logInfo("IOExeption removing response header from DB: " + e.getMessage(), e);}@@ -365,7 +364,7 @@ public final class plasmaHTCache {if (url != null) {this.log.logFinest("Trying to remove responseHeader for URL: " +url.toString());- this.responseHeaderDB.remove(indexURL.urlHash(url));+ this.responseHeaderDB.remove(plasmaURL.urlHash(url));}}} catch (IOException e) {@@ -502,7 +501,7 @@ public final class plasmaHTCache {public IResourceInfo loadResourceInfo(URL url) throws Exception {// getting the URL hash- String urlHash = indexURL.urlHash(url.toNormalform());+ String urlHash = plasmaURL.urlHash(url.toNormalform());// loading data from databaseMap hdb = this.responseHeaderDB.get(urlHash);@@ -699,7 +698,7 @@ public final class plasmaHTCache {}private File hashFile(StringBuffer fileName, String prefix, String extention, URL url) {- String hexHash = yacySeed.b64Hash2hexHash(indexURL.urlHash(url));+ String hexHash = yacySeed.b64Hash2hexHash(plasmaURL.urlHash(url));StringBuffer f = new StringBuffer(fileName.length() + 30);f.append(fileName);if (prefix != null) f.append('/').append(prefix);@@ -993,7 +992,7 @@ public final class plasmaHTCache {}this.name = name;this.cacheFile = getCachePath(this.url);- this.nomalizedURLHash = indexURL.urlHash(this.nomalizedURLString);+ this.nomalizedURLHash = plasmaURL.urlHash(this.nomalizedURLString);// assigned:this.initDate = initDate;@@ -1008,9 +1007,9 @@ public final class plasmaHTCache {this.lastModified = resourceInfo.getModificationDate();// getting the doctype- this.doctype = indexEntryAttribute.docType(resourceInfo.getMimeType());- if (this.doctype == indexEntryAttribute.DT_UNKNOWN) this.doctype = indexEntryAttribute.docType(url);- this.language = indexEntryAttribute.language(url);+ this.doctype = plasmaURL.docType(resourceInfo.getMimeType());+ if (this.doctype == plasmaURL.DT_UNKNOWN) this.doctype = plasmaURL.docType(url);+ this.language = plasmaURL.language(url);// to be defined later:this.cacheArray = null;diff --git a/source/de/anomic/plasma/plasmaRankingRCIEvaluation.java b/source/de/anomic/plasma/plasmaRankingRCIEvaluation.javaindex 642c237ab..615e80d83 100644--- a/source/de/anomic/plasma/plasmaRankingRCIEvaluation.java+++ b/source/de/anomic/plasma/plasmaRankingRCIEvaluation.java@@ -53,7 +53,7 @@ import java.util.HashSet;import java.util.Iterator;import java.util.TreeSet;-import de.anomic.index.indexURL;+import de.anomic.plasma.plasmaURL;import de.anomic.kelondro.kelondroAttrSeq;import de.anomic.net.URL;import de.anomic.server.serverCodings;@@ -176,8 +176,8 @@ public class plasmaRankingRCIEvaluation {dom = (String) i.next();if (dom.startsWith("www.")) dom = dom.substring(4);try {- dommap.put(indexURL.urlHash(new URL("http://" + dom)).substring(6), dom);- dommap.put(indexURL.urlHash(new URL("http://www." + dom)).substring(6), "www." + dom);+ dommap.put(plasmaURL.urlHash(new URL("http://" + dom)).substring(6), dom);+ dommap.put(plasmaURL.urlHash(new URL("http://www." + dom)).substring(6), "www." + dom);} catch (MalformedURLException e) {}}return dommap;diff --git a/source/de/anomic/plasma/plasmaSearchPreOrder.java b/source/de/anomic/plasma/plasmaSearchPreOrder.javaindex 5b50aa0c9..883dcda04 100644--- a/source/de/anomic/plasma/plasmaSearchPreOrder.java+++ b/source/de/anomic/plasma/plasmaSearchPreOrder.java@@ -51,7 +51,7 @@ import java.util.TreeMap;import de.anomic.index.indexContainer;import de.anomic.index.indexRWIEntry;-import de.anomic.index.indexURL;+import de.anomic.plasma.plasmaURL;import de.anomic.kelondro.kelondroBinSearch;import de.anomic.server.serverCodings;import de.anomic.server.serverFileUtils;@@ -118,7 +118,7 @@ public final class plasmaSearchPreOrder {entry = (Map.Entry) i.next();iEntry = (indexRWIEntry) entry.getValue();hashpart = iEntry.urlHash().substring(6);- isWordRootURL = indexURL.isWordRootURL(iEntry.urlHash(), query.words(""));+ isWordRootURL = plasmaURL.isWordRootURL(iEntry.urlHash(), query.words(""));if ((!(isWordRootURL)) &&(((rootDomExt) && (rootDoms.contains(hashpart))) ||((doubleDom) && (doubleDoms.contains(hashpart))))) {diff --git a/source/de/anomic/plasma/plasmaSearchQuery.java b/source/de/anomic/plasma/plasmaSearchQuery.javaindex 03a7230cc..afe3a02bf 100644--- a/source/de/anomic/plasma/plasmaSearchQuery.java+++ b/source/de/anomic/plasma/plasmaSearchQuery.java@@ -48,7 +48,6 @@ import java.util.Set;import java.util.TreeSet;import de.anomic.htmlFilter.htmlFilterAbstractScraper;-import de.anomic.index.indexEntryAttribute;import de.anomic.kelondro.kelondroNaturalOrder;import de.anomic.server.serverCharBuffer;import de.anomic.yacy.yacySeedDB;@@ -102,20 +101,20 @@ public final class plasmaSearchQuery {public static Set words2hashSet(String[] words) {TreeSet hashes = new TreeSet();- for (int i = 0; i < words.length; i++) hashes.add(indexEntryAttribute.word2hash(words[i]));+ for (int i = 0; i < words.length; i++) hashes.add(plasmaURL.word2hash(words[i]));return hashes;}public static String words2hashString(String[] words) {StringBuffer sb = new StringBuffer();- for (int i = 0; i < words.length; i++) sb.append(indexEntryAttribute.word2hash(words[i]));+ for (int i = 0; i < words.length; i++) sb.append(plasmaURL.word2hash(words[i]));return new String(sb);}public static Set words2hashes(Set words) {Iterator i = words.iterator();TreeSet hashes = new TreeSet();- while (i.hasNext()) hashes.add(indexEntryAttribute.word2hash((String) i.next()));+ while (i.hasNext()) hashes.add(plasmaURL.word2hash((String) i.next()));return hashes;}diff --git a/source/de/anomic/plasma/plasmaSearchRankingProfile.java b/source/de/anomic/plasma/plasmaSearchRankingProfile.javaindex 2ad91fc4f..7dd8ce2e2 100644--- a/source/de/anomic/plasma/plasmaSearchRankingProfile.java+++ b/source/de/anomic/plasma/plasmaSearchRankingProfile.java@@ -47,7 +47,7 @@ import java.util.Map;import java.util.Set;import de.anomic.index.indexRWIEntry;-import de.anomic.index.indexURL;+import de.anomic.plasma.plasmaURL;import de.anomic.index.indexURLEntry;public class plasmaSearchRankingProfile {@@ -174,9 +174,9 @@ public class plasmaSearchRankingProfile {ranking += (normalizedEntry.posintext() == 0) ? 0 : (256 - normalizedEntry.posintext()) << ((Integer) coeff.get(POSINTEXT)).intValue();ranking += (normalizedEntry.worddistance() == 0) ? 0 : (256 - normalizedEntry.worddistance()) << ((Integer) coeff.get(WORDDISTANCE)).intValue();ranking += (normalizedEntry.hitcount() == 0) ? 0 : normalizedEntry.hitcount() << ((Integer) coeff.get(HITCOUNT)).intValue();- ranking += (256 - indexURL.domLengthNormalized(normalizedEntry.urlHash())) << ((Integer) coeff.get(DOMLENGTH)).intValue();- ranking += (indexURL.probablyRootURL(normalizedEntry.urlHash())) ? 16 << ((Integer) coeff.get(URLLENGTH)).intValue() : 0;- ranking += (indexURL.probablyWordURL(normalizedEntry.urlHash(), searchedWord) != null) ? 256 << ((Integer) coeff.get(QUERYINURL)).intValue() : 0;+ ranking += (256 - plasmaURL.domLengthNormalized(normalizedEntry.urlHash())) << ((Integer) coeff.get(DOMLENGTH)).intValue();+ ranking += (plasmaURL.probablyRootURL(normalizedEntry.urlHash())) ? 16 << ((Integer) coeff.get(URLLENGTH)).intValue() : 0;+ ranking += (plasmaURL.probablyWordURL(normalizedEntry.urlHash(), searchedWord) != null) ? 256 << ((Integer) coeff.get(QUERYINURL)).intValue() : 0;/*if (indexURL.probablyWordURL(normalizedEntry.urlHash(), searchedWord))System.out.println("DEBUG - hash " + normalizedEntry.urlHash() + " contains word " + searchedWord + ", weighted " + ((Integer) coeff.get(QUERYINURL)).intValue() + ", ranking = " + ranking);diff --git a/source/de/anomic/plasma/plasmaSearchResult.java b/source/de/anomic/plasma/plasmaSearchResult.javaindex 8e5265fe0..2dd75d03a 100644--- a/source/de/anomic/plasma/plasmaSearchResult.java+++ b/source/de/anomic/plasma/plasmaSearchResult.java@@ -52,8 +52,7 @@ import java.util.Set;import java.util.TreeMap;import de.anomic.htmlFilter.htmlFilterContentScraper;-import de.anomic.index.indexEntryAttribute;-import de.anomic.index.indexURL;+import de.anomic.plasma.plasmaURL;import de.anomic.index.indexURLEntry;import de.anomic.kelondro.kelondroMScoreCluster;import de.anomic.net.URL;@@ -231,7 +230,7 @@ public final class plasmaSearchResult {word = words[i].toLowerCase();if ((word.length() > 2) &&("http_html_php_ftp_www_com_org_net_gov_edu_index_home_page_for_usage_the_and_".indexOf(word) < 0) &&- (!(query.queryHashes.contains(indexEntryAttribute.word2hash(word)))))+ (!(query.queryHashes.contains(plasmaURL.word2hash(word)))))ref.incScore(word);}}@@ -262,14 +261,14 @@ public final class plasmaSearchResult {String[] paths1 = new String[urls.length]; for (int i = 0; i < urls.length; i++) {fill = ""; for (int j = 0; j < 35 - urls[i].toString().length(); j++) fill +=" ";paths1[i] = urlPath(urls[i]);- hash = indexURL.urlHash(urls[i]);- System.out.println("paths1[" + urls[i] + fill +"] = " + hash + ", typeID=" + indexURL.flagTypeID(hash) + ", tldID=" + indexURL.flagTLDID(hash) + ", lengthID=" + indexURL.flagLengthID(hash) + " / " + paths1[i]);+ hash = plasmaURL.urlHash(urls[i]);+ System.out.println("paths1[" + urls[i] + fill +"] = " + hash + ", typeID=" + plasmaURL.flagTypeID(hash) + ", tldID=" + plasmaURL.flagTLDID(hash) + ", lengthID=" + plasmaURL.flagLengthID(hash) + " / " + paths1[i]);}String[] paths2 = new String[urls.length]; for (int i = 0; i < urls.length; i++) {fill = ""; for (int j = 0; j < 35 - urls[i].toString().length(); j++) fill +=" ";paths2[i] = shortenPath(paths1[i]);- hash = indexURL.urlHash(urls[i]);- System.out.println("paths2[" + urls[i] + fill + "] = " + hash + ", typeID=" + indexURL.flagTypeID(hash) + ", tldID=" + indexURL.flagTLDID(hash) + ", lengthID=" + indexURL.flagLengthID(hash) + " / " + paths2[i]);+ hash = plasmaURL.urlHash(urls[i]);+ System.out.println("paths2[" + urls[i] + fill + "] = " + hash + ", typeID=" + plasmaURL.flagTypeID(hash) + ", tldID=" + plasmaURL.flagTLDID(hash) + ", lengthID=" + plasmaURL.flagLengthID(hash) + " / " + paths2[i]);}} catch (MalformedURLException e) {e.printStackTrace();diff --git a/source/de/anomic/plasma/plasmaSnippetCache.java b/source/de/anomic/plasma/plasmaSnippetCache.javaindex 76e798362..ef7a6a36a 100644--- a/source/de/anomic/plasma/plasmaSnippetCache.java+++ b/source/de/anomic/plasma/plasmaSnippetCache.java@@ -56,8 +56,7 @@ import java.util.Set;import de.anomic.http.httpHeader;import de.anomic.http.httpc;-import de.anomic.index.indexEntryAttribute;-import de.anomic.index.indexURL;+import de.anomic.plasma.plasmaURL;import de.anomic.index.indexURLEntry;import de.anomic.kelondro.kelondroMScoreCluster;import de.anomic.net.URL;@@ -160,7 +159,7 @@ public class plasmaSnippetCache {}//end contrib [MN]- if (indexEntryAttribute.word2hash(w[j]).equals(h)) w[j] = "<b>" + w[j] + "</b>";+ if (plasmaURL.word2hash(w[j]).equals(h)) w[j] = "<b>" + w[j] + "</b>";w[j] = prefix + w[j] + postfix;}}@@ -178,7 +177,7 @@ public class plasmaSnippetCache {public boolean existsInCache(URL url, Set queryhashes) {String hashes = yacySearch.set2string(queryhashes);- return retrieveFromCache(hashes, indexURL.urlHash(url)) != null;+ return retrieveFromCache(hashes, plasmaURL.urlHash(url)) != null;}public Snippet retrieveSnippet(URL url, Set queryhashes, boolean fetchOnline, int snippetMaxLength, int timeout) {@@ -187,7 +186,7 @@ public class plasmaSnippetCache {//System.out.println("found no queryhashes for URL retrieve " + url);return new Snippet(null, ERROR_NO_HASH_GIVEN, "no query hashes given");}- String urlhash = indexURL.urlHash(url);+ String urlhash = plasmaURL.urlHash(url);// try to get snippet from snippetCacheint source = SOURCE_CACHE;@@ -481,7 +480,7 @@ public class plasmaSnippetCache {String word;while (words.hasMoreElements()) {word = (String) words.nextElement();- map.put(indexEntryAttribute.word2hash(word), new Integer(pos));+ map.put(plasmaURL.word2hash(word), new Integer(pos));pos += word.length() + 1;}return map;diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.javaindex 07746041b..cafeeccf1 100644--- a/source/de/anomic/plasma/plasmaSwitchboard.java+++ b/source/de/anomic/plasma/plasmaSwitchboard.java@@ -133,8 +133,7 @@ import de.anomic.http.httpRemoteProxyConfig;import de.anomic.http.httpc;import de.anomic.index.indexContainer;import de.anomic.index.indexRWIEntry;-import de.anomic.index.indexEntryAttribute;-import de.anomic.index.indexURL;+import de.anomic.plasma.plasmaURL;import de.anomic.index.indexRWIEntryOld;import de.anomic.index.indexURLEntry;import de.anomic.kelondro.kelondroBase64Order;@@ -924,7 +923,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser// enqueue for further crawlingenQueue(this.sbQueue.newEntry(entry.url(),- indexURL.urlHash(entry.referrerURL()),+ plasmaURL.urlHash(entry.referrerURL()),entry.ifModifiedSince(),entry.requestWithCookie(),entry.initiator(),@@ -1466,8 +1465,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser// 6) local fetching for global crawling (other known or unknwon initiator)int processCase = PROCESSCASE_0_UNKNOWN;yacySeed initiatorPeer = null;- String initiatorPeerHash = (entry.proxy()) ? indexURL.dummyHash : entry.initiator();- if (initiatorPeerHash.equals(indexURL.dummyHash)) {+ String initiatorPeerHash = (entry.proxy()) ? plasmaURL.dummyHash : entry.initiator();+ if (initiatorPeerHash.equals(plasmaURL.dummyHash)) {// proxy-loadprocessCase = PROCESSCASE_4_PROXY_LOAD;} else if (initiatorPeerHash.equals(yacyCore.seedDB.mySeed.hash)) {@@ -1546,8 +1545,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser* ========================================================================= */String docDescription = document.getMainLongTitle();URL referrerURL = entry.referrerURL();- String referrerUrlHash = indexURL.urlHash(referrerURL);- if (referrerUrlHash == null) referrerUrlHash = indexURL.dummyHash;+ String referrerUrlHash = plasmaURL.urlHash(referrerURL);+ if (referrerUrlHash == null) referrerUrlHash = plasmaURL.dummyHash;String noIndexReason = plasmaCrawlEURL.DENIED_UNSPECIFIED_INDEXING_ERROR;if (processCase == PROCESSCASE_4_PROXY_LOAD) {@@ -1587,9 +1586,9 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements sernew byte[0], // md5(int) entry.size(), // sizecondenser.RESULT_NUMB_WORDS, // word count- indexEntryAttribute.docType(document.getMimeType()), // doctype+ plasmaURL.docType(document.getMimeType()), // doctypenew bitfield(4), // flags- indexEntryAttribute.language(entry.url()), // language+ plasmaURL.language(entry.url()), // language0,0,0,0,0,0);/* ========================================================================@@ -1644,8 +1643,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser(int) entry.size(), // document sizedocument, // document contentcondenser, // document condenser- indexEntryAttribute.language(entry.url()), // document language- indexEntryAttribute.docType(document.getMimeType()), // document type+ plasmaURL.language(entry.url()), // document language+ plasmaURL.docType(document.getMimeType()), // document typeioLinks[0].intValue(), // outlinkSameioLinks[1].intValue() // outlinkOthers);@@ -1658,8 +1657,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements serArrayList tmpContainers = new ArrayList(condenser.RESULT_SIMI_WORDS);- String language = indexEntryAttribute.language(entry.url());- char doctype = indexEntryAttribute.docType(document.getMimeType());+ String language = plasmaURL.language(entry.url());+ char doctype = plasmaURL.docType(document.getMimeType());indexURLEntry.Components comp = newEntry.comp();int urlLength = comp.url().toNormalform().length();int urlComps = htmlFilterContentScraper.urlComps(comp.url().toNormalform()).length;@@ -1672,7 +1671,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements serwentry = (Map.Entry) i.next();String word = (String) wentry.getKey();wordStat = (plasmaCondenser.wordStatProp) wentry.getValue();- String wordHash = indexEntryAttribute.word2hash(word);+ String wordHash = plasmaURL.word2hash(word);indexRWIEntry wordIdxEntry = new indexRWIEntryOld(urlHash,urlLength, urlComps,@@ -1724,8 +1723,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser(int) entry.size(),document,condenser,- indexEntryAttribute.language(entry.url()),- indexEntryAttribute.docType(document.getMimeType()),+ plasmaURL.language(entry.url()),+ plasmaURL.docType(document.getMimeType()),ioLinks[0].intValue(),ioLinks[1].intValue());@@ -1835,7 +1834,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements serint GCount = 0;int LCount = 0;while (it.hasNext()) {- nexturlhash = indexURL.urlHash((String) ((Map.Entry) it.next()).getKey());+ nexturlhash = plasmaURL.urlHash((String) ((Map.Entry) it.next()).getKey());if (nexturlhash != null) {if (nexturlhash.substring(6).equals(lhp)) {cpl.append(nexturlhash.substring(0, 6));@@ -1911,7 +1910,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser// convert the referrer hash into the corresponding URLURL refererURL = null;String refererHash = urlEntry.referrerHash();- if ((refererHash != null) && (!refererHash.equals(indexURL.dummyHash))) try {+ if ((refererHash != null) && (!refererHash.equals(plasmaURL.dummyHash))) try {refererURL = this.urlPool.getURL(refererHash);} catch (IOException e) {refererURL = null;@@ -1941,7 +1940,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements serlog.logFine("ERROR: plasmaSwitchboard.processRemoteCrawlTrigger - url is null. name=" + urlEntry.name());return true;}- String urlhash = indexURL.urlHash(urlEntry.url());+ String urlhash = plasmaURL.urlHash(urlEntry.url());// check remote crawlyacySeed remoteSeed = yacyCore.dhtAgent.getCrawlSeed(urlhash);@@ -2141,9 +2140,9 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements serprop.put("type_results_" + i + "_size", Long.toString(urlentry.size()));prop.put("type_results_" + i + "_words", URLEncoder.encode(query.queryWords.toString(),"UTF-8"));prop.put("type_results_" + i + "_former", formerSearch);- prop.put("type_results_" + i + "_rankingprops", urlentry.word().toPropertyForm(true) + ", domLengthEstimated=" + indexURL.domLengthEstimation(urlhash) +- ((indexURL.probablyRootURL(urlhash)) ? ", probablyRootURL" : "") +- (((wordURL = indexURL.probablyWordURL(urlhash, query.words(""))) != null) ? ", probablyWordURL=" + wordURL.toNormalform() : ""));+ prop.put("type_results_" + i + "_rankingprops", urlentry.word().toPropertyForm(true) + ", domLengthEstimated=" + plasmaURL.domLengthEstimation(urlhash) ++ ((plasmaURL.probablyRootURL(urlhash)) ? ", probablyRootURL" : "") ++ (((wordURL = plasmaURL.probablyWordURL(urlhash, query.words(""))) != null) ? ", probablyWordURL=" + wordURL.toNormalform() : ""));// adding snippet if availableif ((snippet != null) && (snippet.exists())) {prop.put("type_results_" + i + "_snippet", 1);@@ -2210,7 +2209,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser// method for index deletionpublic int removeAllUrlReferences(URL url, boolean fetchOnline) {- return removeAllUrlReferences(indexURL.urlHash(url), fetchOnline);+ return removeAllUrlReferences(plasmaURL.urlHash(url), fetchOnline);}public int removeAllUrlReferences(String urlhash, boolean fetchOnline) {@@ -2253,7 +2252,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser}public int removeReferences(URL url, Set words) {- return removeReferences(indexURL.urlHash(url), words);+ return removeReferences(plasmaURL.urlHash(url), words);}public int removeReferences(final String urlhash, final Set words) {@@ -2265,7 +2264,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements serwhile (iter.hasNext()) {word = (String) iter.next();// delete the URL reference in this word index- if (wordIndex.removeEntry(indexEntryAttribute.word2hash(word), urlhash, true)) count++;+ if (wordIndex.removeEntry(plasmaURL.word2hash(word), urlhash, true)) count++;}return count;}@@ -2280,7 +2279,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements serentry = (Map.Entry) wordStatPropIterator.next();word = (String) entry.getKey();// delete the URL reference in this word index- if (wordIndex.removeEntry(indexEntryAttribute.word2hash(word), urlhash, true)) count++;+ if (wordIndex.removeEntry(plasmaURL.word2hash(word), urlhash, true)) count++;}return count;}diff --git a/source/de/anomic/plasma/plasmaSwitchboardQueue.java b/source/de/anomic/plasma/plasmaSwitchboardQueue.javaindex 16fa24d26..cc9a139d3 100644--- a/source/de/anomic/plasma/plasmaSwitchboardQueue.java+++ b/source/de/anomic/plasma/plasmaSwitchboardQueue.java@@ -50,7 +50,7 @@ import java.net.MalformedURLException;import java.util.ArrayList;import java.util.Date;-import de.anomic.index.indexURL;+import de.anomic.plasma.plasmaURL;import de.anomic.index.indexURLEntry;import de.anomic.kelondro.kelondroBase64Order;import de.anomic.kelondro.kelondroException;@@ -105,12 +105,12 @@ public class plasmaSwitchboardQueue {public void push(Entry entry) throws IOException {sbQueueStack.push(sbQueueStack.row().newEntry(new byte[][]{entry.url.toString().getBytes(),- (entry.referrerHash == null) ? indexURL.dummyHash.getBytes() : entry.referrerHash.getBytes(),+ (entry.referrerHash == null) ? plasmaURL.dummyHash.getBytes() : entry.referrerHash.getBytes(),kelondroBase64Order.enhancedCoder.encodeLong((entry.ifModifiedSince == null) ? 0 : entry.ifModifiedSince.getTime(), 11).getBytes(),new byte[]{entry.flags},- (entry.initiator == null) ? indexURL.dummyHash.getBytes() : entry.initiator.getBytes(),+ (entry.initiator == null) ? plasmaURL.dummyHash.getBytes() : entry.initiator.getBytes(),kelondroBase64Order.enhancedCoder.encodeLong((long) entry.depth, rowdef.width(5)).getBytes(),- (entry.profileHandle == null) ? indexURL.dummyHash.getBytes() : entry.profileHandle.getBytes(),+ (entry.profileHandle == null) ? plasmaURL.dummyHash.getBytes() : entry.profileHandle.getBytes(),(entry.anchorName == null) ? "-".getBytes("UTF-8") : entry.anchorName.getBytes("UTF-8")}));}@@ -274,7 +274,7 @@ public class plasmaSwitchboardQueue {}public String urlHash() {- return indexURL.urlHash(url);+ return plasmaURL.urlHash(url);}public boolean requestedWithCookie() {@@ -286,7 +286,7 @@ public class plasmaSwitchboardQueue {}public boolean proxy() {- return (initiator == null) || (initiator.equals(indexURL.dummyHash));+ return (initiator == null) || (initiator.equals(plasmaURL.dummyHash));}public String initiator() {@@ -333,7 +333,7 @@ public class plasmaSwitchboardQueue {public URL referrerURL() {if (referrerURL == null) {- if ((referrerHash == null) || (referrerHash.equals(indexURL.dummyHash))) return null;+ if ((referrerHash == null) || (referrerHash.equals(plasmaURL.dummyHash))) return null;indexURLEntry entry = lurls.load(referrerHash, null);if (entry == null) referrerURL = null; else referrerURL = entry.comp().url();}diff --git a/source/de/anomic/plasma/plasmaURL.java b/source/de/anomic/plasma/plasmaURL.javanew file mode 100644index 000000000..c54d6ab45--- /dev/null+++ b/source/de/anomic/plasma/plasmaURL.java@@ -0,0 +1,752 @@+// indexURL.java+// (C) 2006 by Michael Peter Christen; [email protected], Frankfurt a. M., Germany+// first published 20.05.2006 on http://www.anomic.de+//+// This is a part of YaCy, a peer-to-peer based web search engine+//+// $LastChangedDate: 2006-04-02 22:40:07 +0200 (So, 02 Apr 2006) $+// $LastChangedRevision: 1986 $+// $LastChangedBy: orbiter $+//+// LICENSE+//+// This program is free software; you can redistribute it and/or modify+// it under the terms of the GNU General Public License as published by+// the Free Software Foundation; either version 2 of the License, or+// (at your option) any later version.+//+// This program is distributed in the hope that it will be useful,+// but WITHOUT ANY WARRANTY; without even the implied warranty of+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+// GNU General Public License for more details.+//+// You should have received a copy of the GNU General Public License+// along with this program; if not, write to the Free Software+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA++package de.anomic.plasma;++import java.net.MalformedURLException;+import java.text.SimpleDateFormat;+import java.util.HashMap;+import java.util.Iterator;+import java.util.Map;+import java.util.TreeMap;++import de.anomic.index.indexContainer;+import de.anomic.index.indexRWIEntry;+import de.anomic.kelondro.kelondroBase64Order;+import de.anomic.net.URL;+import de.anomic.server.serverByteBuffer;+import de.anomic.server.serverCodings;+import de.anomic.server.serverCore;+import de.anomic.yacy.yacySeedDB;++public class plasmaURL {++ // day formatter for entry export+ public static final SimpleDateFormat shortDayFormatter = new SimpleDateFormat("yyyyMMdd");++ private static final String[] TLD_NorthAmericaOceania={+ // primary english-speaking countries+ // english-speaking countries from central america are also included+ // includes also dutch and french colonies in the caribbean sea+ "EDU=US Educational",+ "GOV=US Government",+ "MIL=US Military",+ "NET=Network",+ "ORG=Non-Profit Organization",+ "AG=Antigua and Barbuda",+ "AI=Anguilla",+ "AU=Australia",+ "BB=Barbados",+ "BZ=Belize",+ "BM=Bermuda",+ "BS=Bahamas",+ "CA=Canada",+ "DM=Dominica",+ "GD=Grenada",+ "GP=Guadeloupe",+ "KY=Cayman Islands",+ "NZ=New Zealand (Aotearoa)",+ "PM=St. Pierre and Miquelon",+ "US=United States",+ "VC=Saint Vincent and the Grenadines",+ "VG=Virgin Islands (British)",+ "VI=Virgin Islands (U.S.)",+ "VU=Vanuatu",+ "WF=Wallis and Futuna Islands",+ "WS=Samoa"+ };+ private static final String[] TLD_MiddleSouthAmerica = {+ // primary spanish and portugese-speaking+ "AR=Argentina",+ "AW=Aruba",+ "BR=Brazil",+ "BO=Bolivia",+ "CL=Chile",+ "CO=Colombia",+ "CR=Costa Rica",+ "CU=Cuba",+ "DO=Dominican Republic",+ "EC=Ecuador",+ "GF=French Guiana",+ "FK=Falkland Islands (Malvinas)",+ "GY=Guyana",+ "HN=Honduras",+ "JM=Jamaica",+ "MX=Mexico",+ "NI=Nicaragua",+ "PA=Panama",+ "PE=Peru",+ "PY=Paraguay",+ "SR=Suriname",+ "SV=El Salvador",+ "UY=Uruguay",+ "VE=Venezuela"+ };+ private static final String[] TLD_EuropaRussia = {+ // includes also countries that are mainly french- dutch- speaking+ // and culturally close to europe+ "AD=Andorra",+ "AL=Albania",+ "AQ=Antarctica",+ "AT=Austria",+ "BA=Bosnia and Herzegovina",+ "BE=Belgium",+ "BG=Bulgaria",+ "CH=Switzerland",+ "CS=Czechoslovakia (former)",+ "CZ=Czech Republic",+ "CY=Cyprus",+ "DE=Germany",+ "DK=Denmark",+ "ES=Spain",+ "EE=Estonia",+ "FI=Finland",+ "FR=France",+ "FX=France, Metropolitan",+ "GB=Great Britain (UK)",+ "GI=Gibraltar",+ "GL=Greenland",+ "GR=Greece",+ "HR=Croatia (Hrvatska)",+ "HU=Hungary",+ "IE=Ireland",+ "IS=Iceland",+ "IT=Italy",+ "LI=Liechtenstein",+ "LT=Lithuania",+ "LU=Luxembourg",+ "LV=Latvia",+ "MD=Moldova",+ "MC=Monaco",+ "MK=Macedonia",+ "MN=Mongolia",+ "MT=Malta",+ "NATO=Nato field",+ "NL=Netherlands",+ "NO=Norway",+ "PL=Poland",+ "PT=Portugal",+ "RO=Romania",+ "RU=Russia",+ "SE=Sweden",+ "SI=Slovenia",+ "SK=Slovak Republic",+ "SU=USSR (former)",+ "UK=United Kingdom",+ "VA=Vatican City State (Holy See)",+ "YU=Yugoslavia"+ };+ private static final String[] TLD_MiddleEastWestAsia = {+ "AE=United Arab Emirates",+ "AF=Afghanistan",+ "AZ=Azerbaijan",+ "BH=Bahrain",+ "IL=Israel",+ "IQ=Iraq",+ "IR=Iran",+ "PK=Pakistan",+ "TR=Turkey",+ "YE=Yemen"+ };+ private static final String[] TLD_SouthEastAsia = {+ "BD=Bangladesh",+ "BT=Bhutan",+ "CN=China",+ "HK=Hong Kong",+ "ID=Indonesia",+ "IN=India",+ "NP=Nepal",+ "JP=Japan",+ "KH=Cambodia",+ "KP=Korea (North)",+ "KR=Korea (South)",+ "LK=Sri Lanka",+ "SG=Singapore",+ "VN=Viet Nam"+ };+ private static final String[] TLD_Africa = {+ "AO=Angola",+ "BF=Burkina Faso",+ "BI=Burundi",+ "BJ=Benin",+ "BW=Botswana",+ "CF=Central African Republic",+ "CG=Congo",+ "CI=Cote D'Ivoire (Ivory Coast)",+ "CM=Cameroon",+ "DZ=Algeria",+ "EG=Egypt",+ "EH=Western Sahara",+ "ER=Eritrea",+ "ET=Ethiopia",+ "GA=Gabon",+ "GH=Ghana",+ "GM=Gambia",+ "GN=Guinea",+ "KE=Kenya",+ "LR=Liberia",+ "LS=Lesotho",+ "LY=Libya",+ "MA=Morocco",+ "MG=Madagascar",+ "ML=Mali",+ "MR=Mauritania",+ "MU=Mauritius",+ "MW=Malawi",+ "MZ=Mozambique",+ "NA=Namibia",+ "NE=Niger",+ "NG=Nigeria",+ "RE=Reunion",+ "RW=Rwanda",+ "SH=St. Helena",+ "SL=Sierra Leone",+ "SN=Senegal",+ "SO=Somalia",+ "ST=Sao Tome and Principe",+ "SZ=Swaziland",+ "TG=Togo",+ "TN=Tunisia",+ "TZ=Tanzania",+ "UG=Uganda",+ "ZA=South Africa",+ "ZM=Zambia",+ "ZR=Zaire",+ "ZW=Zimbabwe",+ "YT=Mayotte"+ };+ private static final String[] TLD_Generic = {+ "COM=US Commercial",+ "AERO=",+ "BIZ=",+ "COOP=",+ "INFO=",+ "MUSEUM=",+ "NAME=",+ "PRO=",+ "ARPA=",+ "INT=International",+ "ARPA=Arpanet",+ "NT=Neutral Zone"+ };++ /*+ http://www.odci.gov/cia/publications/factbook/+ http://en.wikipedia.org/wiki/List_of_countries_by_continent+ "AM=Armenia",+ "AN=Netherlands Antilles",+ "AS=American Samoa",+ "BN=Brunei Darussalam",+ "BV=Bouvet Island",+ "BY=Belarus",+ "CC=Cocos (Keeling) Islands",+ "CK=Cook Islands",+ "CV=Cape Verde",+ "CX=Christmas Island",+ "DJ=Djibouti",+ "FJ=Fiji",+ "FM=Micronesia",+ "FO=Faroe Islands",+ "GE=Georgia",+ "GQ=Equatorial Guinea",+ "GS=S. Georgia and S. Sandwich Isls.",+ "GT=Guatemala",+ "GU=Guam",+ "GW=Guinea-Bissau",+ "HM=Heard and McDonald Islands",+ "HT=Haiti",+ "IO=British Indian Ocean Territory",+ "JO=Jordan",+ "KG=Kyrgyzstan",+ "KI=Kiribati",+ "KM=Comoros",+ "KN=Saint Kitts and Nevis",+ "KW=Kuwait",+ "KZ=Kazakhstan",+ "LA=Laos",+ "LB=Lebanon",+ "LC=Saint Lucia",+ "MH=Marshall Islands",+ "MM=Myanmar",+ "MO=Macau",+ "MP=Northern Mariana Islands",+ "MQ=Martinique",+ "MS=Montserrat",+ "MV=Maldives",+ "MY=Malaysia",+ "NC=New Caledonia",+ "NF=Norfolk Island",+ "NR=Nauru",+ "NU=Niue",+ "OM=Oman",+ "PF=French Polynesia",+ "PG=Papua New Guinea",+ "PH=Philippines",+ "PN=Pitcairn",+ "PR=Puerto Rico",+ "PW=Palau",+ "QA=Qatar",+ "SA=Saudi Arabia",+ "Sb=Solomon Islands",+ "SC=Seychelles",+ "SD=Sudan",+ "SJ=Svalbard and Jan Mayen Islands",+ "SM=San Marino",+ "SY=Syria",+ "TC=Turks and Caicos Islands",+ "TD=Chad",+ "TF=French Southern Territories",+ "TH=Thailand",+ "TJ=Tajikistan",+ "TK=Tokelau",+ "TM=Turkmenistan",+ "TO=Tonga",+ "TP=East Timor",+ "TT=Trinidad and Tobago",+ "TV=Tuvalu",+ "TW=Taiwan",+ "UA=Ukraine",+ "UM=US Minor Outlying Islands",+ "UZ=Uzbekistan",+ */++ /*+ * TLDs: aero, biz, com, coop, edu, gov, info, int, mil, museum, name, net,+ * org, pro, arpa AC, AD, AE, AERO, AF, AG, AI, AL, AM, AN, AO, AQ, AR,+ * ARPA, AS, AT, AU, AW, AZ, BA, BB, BD, BE, BF, BG, BH, BI, BIZ, BJ, BM,+ * BN, BO, BR, BS, BT, BV, BW, BY, BZ, CA, CC, CD, CF, CG, CH, CI, CK, CL,+ * CM, CN, CO, COM, COOP, CR, CU, CV, CX, CY, CZ, DE, DJ, DK, DM, DO, DZ,+ * EC, EDU, EE, EG, ER, ES, ET, EU, FI, FJ, FK, FM, FO, FR, GA, GB, GD, GE,+ * GF, GG, GH, GI, GL, GM, GN, GOV, GP, GQ, GR, GS, GT, GU, GW, GY, HK, HM,+ * HN, HR, HT, HU, ID, IE, IL, IM, IN, INFO, INT, IO, IQ, IR, IS, IT, JE,+ * JM, JO, JOBS, JP, KE, KG, KH, KI, KM, KN, KR, KW, KY, KZ, LA, LB, LC, LI,+ * LK, LR, LS, LT, LU, LV, LY, MA, MC, MD, MG, MH, MIL, MK, ML, MM, MN, MO,+ * MOBI, MP, MQ, MR, MS, MT, MU, MUSEUM, MV, MW, MX, MY, MZ, NA, NAME, NC,+ * NE, NET, NF, NG, NI, NL, NO, NP, NR, NU, NZ, OM, ORG, PA, PE, PF, PG, PH,+ * PK, PL, PM, PN, PR, PRO, PS, PT, PW, PY, QA, RE, RO, RU, RW, SA, SB, SC,+ * SD, SE, SG, SH, SI, SJ, SK, SL, SM, SN, SO, SR, ST, SU, SV, SY, SZ, TC,+ * TD, TF, TG, TH, TJ, TK, TL, TM, TN, TO, TP, TR, TRAVEL, TT, TV, TW, TZ,+ * UA, UG, UK, UM, US, UY, UZ, VA, VC, VE, VG, VI, VN, VU, WF, WS, YE, YT,+ * YU, ZA, ZM, ZW+ */++ public static String dummyHash;++ private static HashMap TLDID = new HashMap();+ private static HashMap TLDName = new HashMap();++ private static void insertTLDProps(String[] TLDList, int id) {+ int p;+ String tld, name;+ Integer ID = new Integer(id);+ for (int i = 0; i < TLDList.length; i++) {+ p = TLDList[i].indexOf('=');+ if (p > 0) {+ tld = TLDList[i].substring(0, p).toLowerCase();+ name = TLDList[i].substring(p + 1);+ TLDID.put(tld, ID);+ TLDName.put(tld, name);+ }+ }+ }++ static {+ // create a dummy hash+ dummyHash = "";+ for (int i = 0; i < yacySeedDB.commonHashLength; i++) dummyHash += "-";++ // assign TLD-ids and names+ insertTLDProps(TLD_EuropaRussia, 0);+ insertTLDProps(TLD_MiddleSouthAmerica, 1);+ insertTLDProps(TLD_SouthEastAsia, 2);+ insertTLDProps(TLD_MiddleEastWestAsia, 3);+ insertTLDProps(TLD_NorthAmericaOceania, 4);+ insertTLDProps(TLD_Africa, 5);+ insertTLDProps(TLD_Generic, 6);+ // the id=7 is used to flag local addresses+ }++ public static final int flagTypeID(String hash) {+ return (kelondroBase64Order.enhancedCoder.decodeByte(hash.charAt(11)) & 32) >> 5;+ }++ public static final int flagTLDID(String hash) {+ return (kelondroBase64Order.enhancedCoder.decodeByte(hash.charAt(11)) & 28) >> 2;+ }++ public static final int flagLengthID(String hash) {+ return (kelondroBase64Order.enhancedCoder.decodeByte(hash.charAt(11)) & 3);+ }++ public static final String urlHash(String url) {+ if ((url == null) || (url.length() == 0))+ return null;+ try {+ return urlHash(new URL(url));+ } catch (MalformedURLException e) {+ return null;+ }+ }++ public static final String urlHash(URL url) {+ if (url == null) return null;+ String host = url.getHost().toLowerCase();+ int p = host.lastIndexOf('.');+ String tld = "", dom = tld;+ if (p > 0) {+ tld = host.substring(p + 1);+ dom = host.substring(0, p);+ }+ Integer ID = (serverCore.isNotLocal(tld)) ? (Integer) TLDID.get(tld)+ : null; // identify local addresses+ int id = (ID == null) ? 7 : ID.intValue(); // local addresses are flagged with id=7+ boolean isHTTP = url.getProtocol().equals("http");+ p = dom.lastIndexOf('.'); // locate subdomain+ String subdom = "";+ if (p > 0) {+ subdom = dom.substring(0, p);+ dom = dom.substring(p + 1);+ }+ int port = url.getPort();+ if (port <= 0) {+ if (isHTTP) {+ port = 80;+ } else if (url.getProtocol().equalsIgnoreCase("https")) {+ port = 443;+ } else {+ port = 21;+ }+ }+ String path = url.getPath();+ if (path.startsWith("/"))+ path = path.substring(1);+ if (path.endsWith("/"))+ path = path.substring(0, path.length() - 1);+ p = path.indexOf('/');+ String rootpath = "";+ if (p > 0) {+ rootpath = path.substring(0, p);+ }++ // we collected enough information to compute the fragments that are+ // basis for hashes+ int l = dom.length();+ int domlengthKey = (l <= 8) ? 0 : (l <= 12) ? 1 : (l <= 16) ? 2 : 3;+ byte flagbyte = (byte) (((isHTTP) ? 0 : 32) | (id << 2) | domlengthKey);++ // combine the attributes+ StringBuffer hash = new StringBuffer(12);+ // form the 'local' part of the hash+ hash.append(kelondroBase64Order.enhancedCoder.encode(serverCodings.encodeMD5Raw(url.toNormalform())).substring(0, 5)); // 5 chars+ hash.append(subdomPortPath(subdom, port, rootpath)); // 1 char+ // form the 'global' part of the hash+ hash.append(protocolHostPort(url.getProtocol(), host, port)); // 5 chars+ hash.append(kelondroBase64Order.enhancedCoder.encodeByte(flagbyte)); // 1 char++ // return result hash+ return new String(hash);+ }++ private static char subdomPortPath(String subdom, int port, String rootpath) {+ return kelondroBase64Order.enhancedCoder.encode(serverCodings.encodeMD5Raw(subdom + ":" + port + ":" + rootpath)).charAt(0);+ }++ private static final char rootURLFlag = subdomPortPath("www", 80, "");++ public static final boolean probablyRootURL(String urlHash) {+ return (urlHash.charAt(5) == rootURLFlag);+ }++ private static String protocolHostPort(String protocol, String host, int port) {+ return kelondroBase64Order.enhancedCoder.encode(serverCodings.encodeMD5Raw(protocol + ":" + host + ":" + port)).substring(0, 5);+ }++ private static String[] testTLDs = new String[] { "com", "net", "org", "uk", "fr", "de", "es", "it" };++ public static final URL probablyWordURL(String urlHash, String word) {+ if ((word == null) || (word.length() == 0))return null;+ String pattern = urlHash.substring(6, 11);+ for (int i = 0; i < testTLDs.length; i++) {+ if (pattern.equals(protocolHostPort("http", "www." + word.toLowerCase() + "." + testTLDs[i], 80)))+ try {+ return new URL("http://www." + word.toLowerCase() + "." + testTLDs[i]);+ } catch (MalformedURLException e) {+ return null;+ }+ }+ return null;+ }++ public static final boolean isWordRootURL(String givenURLHash, String word) {+ if (!(probablyRootURL(givenURLHash))) return false;+ URL wordURL = probablyWordURL(givenURLHash, word);+ if (wordURL == null) return false;+ return urlHash(wordURL).equals(givenURLHash);+ }++ public static final int domLengthEstimation(String urlHash) {+ // generates an estimation of the original domain length+ assert (urlHash != null);+ assert (urlHash.length() == 12) : "urlhash = " + urlHash;+ int flagbyte = kelondroBase64Order.enhancedCoder.decodeByte(urlHash.charAt(11));+ int domLengthKey = flagbyte & 3;+ switch (domLengthKey) {+ case 0:+ return 4;+ case 1:+ return 10;+ case 2:+ return 14;+ case 3:+ return 20;+ }+ return 20;+ }++ public static int domLengthNormalized(String urlHash) {+ return 255 * domLengthEstimation(urlHash) / 30;+ }++ public static final int domDomain(String urlHash) {+ // returns the ID of the domain of the domain+ assert (urlHash != null);+ assert (urlHash.length() == 12) : "urlhash = " + urlHash;+ int flagbyte = kelondroBase64Order.enhancedCoder.decodeByte(urlHash.charAt(11));+ return (flagbyte & 12) >> 2;+ }++ public static boolean isGlobalDomain(String urlhash) {+ return domDomain(urlhash) != 7;+ }++ public static final String oldurlHash(URL url) {+ if (url == null) return null;+ String hash = kelondroBase64Order.enhancedCoder.encode(serverCodings.encodeMD5Raw(url.toNormalform())).substring(0, yacySeedDB.commonHashLength);+ return hash;+ }++ public static final String oldurlHash(String url) throws MalformedURLException {+ if ((url == null) || (url.length() < 10)) return null;+ String hash = kelondroBase64Order.enhancedCoder.encode(serverCodings.encodeMD5Raw(new URL(url).toNormalform())).substring(0, yacySeedDB.commonHashLength);+ return hash;+ }++ public static final serverByteBuffer compressIndex(indexContainer inputContainer, indexContainer excludeContainer, long maxtime) {+ // collect references according to domains+ long timeout = (maxtime < 0) ? Long.MAX_VALUE : System.currentTimeMillis() + maxtime;+ TreeMap doms = new TreeMap();+ synchronized (inputContainer) {+ Iterator i = inputContainer.entries();+ indexRWIEntry iEntry;+ String dom, paths;+ while (i.hasNext()) {+ iEntry = (indexRWIEntry) i.next();+ if ((excludeContainer != null) && (excludeContainer.get(iEntry.urlHash()) != null)) continue; // do not include urls that are in excludeContainer+ dom = iEntry.urlHash().substring(6);+ if ((paths = (String) doms.get(dom)) == null) {+ doms.put(dom, iEntry.urlHash().substring(0, 6));+ } else {+ doms.put(dom, paths + iEntry.urlHash().substring(0, 6));+ }+ if (System.currentTimeMillis() > timeout)+ break;+ }+ }+ // construct a result string+ serverByteBuffer bb = new serverByteBuffer(inputContainer.size() * 6);+ bb.append('{');+ Iterator i = doms.entrySet().iterator();+ Map.Entry entry;+ while (i.hasNext()) {+ entry = (Map.Entry) i.next();+ bb.append((String) entry.getKey());+ bb.append(':');+ bb.append((String) entry.getValue());+ if (System.currentTimeMillis() > timeout)+ break;+ if (i.hasNext())+ bb.append(',');+ }+ bb.append('}');+ bb.trim();+ return bb;+ }++ public static final void decompressIndex(TreeMap target, serverByteBuffer ci, String peerhash) {+ // target is a mapping from url-hashes to a string of peer-hashes+ if ((ci.byteAt(0) == '{') && (ci.byteAt(ci.length() - 1) == '}')) {+ //System.out.println("DEBUG-DECOMPRESS: input is " + ci.toString());+ ci = ci.trim(1, ci.length() - 1);+ String dom, url, peers;+ while ((ci.length() >= 13) && (ci.byteAt(6) == ':')) {+ dom = ci.toString(0, 6);+ ci.trim(7);+ while ((ci.length() > 0) && (ci.byteAt(0) != ',')) {+ url = ci.toString(0, 6) + dom;+ ci.trim(6);+ peers = (String) target.get(url);+ if (peers == null) {+ target.put(url, peerhash);+ } else {+ target.put(url, peers + peerhash);+ }+ //System.out.println("DEBUG-DECOMPRESS: " + url + ":" + target.get(url));+ }+ if (ci.byteAt(0) == ',') ci.trim(1);+ }+ }+ }+++ // doctypes:+ public static final char DT_PDFPS = 'p';+ public static final char DT_TEXT = 't';+ public static final char DT_HTML = 'h';+ public static final char DT_DOC = 'd';+ public static final char DT_IMAGE = 'i';+ public static final char DT_MOVIE = 'm';+ public static final char DT_FLASH = 'f';+ public static final char DT_SHARE = 's';+ public static final char DT_AUDIO = 'a';+ public static final char DT_BINARY = 'b';+ public static final char DT_UNKNOWN = 'u';++ // appearance locations: (used for flags)+ public static final int AP_TITLE = 0; // title tag from html header+ public static final int AP_H1 = 1; // headline - top level+ public static final int AP_H2 = 2; // headline, second level+ public static final int AP_H3 = 3; // headline, 3rd level+ public static final int AP_H4 = 4; // headline, 4th level+ public static final int AP_H5 = 5; // headline, 5th level+ public static final int AP_H6 = 6; // headline, 6th level+ public static final int AP_TEXT = 7; // word appears in text (used to check validation of other appearances against spam)+ public static final int AP_DOM = 8; // word inside an url: in Domain+ public static final int AP_PATH = 9; // word inside an url: in path+ public static final int AP_IMG = 10; // tag inside image references+ public static final int AP_ANCHOR = 11; // anchor description+ public static final int AP_ENV = 12; // word appears in environment (similar to anchor appearance)+ public static final int AP_BOLD = 13; // may be interpreted as emphasized+ public static final int AP_ITALICS = 14; // may be interpreted as emphasized+ public static final int AP_WEAK = 15; // for Text that is small or bareley visible+ public static final int AP_INVISIBLE = 16; // good for spam detection+ public static final int AP_TAG = 17; // for tagged indexeing (i.e. using mp3 tags)+ public static final int AP_AUTHOR = 18; // word appears in author name+ public static final int AP_OPUS = 19; // word appears in name of opus, which may be an album name (in mp3 tags)+ public static final int AP_TRACK = 20; // word appears in track name (i.e. in mp3 tags)++ // URL attributes+ public static final int UA_LOCAL = 0; // URL was crawled locally+ public static final int UA_TILDE = 1; // tilde appears in URL+ public static final int UA_REDIRECT = 2; // The URL is a redirection++ // local flag attributes+ public static final char LT_LOCAL = 'L';+ public static final char LT_GLOBAL = 'G';++ // create a word hash+ public static String word2hash(String word) {+ return kelondroBase64Order.enhancedCoder.encode(serverCodings.encodeMD5Raw(word.toLowerCase())).substring(0, yacySeedDB.commonHashLength);+ }++ // doctype calculation+ public static char docType(URL url) {+ String path = url.getPath();+ // serverLog.logFinest("PLASMA", "docType URL=" + path);+ char doctype = DT_UNKNOWN;+ if (path.endsWith(".gif")) { doctype = DT_IMAGE; }+ else if (path.endsWith(".jpg")) { doctype = DT_IMAGE; }+ else if (path.endsWith(".jpeg")) { doctype = DT_IMAGE; }+ else if (path.endsWith(".png")) { doctype = DT_IMAGE; }+ else if (path.endsWith(".html")) { doctype = DT_HTML; }+ else if (path.endsWith(".txt")) { doctype = DT_TEXT; }+ else if (path.endsWith(".doc")) { doctype = DT_DOC; }+ else if (path.endsWith(".rtf")) { doctype = DT_DOC; }+ else if (path.endsWith(".pdf")) { doctype = DT_PDFPS; }+ else if (path.endsWith(".ps")) { doctype = DT_PDFPS; }+ else if (path.endsWith(".avi")) { doctype = DT_MOVIE; }+ else if (path.endsWith(".mov")) { doctype = DT_MOVIE; }+ else if (path.endsWith(".qt")) { doctype = DT_MOVIE; }+ else if (path.endsWith(".mpg")) { doctype = DT_MOVIE; }+ else if (path.endsWith(".md5")) { doctype = DT_SHARE; }+ else if (path.endsWith(".mpeg")) { doctype = DT_MOVIE; }+ else if (path.endsWith(".asf")) { doctype = DT_FLASH; }+ return doctype;+ }++ public static char docType(String mime) {+ // serverLog.logFinest("PLASMA", "docType mime=" + mime);+ char doctype = DT_UNKNOWN;+ if (mime == null) doctype = DT_UNKNOWN;+ else if (mime.startsWith("image/")) doctype = DT_IMAGE;+ else if (mime.endsWith("/gif")) doctype = DT_IMAGE;+ else if (mime.endsWith("/jpeg")) doctype = DT_IMAGE;+ else if (mime.endsWith("/png")) doctype = DT_IMAGE;+ else if (mime.endsWith("/html")) doctype = DT_HTML;+ else if (mime.endsWith("/rtf")) doctype = DT_DOC;+ else if (mime.endsWith("/pdf")) doctype = DT_PDFPS;+ else if (mime.endsWith("/octet-stream")) doctype = DT_BINARY;+ else if (mime.endsWith("/x-shockwave-flash")) doctype = DT_FLASH;+ else if (mime.endsWith("/msword")) doctype = DT_DOC;+ else if (mime.endsWith("/mspowerpoint")) doctype = DT_DOC;+ else if (mime.endsWith("/postscript")) doctype = DT_PDFPS;+ else if (mime.startsWith("text/")) doctype = DT_TEXT;+ else if (mime.startsWith("image/")) doctype = DT_IMAGE;+ else if (mime.startsWith("audio/")) doctype = DT_AUDIO;+ else if (mime.startsWith("video/")) doctype = DT_MOVIE;+ //bz2 = application/x-bzip2+ //dvi = application/x-dvi+ //gz = application/gzip+ //hqx = application/mac-binhex40+ //lha = application/x-lzh+ //lzh = application/x-lzh+ //pac = application/x-ns-proxy-autoconfig+ //php = application/x-httpd-php+ //phtml = application/x-httpd-php+ //rss = application/xml+ //tar = application/tar+ //tex = application/x-tex+ //tgz = application/tar+ //torrent = application/x-bittorrent+ //xhtml = application/xhtml+xml+ //xla = application/msexcel+ //xls = application/msexcel+ //xsl = application/xml+ //xml = application/xml+ //Z = application/x-compress+ //zip = application/zip+ return doctype;+ }++ // language calculation+ public static String language(URL url) {+ String language = "uk";+ String host = url.getHost();+ int pos = host.lastIndexOf(".");+ if ((pos > 0) && (host.length() - pos == 3)) language = host.substring(pos + 1).toLowerCase();+ return language;+ }++}diff --git a/source/de/anomic/plasma/plasmaURLPool.java b/source/de/anomic/plasma/plasmaURLPool.javaindex 08ecb0e65..fcaad58c1 100644--- a/source/de/anomic/plasma/plasmaURLPool.java+++ b/source/de/anomic/plasma/plasmaURLPool.java@@ -47,7 +47,7 @@ package de.anomic.plasma;import java.io.File;import java.io.IOException;-import de.anomic.index.indexURL;+import de.anomic.plasma.plasmaURL;import de.anomic.index.indexURLEntry;import de.anomic.net.URL;@@ -79,7 +79,7 @@ public class plasmaURLPool {}public URL getURL(String urlhash) throws IOException {- if (urlhash.equals(indexURL.dummyHash)) return null;+ if (urlhash.equals(plasmaURL.dummyHash)) return null;try {plasmaCrawlNURL.Entry ne = noticeURL.getEntry(urlhash);if (ne != null) return ne.url();diff --git a/source/de/anomic/plasma/plasmaWordIndex.java b/source/de/anomic/plasma/plasmaWordIndex.javaindex 805dc49ea..e5c05dd34 100644--- a/source/de/anomic/plasma/plasmaWordIndex.java+++ b/source/de/anomic/plasma/plasmaWordIndex.java@@ -41,7 +41,6 @@ import de.anomic.index.indexCollectionRI;import de.anomic.index.indexContainer;import de.anomic.index.indexContainerOrder;import de.anomic.index.indexRWIEntry;-import de.anomic.index.indexEntryAttribute;import de.anomic.index.indexRAMRI;import de.anomic.index.indexRI;import de.anomic.index.indexRWIEntryOld;@@ -330,7 +329,7 @@ public final class plasmaWordIndex implements indexRI {word = (String) wentry.getKey();wprop = (plasmaCondenser.wordStatProp) wentry.getValue();// if ((s.length() > 4) && (c > 1)) System.out.println("# " + s + ":" + c);- wordHash = indexEntryAttribute.word2hash(word);+ wordHash = plasmaURL.word2hash(word);ientry = new indexRWIEntryOld(urlHash,urlLength, urlComps, (document == null) ? urlLength : document.getMainLongTitle().length(),wprop.count,diff --git a/source/de/anomic/soap/services/BookmarkService.java b/source/de/anomic/soap/services/BookmarkService.javaindex 8b6a8d2e0..f26805b54 100644--- a/source/de/anomic/soap/services/BookmarkService.java+++ b/source/de/anomic/soap/services/BookmarkService.java@@ -63,7 +63,7 @@ import org.apache.axis.attachments.Attachments;import org.w3c.dom.Document;import de.anomic.data.bookmarksDB;-import de.anomic.index.indexURL;+import de.anomic.plasma.plasmaURL;import de.anomic.net.URL;import de.anomic.plasma.plasmaSwitchboard;import de.anomic.server.serverObjects;@@ -294,7 +294,7 @@ public class BookmarkService extends AbstractService {if (url == null || url.length()==0) throw new IllegalArgumentException("The url must not be null or empty");// generating the url hash- String hash = indexURL.urlHash(url);+ String hash = plasmaURL.urlHash(url);// delete urlthis.deleteBookmarkByHash(hash);@@ -309,7 +309,7 @@ public class BookmarkService extends AbstractService {if (url == null || url.length()==0) throw new IllegalArgumentException("The url at position " + i + " is null or empty");// generating the url hash- hashs[i] = indexURL.urlHash(url);+ hashs[i] = plasmaURL.urlHash(url);}// delete urldiff --git a/source/de/anomic/soap/services/SearchService.java b/source/de/anomic/soap/services/SearchService.javaindex 243770e07..506a9f90e 100644--- a/source/de/anomic/soap/services/SearchService.java+++ b/source/de/anomic/soap/services/SearchService.java@@ -49,7 +49,7 @@ import org.apache.axis.AxisFault;import org.w3c.dom.Document;import de.anomic.data.wikiCode;-import de.anomic.index.indexURL;+import de.anomic.plasma.plasmaURL;import de.anomic.net.URL;import de.anomic.plasma.plasmaSearchPreOrder;import de.anomic.server.serverObjects;@@ -190,7 +190,7 @@ public class SearchService extends AbstractServicetry {// getting the url hash for this urlURL url = new URL(urlStr);- String urlHash = indexURL.urlHash(url);+ String urlHash = plasmaURL.urlHash(url);// fetch urlInforeturn this.urlInfoByHash(urlHash, viewMode);diff --git a/source/de/anomic/urlRedirector/urlRedirectord.java b/source/de/anomic/urlRedirector/urlRedirectord.javaindex 3d0418d32..ec17d28fe 100644--- a/source/de/anomic/urlRedirector/urlRedirectord.java+++ b/source/de/anomic/urlRedirector/urlRedirectord.java@@ -10,7 +10,7 @@ import java.util.Date;import de.anomic.data.userDB;import de.anomic.http.httpHeader;import de.anomic.http.httpc;-import de.anomic.index.indexURL;+import de.anomic.plasma.plasmaURL;import de.anomic.net.URL;import de.anomic.plasma.plasmaCrawlProfile;import de.anomic.plasma.plasmaParser;@@ -189,7 +189,7 @@ public class urlRedirectord implements serverHandler {header.mime())) {// first delete old entry, if exists- String urlhash = indexURL.urlHash(this.nextURL);+ String urlhash = plasmaURL.urlHash(this.nextURL);switchboard.urlPool.loadedURL.remove(urlhash);switchboard.urlPool.noticeURL.remove(urlhash);switchboard.urlPool.errorURL.remove(urlhash);diff --git a/source/de/anomic/yacy/yacyClient.java b/source/de/anomic/yacy/yacyClient.javaindex 76b117276..20eac6cf2 100644--- a/source/de/anomic/yacy/yacyClient.java+++ b/source/de/anomic/yacy/yacyClient.java@@ -56,8 +56,7 @@ import de.anomic.htmlFilter.htmlFilterContentScraper;import de.anomic.http.httpc;import de.anomic.index.indexContainer;import de.anomic.index.indexRWIEntry;-import de.anomic.index.indexEntryAttribute;-import de.anomic.index.indexURL;+import de.anomic.plasma.plasmaURL;import de.anomic.index.indexRWIEntryOld;import de.anomic.index.indexURLEntry;import de.anomic.kelondro.kelondroBase64Order;@@ -570,7 +569,7 @@ public final class yacyClient {if (singleAbstract == null) singleAbstract = new TreeMap();ci = new serverByteBuffer(((String) entry.getValue()).getBytes());System.out.println("DEBUG-ABSTRACTFETCH: for word hash " + wordhash + " received " + ci.toString());- indexURL.decompressIndex(singleAbstract, ci, targetPeer.hash);+ plasmaURL.decompressIndex(singleAbstract, ci, targetPeer.hash);abstractCache.put(wordhash, singleAbstract);}}@@ -1200,7 +1199,7 @@ public final class yacyClient {/*final yacyCore core =*/ new yacyCore(sb);yacyCore.peerActions.loadSeedLists();final yacySeed target = yacyCore.seedDB.getConnected(args[1]);- final String wordhashe = indexEntryAttribute.word2hash("test");+ final String wordhashe = plasmaURL.word2hash("test");//System.out.println("permission=" + permissionMessage(args[1]));// should we use the proxy?diff --git a/source/yacy.java b/source/yacy.javaindex 08dcfd6d2..bb45f7c0a 100644--- a/source/yacy.java+++ b/source/yacy.java@@ -72,7 +72,6 @@ import de.anomic.http.httpdFileHandler;import de.anomic.http.httpdProxyHandler;import de.anomic.index.indexContainer;import de.anomic.index.indexRWIEntry;-import de.anomic.index.indexEntryAttribute;import de.anomic.index.indexRWIEntryOld;import de.anomic.index.indexURLEntry;import de.anomic.index.indexURLEntryOld;@@ -86,6 +85,7 @@ import de.anomic.plasma.plasmaCrawlEURL;import de.anomic.plasma.plasmaCrawlLURL;import de.anomic.plasma.plasmaCrawlNURL;import de.anomic.plasma.plasmaSwitchboard;+import de.anomic.plasma.plasmaURL;import de.anomic.plasma.plasmaURLPool;import de.anomic.plasma.plasmaWordIndex;import de.anomic.plasma.plasmaWordIndexAssortmentCluster;@@ -808,7 +808,7 @@ public final class yacy {try {String word;BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(wordlist)));- while ((word = br.readLine()) != null) wordmap.put(indexEntryAttribute.word2hash(word),word);+ while ((word = br.readLine()) != null) wordmap.put(plasmaURL.word2hash(word),word);br.close();} catch (IOException e) {}return wordmap;@@ -913,7 +913,7 @@ public final class yacy {Iterator i = stopwords.iterator();while (i.hasNext()) {w = (String) i.next();- f = plasmaWordIndexFile.wordHash2path(dbRoot, indexEntryAttribute.word2hash(w));+ f = plasmaWordIndexFile.wordHash2path(dbRoot, plasmaURL.word2hash(w));if (f.exists()) {thisamount = f.length();if (f.delete()) {