Skip to content

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

- refactoring and abstraction of index reference (urls) handling: blacklisting is part of reference filtering - refactoring of word/phrase handling: word abstraction from condenser becomes part of index element handling - removed unused code parts from condenser

orbiter7f9f639d208b
diff --git a/htroot/BlacklistCleaner_p.java b/htroot/BlacklistCleaner_p.java
index e583dead6..68ff6c2d5 100644
--- a/htroot/BlacklistCleaner_p.java
+++ b/htroot/BlacklistCleaner_p.java
@@ -63,10 +63,10 @@ import java.util.regex.PatternSyntaxException;
import de.anomic.data.listManager;
import de.anomic.http.httpHeader;
+import de.anomic.index.indexAbstractReferenceBlacklist;
+import de.anomic.index.indexDefaultReferenceBlacklist;
+import de.anomic.index.indexReferenceBlacklist;
import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.urlPattern.abstractURLPattern;
-import de.anomic.plasma.urlPattern.defaultURLPattern;
-import de.anomic.plasma.urlPattern.plasmaURLPattern;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.server.logging.serverLog;
@@ -86,7 +86,7 @@ public class BlacklistCleaner_p {
private static final int ERR_DOUBLE_OCCURANCE = 5;
public static final Class<?>[] supportedBLEngines = {
- defaultURLPattern.class
+ indexDefaultReferenceBlacklist.class
};
public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch<?> env) {
@@ -98,7 +98,7 @@ public class BlacklistCleaner_p {
String blacklistToUse = null;
// getting the list of supported blacklist types
- String supportedBlacklistTypesStr = abstractURLPattern.BLACKLIST_TYPES_STRING;
+ String supportedBlacklistTypesStr = indexAbstractReferenceBlacklist.BLACKLIST_TYPES_STRING;
String[] supportedBlacklistTypes = supportedBlacklistTypesStr.split(",");
if (post == null) {
@@ -198,7 +198,7 @@ public class BlacklistCleaner_p {
return r.toArray(new String[r.size()]);
}
- private static HashMap<String, Integer>/* entry, error-code */ getIllegalEntries(String blacklistToUse, String[] supportedBlacklistTypes, plasmaURLPattern blEngine) {
+ private static HashMap<String, Integer>/* entry, error-code */ getIllegalEntries(String blacklistToUse, String[] supportedBlacklistTypes, indexReferenceBlacklist blEngine) {
HashMap<String, Integer> r = new HashMap<String, Integer>();
HashSet<String> ok = new HashSet<String>();
@@ -206,7 +206,7 @@ public class BlacklistCleaner_p {
Iterator<String> it = list.iterator();
String s, host, path;
- if (blEngine instanceof defaultURLPattern) {
+ if (blEngine instanceof indexDefaultReferenceBlacklist) {
int slashPos;
while (it.hasNext()) {
s = ((String)it.next()).trim();
diff --git a/htroot/Blacklist_p.java b/htroot/Blacklist_p.java
index b88aeb1e8..359a7bab3 100644
--- a/htroot/Blacklist_p.java
+++ b/htroot/Blacklist_p.java
@@ -60,9 +60,9 @@ import java.util.TreeMap;
import de.anomic.data.listManager;
import de.anomic.http.httpHeader;
+import de.anomic.index.indexAbstractReferenceBlacklist;
+import de.anomic.index.indexReferenceBlacklist;
import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.urlPattern.abstractURLPattern;
-import de.anomic.plasma.urlPattern.plasmaURLPattern;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyCore;
@@ -81,7 +81,7 @@ public class Blacklist_p {
listManager.listsPath = new File(listManager.switchboard.getRootPath(),listManager.switchboard.getConfig("listManager.listsPath", "DATA/LISTS"));
// getting the list of supported blacklist types
- String supportedBlacklistTypesStr = abstractURLPattern.BLACKLIST_TYPES_STRING;
+ String supportedBlacklistTypesStr = indexAbstractReferenceBlacklist.BLACKLIST_TYPES_STRING;
String[] supportedBlacklistTypes = supportedBlacklistTypesStr.split(",");
String blacklistToUse = null;
@@ -101,17 +101,17 @@ public class Blacklist_p {
} catch (MalformedURLException e) { }
if(testurl != null) {
prop.putHTML("testlist_url",testurl.toString());
- if(plasmaSwitchboard.urlBlacklist.isListed(plasmaURLPattern.BLACKLIST_CRAWLER, testurl))
+ if(plasmaSwitchboard.urlBlacklist.isListed(indexReferenceBlacklist.BLACKLIST_CRAWLER, testurl))
prop.put("testlist_listedincrawler", "1");
- if(plasmaSwitchboard.urlBlacklist.isListed(plasmaURLPattern.BLACKLIST_DHT, testurl))
+ if(plasmaSwitchboard.urlBlacklist.isListed(indexReferenceBlacklist.BLACKLIST_DHT, testurl))
prop.put("testlist_listedindht", "1");
- if(plasmaSwitchboard.urlBlacklist.isListed(plasmaURLPattern.BLACKLIST_NEWS, testurl))
+ if(plasmaSwitchboard.urlBlacklist.isListed(indexReferenceBlacklist.BLACKLIST_NEWS, testurl))
prop.put("testlist_listedinnews", "1");
- if(plasmaSwitchboard.urlBlacklist.isListed(plasmaURLPattern.BLACKLIST_PROXY, testurl))
+ if(plasmaSwitchboard.urlBlacklist.isListed(indexReferenceBlacklist.BLACKLIST_PROXY, testurl))
prop.put("testlist_listedinproxy", "1");
- if(plasmaSwitchboard.urlBlacklist.isListed(plasmaURLPattern.BLACKLIST_SEARCH, testurl))
+ if(plasmaSwitchboard.urlBlacklist.isListed(indexReferenceBlacklist.BLACKLIST_SEARCH, testurl))
prop.put("testlist_listedinsearch", "1");
- if(plasmaSwitchboard.urlBlacklist.isListed(plasmaURLPattern.BLACKLIST_SURFTIPS, testurl))
+ if(plasmaSwitchboard.urlBlacklist.isListed(indexReferenceBlacklist.BLACKLIST_SURFTIPS, testurl))
prop.put("testlist_listedinsurftips", "1");
}
else prop.put("testlist_url","not valid");
diff --git a/htroot/Bookmarks.java b/htroot/Bookmarks.java
index f87f961dd..2d4f6d47b 100644
--- a/htroot/Bookmarks.java
+++ b/htroot/Bookmarks.java
@@ -61,7 +61,7 @@ import de.anomic.data.userDB;
import de.anomic.data.bookmarksDB.Tag;
import de.anomic.http.httpHeader;
import de.anomic.http.httpc;
-import de.anomic.index.indexURLEntry;
+import de.anomic.index.indexURLReference;
import de.anomic.plasma.plasmaParserDocument;
import de.anomic.plasma.plasmaSnippetCache;
import de.anomic.plasma.plasmaSwitchboard;
@@ -196,10 +196,10 @@ public class Bookmarks {
bookmarksDB.Bookmark bookmark = switchboard.bookmarksDB.getBookmark(urlHash);
if (bookmark == null) {
// try to get the bookmark from the LURL database
- indexURLEntry urlentry = switchboard.wordIndex.getURL(urlHash, null, 0);
+ indexURLReference urlentry = switchboard.wordIndex.getURL(urlHash, null, 0);
plasmaParserDocument document = null;
if (urlentry != null) {
- indexURLEntry.Components comp = urlentry.comp();
+ indexURLReference.Components comp = urlentry.comp();
document = plasmaSnippetCache.retrieveDocument(comp.url(), true, 5000, true);
prop.put("mode_edit", "0"); // create mode
prop.put("mode_url", comp.url().toNormalform(false, true));
diff --git a/htroot/CrawlResults.java b/htroot/CrawlResults.java
index 4606edfd6..e96182646 100644
--- a/htroot/CrawlResults.java
+++ b/htroot/CrawlResults.java
@@ -29,7 +29,7 @@ import java.util.Date;
import java.util.Locale;
import de.anomic.http.httpHeader;
-import de.anomic.index.indexURLEntry;
+import de.anomic.index.indexURLReference;
import de.anomic.plasma.plasmaHTCache;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.server.serverObjects;
@@ -157,7 +157,7 @@ public class CrawlResults {
String urlHash, initiatorHash, executorHash;
String cachepath, urlstr, urltxt;
yacySeed initiatorSeed, executorSeed;
- indexURLEntry urle;
+ indexURLReference urle;
int i, cnt = 0;
for (i = sb.crawlResults.getStackSize(tabletype) - 1; i >= (sb.crawlResults.getStackSize(tabletype) - lines); i--) {
@@ -168,7 +168,7 @@ public class CrawlResults {
// serverLog.logFinest("PLASMA", "plasmaCrawlLURL/genTableProps urlHash=" + urlHash);
try {
urle = sb.wordIndex.getURL(urlHash, null, 0);
- indexURLEntry.Components comp = urle.comp();
+ indexURLReference.Components comp = urle.comp();
// serverLog.logFinest("PLASMA", "plasmaCrawlLURL/genTableProps urle=" + urle.toString());
initiatorSeed = yacyCore.seedDB.getConnected(initiatorHash);
executorSeed = yacyCore.seedDB.getConnected(executorHash);
diff --git a/htroot/IndexControlRWIs_p.java b/htroot/IndexControlRWIs_p.java
index e0b1c2b4c..67da8d440 100644
--- a/htroot/IndexControlRWIs_p.java
+++ b/htroot/IndexControlRWIs_p.java
@@ -36,17 +36,17 @@ import java.util.Set;
import de.anomic.data.listManager;
import de.anomic.http.httpHeader;
+import de.anomic.index.indexAbstractReferenceBlacklist;
import de.anomic.index.indexContainer;
import de.anomic.index.indexRWIEntry;
import de.anomic.index.indexRWIRowEntry;
-import de.anomic.index.indexURLEntry;
+import de.anomic.index.indexURLReference;
+import de.anomic.index.indexWord;
import de.anomic.kelondro.kelondroBitfield;
-import de.anomic.plasma.plasmaCondenser;
import de.anomic.plasma.plasmaSearchAPI;
import de.anomic.plasma.plasmaSearchEvent;
import de.anomic.plasma.plasmaSearchRankingProcess;
import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.urlPattern.abstractURLPattern;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyClient;
@@ -86,7 +86,7 @@ public class IndexControlRWIs_p {
boolean delurlref = post.containsKey("delurlref");
if (post.containsKey("keystringsearch")) {
- keyhash = plasmaCondenser.word2hash(keystring);
+ keyhash = indexWord.word2hash(keystring);
prop.put("keyhash", keyhash);
final plasmaSearchRankingProcess ranking = plasmaSearchAPI.genSearchresult(prop, sb, keyhash, null);
if (ranking.filteredCount() == 0) {
@@ -96,7 +96,7 @@ public class IndexControlRWIs_p {
}
if (post.containsKey("keyhashsearch")) {
- if (keystring.length() == 0 || !plasmaCondenser.word2hash(keystring).equals(keyhash)) {
+ if (keystring.length() == 0 || !indexWord.word2hash(keystring).equals(keyhash)) {
prop.put("keystring", "&lt;not possible to compute word from hash&gt;");
}
final plasmaSearchRankingProcess ranking = plasmaSearchAPI.genSearchresult(prop, sb, keyhash, null);
@@ -153,7 +153,7 @@ public class IndexControlRWIs_p {
}
if (post.containsKey("urllist")) {
- if (keystring.length() == 0 || !plasmaCondenser.word2hash(keystring).equals(keyhash)) {
+ if (keystring.length() == 0 || !indexWord.word2hash(keystring).equals(keyhash)) {
prop.put("keystring", "&lt;not possible to compute word from hash&gt;");
}
kelondroBitfield flags = plasmaSearchAPI.compileFlags(post);
@@ -164,7 +164,7 @@ public class IndexControlRWIs_p {
// transfer to other peer
if (post.containsKey("keyhashtransfer")) {
- if (keystring.length() == 0 || !plasmaCondenser.word2hash(keystring).equals(keyhash)) {
+ if (keystring.length() == 0 || !indexWord.word2hash(keystring).equals(keyhash)) {
prop.put("keystring", "&lt;not possible to compute word from hash&gt;");
}
@@ -191,10 +191,10 @@ public class IndexControlRWIs_p {
index = sb.wordIndex.getContainer(keyhash, null);
// built urlCache
Iterator<indexRWIRowEntry> urlIter = index.entries();
- HashMap<String, indexURLEntry> knownURLs = new HashMap<String, indexURLEntry>();
+ HashMap<String, indexURLReference> knownURLs = new HashMap<String, indexURLReference>();
HashSet<String> unknownURLEntries = new HashSet<String>();
indexRWIEntry iEntry;
- indexURLEntry lurl;
+ indexURLReference lurl;
while (urlIter.hasNext()) {
iEntry = urlIter.next();
lurl = sb.wordIndex.getURL(iEntry.urlHash(), null, 0);
@@ -254,7 +254,7 @@ public class IndexControlRWIs_p {
yacyURL url;
for (int i=0; i<urlx.length; i++) {
urlHashes.add(urlx[i]);
- indexURLEntry e = sb.wordIndex.getURL(urlx[i], null, 0);
+ indexURLReference e = sb.wordIndex.getURL(urlx[i], null, 0);
sb.wordIndex.removeURL(urlx[i]);
if (e != null) {
url = e.comp().url();
@@ -277,12 +277,12 @@ public class IndexControlRWIs_p {
if (post.containsKey("blacklistdomains")) {
PrintWriter pw;
try {
- String[] supportedBlacklistTypes = abstractURLPattern.BLACKLIST_TYPES_STRING.split(",");
+ String[] supportedBlacklistTypes = indexAbstractReferenceBlacklist.BLACKLIST_TYPES_STRING.split(",");
pw = new PrintWriter(new FileWriter(new File(listManager.listsPath, blacklist), true));
yacyURL url;
for (int i=0; i<urlx.length; i++) {
urlHashes.add(urlx[i]);
- indexURLEntry e = sb.wordIndex.getURL(urlx[i], null, 0);
+ indexURLReference e = sb.wordIndex.getURL(urlx[i], null, 0);
sb.wordIndex.removeURL(urlx[i]);
if (e != null) {
url = e.comp().url();
diff --git a/htroot/IndexControlURLs_p.java b/htroot/IndexControlURLs_p.java
index ab335481d..b04433c5b 100644
--- a/htroot/IndexControlURLs_p.java
+++ b/htroot/IndexControlURLs_p.java
@@ -32,7 +32,7 @@ import java.util.Iterator;
import de.anomic.http.httpHeader;
import de.anomic.index.indexRepositoryReference;
-import de.anomic.index.indexURLEntry;
+import de.anomic.index.indexURLReference;
import de.anomic.kelondro.kelondroBase64Order;
import de.anomic.kelondro.kelondroRotateIterator;
import de.anomic.plasma.plasmaSwitchboard;
@@ -103,7 +103,7 @@ public class IndexControlURLs_p {
}
if (post.containsKey("urlhashdelete")) {
- indexURLEntry entry = sb.wordIndex.getURL(urlhash, null, 0);
+ indexURLReference entry = sb.wordIndex.getURL(urlhash, null, 0);
if (entry == null) {
prop.put("result", "No Entry for URL hash " + urlhash + "; nothing deleted.");
} else {
@@ -135,7 +135,7 @@ public class IndexControlURLs_p {
yacyURL url = new yacyURL(urlstring, null);
urlhash = url.hash();
prop.put("urlhash", urlhash);
- indexURLEntry entry = sb.wordIndex.getURL(urlhash, null, 0);
+ indexURLReference entry = sb.wordIndex.getURL(urlhash, null, 0);
if (entry == null) {
prop.putHTML("urlstring", "unknown url: " + urlstring);
prop.put("urlhash", "");
@@ -150,7 +150,7 @@ public class IndexControlURLs_p {
}
if (post.containsKey("urlhashsearch")) {
- indexURLEntry entry = sb.wordIndex.getURL(urlhash, null, 0);
+ indexURLReference entry = sb.wordIndex.getURL(urlhash, null, 0);
if (entry == null) {
prop.put("result", "No Entry for URL hash " + urlhash);
} else {
@@ -163,14 +163,14 @@ public class IndexControlURLs_p {
// generate list
if (post.containsKey("urlhashsimilar")) {
try {
- final Iterator<indexURLEntry> entryIt = new kelondroRotateIterator<indexURLEntry>(sb.wordIndex.entriesURL(true, urlhash), new String(kelondroBase64Order.zero(urlhash.length())), sb.wordIndex.size());
+ final Iterator<indexURLReference> entryIt = new kelondroRotateIterator<indexURLReference>(sb.wordIndex.entriesURL(true, urlhash), new String(kelondroBase64Order.zero(urlhash.length())), sb.wordIndex.size());
StringBuffer result = new StringBuffer("Sequential List of URL-Hashes:<br />");
- indexURLEntry entry;
+ indexURLReference entry;
int i = 0;
int rows = 0, cols = 0;
prop.put("urlhashsimilar", "1");
while (entryIt.hasNext() && i < 256) {
- entry = (indexURLEntry) entryIt.next();
+ entry = (indexURLReference) entryIt.next();
if (entry == null) break;
prop.put("urlhashsimilar_rows_"+rows+"_cols_"+cols+"_urlHash", entry.hash());
cols++;
@@ -223,15 +223,15 @@ public class IndexControlURLs_p {
return prop;
}
- private static serverObjects genUrlProfile(plasmaSwitchboard switchboard, indexURLEntry entry, String urlhash) {
+ private static serverObjects genUrlProfile(plasmaSwitchboard switchboard, indexURLReference entry, String urlhash) {
serverObjects prop = new serverObjects();
if (entry == null) {
prop.put("genUrlProfile", "1");
prop.put("genUrlProfile_urlhash", urlhash);
return prop;
}
- indexURLEntry.Components comp = entry.comp();
- indexURLEntry le = ((entry.referrerHash() == null) || (entry.referrerHash().length() != yacySeedDB.commonHashLength)) ? null : switchboard.wordIndex.getURL(entry.referrerHash(), null, 0);
+ indexURLReference.Components comp = entry.comp();
+ indexURLReference le = ((entry.referrerHash() == null) || (entry.referrerHash().length() != yacySeedDB.commonHashLength)) ? null : switchboard.wordIndex.getURL(entry.referrerHash(), null, 0);
if (comp.url() == null) {
prop.put("genUrlProfile", "1");
prop.put("genUrlProfile_urlhash", urlhash);
diff --git a/htroot/Supporter.java b/htroot/Supporter.java
index bce3c8577..236d88de8 100644
--- a/htroot/Supporter.java
+++ b/htroot/Supporter.java
@@ -32,12 +32,12 @@ import java.util.HashMap;
import java.util.Iterator;
import de.anomic.http.httpHeader;
+import de.anomic.index.indexReferenceBlacklist;
import de.anomic.kelondro.kelondroMScoreCluster;
import de.anomic.kelondro.kelondroNaturalOrder;
import de.anomic.kelondro.kelondroRow;
import de.anomic.kelondro.kelondroRow.Entry;
import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.urlPattern.plasmaURLPattern;
import de.anomic.server.serverDate;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
@@ -126,7 +126,7 @@ public class Supporter {
url = row.getColString(0, null);
try {
- if (plasmaSwitchboard.urlBlacklist.isListed(plasmaURLPattern.BLACKLIST_SURFTIPS ,new yacyURL(url, urlhash))) continue;
+ if (plasmaSwitchboard.urlBlacklist.isListed(indexReferenceBlacklist.BLACKLIST_SURFTIPS ,new yacyURL(url, urlhash))) continue;
} catch(MalformedURLException e) {continue;}
title = row.getColString(1,"UTF-8");
description = row.getColString(2,"UTF-8");
diff --git a/htroot/Surftips.java b/htroot/Surftips.java
index 65bbb8887..8d6e329d2 100644
--- a/htroot/Surftips.java
+++ b/htroot/Surftips.java
@@ -32,12 +32,12 @@ import java.util.HashMap;
import java.util.Iterator;
import de.anomic.http.httpHeader;
+import de.anomic.index.indexReferenceBlacklist;
import de.anomic.kelondro.kelondroMScoreCluster;
import de.anomic.kelondro.kelondroNaturalOrder;
import de.anomic.kelondro.kelondroRow;
import de.anomic.kelondro.kelondroRow.Entry;
import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.urlPattern.plasmaURLPattern;
import de.anomic.server.serverDate;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
@@ -134,7 +134,7 @@ public class Surftips {
url = row.getColString(0, null);
try{
- if(plasmaSwitchboard.urlBlacklist.isListed(plasmaURLPattern.BLACKLIST_SURFTIPS ,new yacyURL(url, null)))
+ if(plasmaSwitchboard.urlBlacklist.isListed(indexReferenceBlacklist.BLACKLIST_SURFTIPS ,new yacyURL(url, null)))
continue;
}catch(MalformedURLException e){continue;};
title = row.getColString(1,"UTF-8");
diff --git a/htroot/ViewFile.java b/htroot/ViewFile.java
index 13a1f5d3b..371703264 100644
--- a/htroot/ViewFile.java
+++ b/htroot/ViewFile.java
@@ -57,7 +57,7 @@ import de.anomic.data.htmlTools;
import de.anomic.htmlFilter.htmlFilterImageEntry;
import de.anomic.http.httpHeader;
import de.anomic.http.httpc;
-import de.anomic.index.indexURLEntry;
+import de.anomic.index.indexURLReference;
import de.anomic.plasma.plasmaCondenser;
import de.anomic.plasma.plasmaHTCache;
import de.anomic.plasma.plasmaParserDocument;
@@ -108,7 +108,7 @@ public class ViewFile {
String urlHash = post.get("urlHash","");
if (urlHash.length() > 0) {
// getting the urlEntry that belongs to the url hash
- indexURLEntry urlEntry = null;
+ indexURLReference urlEntry = null;
urlEntry = sb.wordIndex.getURL(urlHash, null, 0);
if (urlEntry == null) {
prop.put("error", "2");
@@ -117,7 +117,7 @@ public class ViewFile {
}
// gettin the url that belongs to the entry
- indexURLEntry.Components comp = urlEntry.comp();
+ indexURLReference.Components comp = urlEntry.comp();
if ((comp == null) || (comp.url() == null)) {
prop.put("error", "3");
prop.put("viewMode", VIEW_MODE_NO_TEXT);
diff --git a/htroot/sharedBlacklist_p.java b/htroot/sharedBlacklist_p.java
index 3b7b20d88..197e64659 100644
--- a/htroot/sharedBlacklist_p.java
+++ b/htroot/sharedBlacklist_p.java
@@ -58,8 +58,8 @@ import java.util.HashSet;
import de.anomic.data.listManager;
import de.anomic.http.httpHeader;
import de.anomic.http.httpc;
+import de.anomic.index.indexAbstractReferenceBlacklist;
import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.urlPattern.abstractURLPattern;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.tools.nxTools;
@@ -207,7 +207,7 @@ public class sharedBlacklist_p {
count++;
if (plasmaSwitchboard.urlBlacklist != null) {
- String supportedBlacklistTypesStr = abstractURLPattern.BLACKLIST_TYPES_STRING;
+ String supportedBlacklistTypesStr = indexAbstractReferenceBlacklist.BLACKLIST_TYPES_STRING;
String[] supportedBlacklistTypes = supportedBlacklistTypesStr.split(",");
for (int blTypes=0; blTypes < supportedBlacklistTypes.length; blTypes++) {
diff --git a/htroot/xml/blacklists_p.java b/htroot/xml/blacklists_p.java
index 5cf34acbd..15c59f4f3 100644
--- a/htroot/xml/blacklists_p.java
+++ b/htroot/xml/blacklists_p.java
@@ -24,7 +24,7 @@ import java.util.ArrayList;
import de.anomic.data.listManager;
import de.anomic.http.httpHeader;
-import de.anomic.plasma.urlPattern.abstractURLPattern;
+import de.anomic.index.indexAbstractReferenceBlacklist;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
@@ -50,7 +50,7 @@ public class blacklists_p {
prop.put("lists_" + blacklistCount + "_shared", "0");
}
- String[] types = abstractURLPattern.BLACKLIST_TYPES_STRING.split(",");
+ String[] types = indexAbstractReferenceBlacklist.BLACKLIST_TYPES_STRING.split(",");
for (int j=0; j<types.length; j++) {
prop.put("lists_" + blacklistCount + "_types_" + j + "_name", types[j]);
prop.put("lists_" + blacklistCount + "_types_" + j + "_value",
diff --git a/htroot/yacy/crawlReceipt.java b/htroot/yacy/crawlReceipt.java
index 3778f23a5..68fa2a15e 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.indexURLEntry;
+import de.anomic.index.indexURLReference;
import de.anomic.plasma.plasmaCrawlZURL;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.server.serverObjects;
@@ -132,14 +132,14 @@ public final class crawlReceipt {
}
// generating a new loaded URL entry
- indexURLEntry entry = indexURLEntry.importEntry(propStr);
+ indexURLReference entry = indexURLReference.importEntry(propStr);
if (entry == null) {
log.logWarning("crawlReceipt: RECEIVED wrong RECEIPT (entry null) from peer " + iam + "\n\tURL properties: "+ propStr);
prop.put("delay", "3600");
return prop;
}
- indexURLEntry.Components comp = entry.comp();
+ indexURLReference.Components comp = entry.comp();
if (comp.url() == null) {
log.logWarning("crawlReceipt: RECEIVED wrong RECEIPT (url null) for hash " + entry.hash() + " from peer " + iam + "\n\tURL properties: "+ propStr);
prop.put("delay", "3600");
diff --git a/htroot/yacy/transferRWI.java b/htroot/yacy/transferRWI.java
index 10e01f3ad..6f8479a1c 100644
--- a/htroot/yacy/transferRWI.java
+++ b/htroot/yacy/transferRWI.java
@@ -52,8 +52,8 @@ import java.util.List;
import de.anomic.http.httpHeader;
import de.anomic.index.indexRWIRowEntry;
+import de.anomic.index.indexReferenceBlacklist;
import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.urlPattern.plasmaURLPattern;
import de.anomic.server.serverCore;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
@@ -159,7 +159,7 @@ public final class transferRWI {
urlHash = iEntry.urlHash();
// block blacklisted entries
- if ((blockBlacklist) && (plasmaSwitchboard.urlBlacklist.hashInBlacklistedCache(plasmaURLPattern.BLACKLIST_DHT, urlHash))) {
+ if ((blockBlacklist) && (plasmaSwitchboard.urlBlacklist.hashInBlacklistedCache(indexReferenceBlacklist.BLACKLIST_DHT, urlHash))) {
int deleted = sb.wordIndex.tryRemoveURLs(urlHash);
yacyCore.log.logFine("transferRWI: blocked blacklisted URLHash '" + urlHash + "' from peer " + otherPeerName + "; deleted " + deleted + " URL entries from RWIs");
blocked++;
diff --git a/htroot/yacy/transferURL.java b/htroot/yacy/transferURL.java
index 547b273d2..6bbd0886e 100644
--- a/htroot/yacy/transferURL.java
+++ b/htroot/yacy/transferURL.java
@@ -49,9 +49,9 @@ import java.io.IOException;
import java.text.ParseException;
import de.anomic.http.httpHeader;
-import de.anomic.index.indexURLEntry;
+import de.anomic.index.indexReferenceBlacklist;
+import de.anomic.index.indexURLReference;
import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.urlPattern.plasmaURLPattern;
import de.anomic.server.serverCore;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
@@ -101,7 +101,7 @@ public final class transferURL {
final int sizeBefore = sb.wordIndex.countURL();
// read the urls from the other properties and store
String urls;
- indexURLEntry lEntry;
+ indexURLReference lEntry;
for (int i = 0; i < urlc; i++) {
serverCore.checkInterruption();
@@ -114,7 +114,7 @@ public final class transferURL {
}
// parse new lurl-entry
- lEntry = indexURLEntry.importEntry(urls);
+ lEntry = indexURLReference.importEntry(urls);
if (lEntry == null) {
yacyCore.log.logWarning("transferURL: received invalid URL (entry null) from peer " + otherPeerName + "\n\tURL Property: " + urls);
blocked++;
@@ -122,7 +122,7 @@ public final class transferURL {
}
// check if entry is well-formed
- indexURLEntry.Components comp = lEntry.comp();
+ indexURLReference.Components comp = lEntry.comp();
if (comp.url() == null) {
yacyCore.log.logWarning("transferURL: received invalid URL from peer " + otherPeerName + "\n\tURL Property: " + urls);
blocked++;
@@ -137,7 +137,7 @@ public final class transferURL {
}
// check if the entry is blacklisted
- if ((blockBlacklist) && (plasmaSwitchboard.urlBlacklist.isListed(plasmaURLPattern.BLACKLIST_DHT, comp.url()))) {
+ if ((blockBlacklist) && (plasmaSwitchboard.urlBlacklist.isListed(indexReferenceBlacklist.BLACKLIST_DHT, comp.url()))) {
int deleted = sb.wordIndex.tryRemoveURLs(lEntry.hash());
yacyCore.log.logFine("transferURL: blocked blacklisted URL '" + comp.url().toNormalform(false, true) + "' from peer " + otherPeerName + "; deleted " + deleted + " URL entries from RWIs");
lEntry = null;
diff --git a/htroot/yacy/ui/result.java b/htroot/yacy/ui/result.java
index d233cfc08..bf916aff6 100644
--- a/htroot/yacy/ui/result.java
+++ b/htroot/yacy/ui/result.java
@@ -27,6 +27,7 @@
import java.util.TreeSet;
import de.anomic.http.httpHeader;
+import de.anomic.index.indexWord;
import de.anomic.kelondro.kelondroBitfield;
import de.anomic.kelondro.kelondroMSetTools;
import de.anomic.plasma.plasmaCondenser;
@@ -165,11 +166,11 @@ public class result {
// do the search
String client = (String) header.get(httpHeader.CONNECTION_PROP_CLIENTIP); // the search client who initiated the search
- TreeSet<String> queryHashes = plasmaCondenser.words2hashes(query[0]);
+ TreeSet<String> queryHashes = indexWord.words2hashes(query[0]);
plasmaSearchQuery theQuery = new plasmaSearchQuery(
querystring,
queryHashes,
- plasmaCondenser.words2hashes(query[1]),
+ indexWord.words2hashes(query[1]),
ranking,
maxDistance,
prefermask,
diff --git a/htroot/yacy/ui/ymarks.java b/htroot/yacy/ui/ymarks.java
index 790fd0b77..c73b68c3f 100644
--- a/htroot/yacy/ui/ymarks.java
+++ b/htroot/yacy/ui/ymarks.java
@@ -61,7 +61,7 @@ import de.anomic.data.userDB;
import de.anomic.data.bookmarksDB.Tag;
import de.anomic.http.httpHeader;
import de.anomic.http.httpc;
-import de.anomic.index.indexURLEntry;
+import de.anomic.index.indexURLReference;
import de.anomic.plasma.plasmaParserDocument;
import de.anomic.plasma.plasmaSnippetCache;
import de.anomic.plasma.plasmaSwitchboard;
@@ -196,10 +196,10 @@ public class ymarks {
bookmarksDB.Bookmark bookmark = switchboard.bookmarksDB.getBookmark(urlHash);
if (bookmark == null) {
// try to get the bookmark from the LURL database
- indexURLEntry urlentry = switchboard.wordIndex.getURL(urlHash, null, 0);
+ indexURLReference urlentry = switchboard.wordIndex.getURL(urlHash, null, 0);
plasmaParserDocument document = null;
if (urlentry != null) {
- indexURLEntry.Components comp = urlentry.comp();
+ indexURLReference.Components comp = urlentry.comp();
document = plasmaSnippetCache.retrieveDocument(comp.url(), true, 5000, true);
prop.put("mode_edit", "0"); // create mode
prop.put("mode_url", comp.url().toNormalform(false, true));
diff --git a/htroot/yacy/urls.java b/htroot/yacy/urls.java
index 7eb0e4c5d..1ccf75b3e 100644
--- a/htroot/yacy/urls.java
+++ b/htroot/yacy/urls.java
@@ -27,7 +27,7 @@
import java.io.IOException;
import de.anomic.http.httpHeader;
-import de.anomic.index.indexURLEntry;
+import de.anomic.index.indexURLReference;
import de.anomic.plasma.plasmaCrawlEntry;
import de.anomic.plasma.plasmaCrawlNURL;
import de.anomic.plasma.plasmaSwitchboard;
@@ -94,8 +94,8 @@ public class urls {
if (urlhashes.length() % 12 != 0) return prop;
int count = urlhashes.length() / 12;
int c = 0;
- indexURLEntry entry;
- indexURLEntry.Components comp;
+ indexURLReference entry;
+ indexURLReference.Components comp;
yacyURL referrer;
for (int i = 0; i < count; i++) {
entry = sb.wordIndex.getURL(urlhashes.substring(12 * i, 12 * (i + 1)), null, 0);
diff --git a/htroot/yacy/user/ysearch.java b/htroot/yacy/user/ysearch.java
index 1f78fee52..21c414d04 100644
--- a/htroot/yacy/user/ysearch.java
+++ b/htroot/yacy/user/ysearch.java
@@ -27,6 +27,7 @@
import java.util.TreeSet;
import de.anomic.http.httpHeader;
+import de.anomic.index.indexWord;
import de.anomic.kelondro.kelondroBitfield;
import de.anomic.kelondro.kelondroMSetTools;
import de.anomic.plasma.plasmaCondenser;
@@ -165,11 +166,11 @@ public class ysearch {
// do the search
String client = (String) header.get(httpHeader.CONNECTION_PROP_CLIENTIP); // the search client who initiated the search
- TreeSet<String> queryHashes = plasmaCondenser.words2hashes(query[0]);
+ TreeSet<String> queryHashes = indexWord.words2hashes(query[0]);
plasmaSearchQuery theQuery = new plasmaSearchQuery(
querystring,
queryHashes,
- plasmaCondenser.words2hashes(query[1]),
+ indexWord.words2hashes(query[1]),
ranking,
maxDistance,
prefermask,
diff --git a/htroot/yacysearch.java b/htroot/yacysearch.java
index 9337d0886..c01b31ce8 100644
--- a/htroot/yacysearch.java
+++ b/htroot/yacysearch.java
@@ -50,7 +50,8 @@ import java.util.HashMap;
import java.util.TreeSet;
import de.anomic.http.httpHeader;
-import de.anomic.index.indexURLEntry;
+import de.anomic.index.indexURLReference;
+import de.anomic.index.indexWord;
import de.anomic.kelondro.kelondroBitfield;
import de.anomic.kelondro.kelondroMSetTools;
import de.anomic.plasma.plasmaCondenser;
@@ -216,9 +217,9 @@ public class yacysearch {
return prop;
}
final String recommendHash = post.get("recommendref", ""); // urlhash
- indexURLEntry urlentry = sb.wordIndex.getURL(recommendHash, null, 0);
+ indexURLReference urlentry = sb.wordIndex.getURL(recommendHash, null, 0);
if (urlentry != null) {
- indexURLEntry.Components comp = urlentry.comp();
+ indexURLReference.Components comp = urlentry.comp();
plasmaParserDocument document;
document = plasmaSnippetCache.retrieveDocument(comp.url(), true, 5000, true);
if (document != null) {
@@ -240,11 +241,11 @@ public class yacysearch {
final boolean globalsearch = (global) && (yacyonline) && (sb.getConfigBool(plasmaSwitchboard.INDEX_RECEIVE_ALLOW, false));
// do the search
- TreeSet<String> queryHashes = plasmaCondenser.words2hashes(query[0]);
+ TreeSet<String> queryHashes = indexWord.words2hashes(query[0]);
plasmaSearchQuery theQuery = new plasmaSearchQuery(
querystring,
queryHashes,
- plasmaCondenser.words2hashes(query[1]),
+ indexWord.words2hashes(query[1]),
ranking,
maxDistance,
prefermask,
diff --git a/source/de/anomic/data/SitemapParser.java b/source/de/anomic/data/SitemapParser.java
index a94a483fd..777d4e7f1 100644
--- a/source/de/anomic/data/SitemapParser.java
+++ b/source/de/anomic/data/SitemapParser.java
@@ -59,7 +59,7 @@ import org.xml.sax.helpers.DefaultHandler;
import de.anomic.http.httpc;
import de.anomic.http.httpdByteCountInputStream;
-import de.anomic.index.indexURLEntry;
+import de.anomic.index.indexURLReference;
import de.anomic.plasma.plasmaCrawlProfile;
import de.anomic.plasma.plasmaCrawlZURL;
import de.anomic.plasma.plasmaSwitchboard;
@@ -286,7 +286,7 @@ public class SitemapParser extends DefaultHandler {
String dbocc = this.switchboard.urlExists(nexturlhash);
if ((dbocc != null) && (dbocc.equalsIgnoreCase("loaded"))) {
// the url was already loaded. we need to check the date
- indexURLEntry oldEntry = switchboard.wordIndex.getURL(nexturlhash, null, 0);
+ indexURLReference oldEntry = switchboard.wordIndex.getURL(nexturlhash, null, 0);
if (oldEntry != null) {
Date modDate = oldEntry.moddate();
// check if modDate is null
diff --git a/source/de/anomic/data/bookmarksDB.java b/source/de/anomic/data/bookmarksDB.java
index 0ab8a8dd3..2ad4a19ed 100644
--- a/source/de/anomic/data/bookmarksDB.java
+++ b/source/de/anomic/data/bookmarksDB.java
@@ -74,6 +74,7 @@ import org.xml.sax.SAXException;
import de.anomic.htmlFilter.htmlFilterContentScraper;
import de.anomic.htmlFilter.htmlFilterWriter;
+import de.anomic.index.indexWord;
import de.anomic.kelondro.kelondroCloneableIterator;
import de.anomic.kelondro.kelondroDyn;
import de.anomic.kelondro.kelondroException;
@@ -81,7 +82,6 @@ import de.anomic.kelondro.kelondroMapObjects;
import de.anomic.kelondro.kelondroNaturalOrder;
import de.anomic.kelondro.kelondroObjects;
import de.anomic.kelondro.kelondroObjectsMapEntry;
-import de.anomic.plasma.plasmaCondenser;
import de.anomic.server.serverDate;
import de.anomic.server.serverFileUtils;
import de.anomic.server.logging.serverLog;
@@ -152,10 +152,10 @@ public class bookmarksDB {
* tagName is converted to lower case before hash is generated!
*/
public static String tagHash(String tagName){
- return plasmaCondenser.word2hash(tagName.toLowerCase());
+ return indexWord.word2hash(tagName.toLowerCase());
}
public static String tagHash(String tagName, String user){
- return plasmaCondenser.word2hash(user+":"+tagName.toLowerCase());
+ return indexWord.word2hash(user+":"+tagName.toLowerCase());
}
public Iterator<String> getFolderList(boolean priv){
diff --git a/source/de/anomic/data/listManager.java b/source/de/anomic/data/listManager.java
index cd2ff0b50..4f668b1f3 100644
--- a/source/de/anomic/data/listManager.java
+++ b/source/de/anomic/data/listManager.java
@@ -59,9 +59,9 @@ import java.util.Iterator;
import java.util.Set;
import java.util.Vector;
+import de.anomic.index.indexAbstractReferenceBlacklist;
import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.urlPattern.abstractURLPattern;
-import de.anomic.plasma.urlPattern.plasmaURLPattern.blacklistFile;
+import de.anomic.index.indexReferenceBlacklist.blacklistFile;
import de.anomic.server.serverCore;
// The Naming of the functions is a bit strange...
@@ -379,7 +379,7 @@ public class listManager {
* Load or reload all active Blacklists
*/
public static void reloadBlacklists(){
- String supportedBlacklistTypesStr = abstractURLPattern.BLACKLIST_TYPES_STRING;
+ String supportedBlacklistTypesStr = indexAbstractReferenceBlacklist.BLACKLIST_TYPES_STRING;
String[] supportedBlacklistTypes = supportedBlacklistTypesStr.split(",");
ArrayList<blacklistFile> blacklistFiles = new ArrayList<blacklistFile>(supportedBlacklistTypes.length);
diff --git a/source/de/anomic/http/httpdProxyHandler.java b/source/de/anomic/http/httpdProxyHandler.java
index f175ae9e6..e761d61af 100644
--- a/source/de/anomic/http/httpdProxyHandler.java
+++ b/source/de/anomic/http/httpdProxyHandler.java
@@ -93,12 +93,12 @@ import java.util.zip.GZIPOutputStream;
import de.anomic.htmlFilter.htmlFilterContentTransformer;
import de.anomic.htmlFilter.htmlFilterTransformer;
import de.anomic.htmlFilter.htmlFilterWriter;
+import de.anomic.index.indexReferenceBlacklist;
import de.anomic.plasma.plasmaHTCache;
import de.anomic.plasma.plasmaParser;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.plasma.cache.IResourceInfo;
import de.anomic.plasma.cache.http.ResourceInfo;
-import de.anomic.plasma.urlPattern.plasmaURLPattern;
import de.anomic.server.serverCore;
import de.anomic.server.serverDomains;
import de.anomic.server.serverFileUtils;
@@ -367,7 +367,7 @@ public final class httpdProxyHandler {
// respond a 404 for all AGIS ("all you get is shit") servers
String hostlow = host.toLowerCase();
if (args != null) { path = path + "?" + args; }
- if (plasmaSwitchboard.urlBlacklist.isListed(plasmaURLPattern.BLACKLIST_PROXY, hostlow, path)) {
+ if (plasmaSwitchboard.urlBlacklist.isListed(indexReferenceBlacklist.BLACKLIST_PROXY, hostlow, path)) {
httpd.sendRespondError(conProp,respond,4,403,null,
"URL '" + hostlow + "' blocked by yacy proxy (blacklisted)",null);
theLogger.logInfo("AGIS blocking of host '" + hostlow + "'");
@@ -907,7 +907,7 @@ public final class httpdProxyHandler {
// re-calc the url path
String remotePath = (args == null) ? path : (path + "?" + args);
- if (plasmaSwitchboard.urlBlacklist.isListed(plasmaURLPattern.BLACKLIST_PROXY, hostlow, remotePath)) {
+ if (plasmaSwitchboard.urlBlacklist.isListed(indexReferenceBlacklist.BLACKLIST_PROXY, hostlow, remotePath)) {
httpd.sendRespondError(conProp,respond,4,403,null,
"URL '" + hostlow + "' blocked by yacy proxy (blacklisted)",null);
theLogger.logInfo("AGIS blocking of host '" + hostlow + "'");
@@ -1114,7 +1114,7 @@ public final class httpdProxyHandler {
// blacklist idea inspired by [AS]:
// respond a 404 for all AGIS ("all you get is shit") servers
final String hostlow = host.toLowerCase();
- if (plasmaSwitchboard.urlBlacklist.isListed(plasmaURLPattern.BLACKLIST_PROXY, hostlow, path)) {
+ if (plasmaSwitchboard.urlBlacklist.isListed(indexReferenceBlacklist.BLACKLIST_PROXY, hostlow, path)) {
httpd.sendRespondError(conProp,clientOut,4,403,null,
"URL '" + hostlow + "' blocked by yacy proxy (blacklisted)",null);
theLogger.logInfo("AGIS blocking of host '" + hostlow + "'");
diff --git a/source/de/anomic/plasma/urlPattern/abstractURLPattern.java b/source/de/anomic/index/indexAbstractReferenceBlacklist.java
similarity index 81%
rename from source/de/anomic/plasma/urlPattern/abstractURLPattern.java
rename to source/de/anomic/index/indexAbstractReferenceBlacklist.java
index 981de21a3..45e57ea46 100644
--- a/source/de/anomic/plasma/urlPattern/abstractURLPattern.java
+++ b/source/de/anomic/index/indexAbstractReferenceBlacklist.java
@@ -1,16 +1,16 @@
-// abstractURLPattern.java
-// -----------------------
-// part of YaCy
-// (C) by Michael Peter Christen; [email protected]
-// first published on http://www.anomic.de
-// Frankfurt, Germany, 2005
+// indexAbstractReference.java
+// first published on http://www.yacy.net
// (C) 2007 by Bjoern Krombholz
// last major change: 12. August 2006 (theli) ?
//
+// This is a part of YaCy, a peer-to-peer based web search engine
+//
// $LastChangedDate$
// $LastChangedRevision$
// $LastChangedBy$
//
+// LICENSE
+//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
@@ -24,27 +24,8 @@
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// Using this software in any meaning (reading, learning, copying, compiling,
-// running) means that you agree that the Author(s) is (are) not responsible
-// for cost, loss of data or any harm that may be caused directly or indirectly
-// by usage of this softare or this documentation. The usage of this software
-// is on your own risk. The installation and usage (starting/running) of this
-// software may allow other people or application to access your computer and
-// any attached devices and is highly dependent on the configuration of the
-// software which must be done by the user of the software; the author(s) is
-// (are) also not responsible for proper configuration and usage of the
-// software, even if provoked by documentation provided together with
-// the software.
-//
-// Any changes to this file according to the GPL as documented in the file
-// gpl.txt aside this file in the shipment you received can be done to the
-// lines that follows this copyright notice here, but changes must not be
-// done inside the copyright notive above. A re-distribution must contain
-// the intact and unchanged copyright notice.
-// Contributions and changes to the program code must be marked as such.
-package de.anomic.plasma.urlPattern;
+package de.anomic.index;
import java.io.File;
import java.io.IOException;
@@ -59,15 +40,15 @@ import java.util.Set;
import de.anomic.kelondro.kelondroMSetTools;
import de.anomic.yacy.yacyURL;
-public abstract class abstractURLPattern implements plasmaURLPattern {
+public abstract class indexAbstractReferenceBlacklist implements indexReferenceBlacklist {
protected static final HashSet<String> BLACKLIST_TYPES = new HashSet<String>(Arrays.asList(new String[]{
- plasmaURLPattern.BLACKLIST_CRAWLER,
- plasmaURLPattern.BLACKLIST_PROXY,
- plasmaURLPattern.BLACKLIST_DHT,
- plasmaURLPattern.BLACKLIST_SEARCH,
- plasmaURLPattern.BLACKLIST_SURFTIPS,
- plasmaURLPattern.BLACKLIST_NEWS
+ indexReferenceBlacklist.BLACKLIST_CRAWLER,
+ indexReferenceBlacklist.BLACKLIST_PROXY,
+ indexReferenceBlacklist.BLACKLIST_DHT,
+ indexReferenceBlacklist.BLACKLIST_SEARCH,
+ indexReferenceBlacklist.BLACKLIST_SURFTIPS,
+ indexReferenceBlacklist.BLACKLIST_NEWS
}));
public static final String BLACKLIST_TYPES_STRING="proxy,crawler,dht,search,surftips,news";
@@ -75,7 +56,7 @@ public abstract class abstractURLPattern implements plasmaURLPattern {
protected HashMap<String, Set<String>> cachedUrlHashs = null;
protected HashMap<String, HashMap<String, ArrayList<String>>> hostpaths = null; // key=host, value=path; mapped url is http://host/path; path does not start with '/' here
- public abstractURLPattern(File rootPath) {
+ public indexAbstractReferenceBlacklist(File rootPath) {
this.setRootPath(rootPath);
this.blacklistRootPath = rootPath;
diff --git a/source/de/anomic/plasma/urlPattern/defaultURLPattern.java b/source/de/anomic/index/indexDefaultReferenceBlacklist.java
similarity index 62%
rename from source/de/anomic/plasma/urlPattern/defaultURLPattern.java
rename to source/de/anomic/index/indexDefaultReferenceBlacklist.java
index 9214cfa03..46d5f03b1 100644
--- a/source/de/anomic/plasma/urlPattern/defaultURLPattern.java
+++ b/source/de/anomic/index/indexDefaultReferenceBlacklist.java
@@ -1,15 +1,15 @@
-// plasmaURLPattern.java
-// -----------------------
-// part of YaCy
-// (C) by Michael Peter Christen; [email protected]
-// first published on http://www.anomic.de
-// Frankfurt, Germany, 2005
-// last major change: 11.07.2005
+// indexDefaultReference.java
+// (C) 2005 by Michael Peter Christen; [email protected], Frankfurt a. M., Germany
+// first published 11.07.2005 on http://yacy.net
+//
+// This is a part of YaCy, a peer-to-peer based web search engine
//
// $LastChangedDate$
// $LastChangedRevision$
// $LastChangedBy$
//
+// LICENSE
+//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
@@ -23,36 +23,17 @@
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// Using this software in any meaning (reading, learning, copying, compiling,
-// running) means that you agree that the Author(s) is (are) not responsible
-// for cost, loss of data or any harm that may be caused directly or indirectly
-// by usage of this softare or this documentation. The usage of this software
-// is on your own risk. The installation and usage (starting/running) of this
-// software may allow other people or application to access your computer and
-// any attached devices and is highly dependent on the configuration of the
-// software which must be done by the user of the software; the author(s) is
-// (are) also not responsible for proper configuration and usage of the
-// software, even if provoked by documentation provided together with
-// the software.
-//
-// Any changes to this file according to the GPL as documented in the file
-// gpl.txt aside this file in the shipment you received can be done to the
-// lines that follows this copyright notice here, but changes must not be
-// done inside the copyright notive above. A re-distribution must contain
-// the intact and unchanged copyright notice.
-// Contributions and changes to the program code must be marked as such.
-package de.anomic.plasma.urlPattern;
+package de.anomic.index;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
-public class defaultURLPattern extends abstractURLPattern implements plasmaURLPattern {
+public class indexDefaultReferenceBlacklist extends indexAbstractReferenceBlacklist implements indexReferenceBlacklist {
- public defaultURLPattern(File rootPath) {
+ public indexDefaultReferenceBlacklist(File rootPath) {
super(rootPath);
}
diff --git a/source/de/anomic/index/indexPhrase.java b/source/de/anomic/index/indexPhrase.java
new file mode 100644
index 000000000..a29e17c3c
--- /dev/null
+++ b/source/de/anomic/index/indexPhrase.java
@@ -0,0 +1,61 @@
+// indexPhrase.java
+// (C) 2008 by Michael Peter Christen; [email protected], Frankfurt a. M., Germany
+// first published 26.03.2008 on http://yacy.net
+//
+// This is a part of YaCy, a peer-to-peer based web search engine
+//
+// $LastChangedDate: 2006-04-02 22:40:07 +0200 (So, 02 Apr 2006) $
+// $LastChangedRevision: 1986 $
+// $LastChangedBy: orbiter $
+//
+// LICENSE
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+package de.anomic.index;
+
+import java.util.HashSet;
+
+public class indexPhrase {
+ // object carries statistics for words and sentences
+
+ private int count; // number of occurrences
+ private int handle; // unique handle, is initialized with sentence counter
+ private HashSet<Integer> hash; //
+
+ public indexPhrase(int handle) {
+ this.count = 1;
+ this.handle = handle;
+ this.hash = new HashSet<Integer>();
+ }
+
+ public int handle() {
+ return this.handle;
+ }
+
+ public int occurrences() {
+ return count;
+ }
+
+ public void inc() {
+ count++;
+ }
+
+ public void check(int i) {
+ hash.add(new Integer(i));
+ }
+
+
+}
diff --git a/source/de/anomic/plasma/urlPattern/plasmaURLPattern.java b/source/de/anomic/index/indexReferenceBlacklist.java
similarity index 55%
rename from source/de/anomic/plasma/urlPattern/plasmaURLPattern.java
rename to source/de/anomic/index/indexReferenceBlacklist.java
index afbbff662..edf6bee0c 100644
--- a/source/de/anomic/plasma/urlPattern/plasmaURLPattern.java
+++ b/source/de/anomic/index/indexReferenceBlacklist.java
@@ -1,70 +1,96 @@
-package de.anomic.plasma.urlPattern;
-
-import java.io.File;
-import java.util.Arrays;
-import java.util.HashSet;
-
-import de.anomic.yacy.yacyURL;
-
-public interface plasmaURLPattern {
-
- public static final String BLACKLIST_DHT = "dht";
- public static final String BLACKLIST_CRAWLER = "crawler";
- public static final String BLACKLIST_PROXY = "proxy";
- public static final String BLACKLIST_SEARCH = "search";
- public static final String BLACKLIST_SURFTIPS = "surftips";
- public static final String BLACKLIST_NEWS = "news";
-
- public static final class blacklistFile {
-
- private final String filename;
- private final String type;
-
- public blacklistFile(String filename, String type) {
- this.filename = filename;
- this.type = type;
- }
-
- public String getFileName() { return this.filename; }
-
-
- /**
- * Construct a unified array of file names from comma seperated file name
- * list.
- *
- * @return unified String array of file names
- */
- public String[] getFileNamesUnified() {
- HashSet<String> hs = new HashSet<String>(Arrays.asList(this.filename.split(",")));
-
- return (String[]) hs.toArray(new String[hs.size()]);
- }
-
- public String getType() { return this.type; }
- }
-
- public String getEngineInfo();
-
- public void setRootPath(File rootPath);
-
- public int blacklistCacheSize();
-
- public int size();
-
- public void clear();
- public void removeAll(String blacklistType, String host);
- public void remove(String blacklistType, String host, String path);
- public void add(String blacklistType, String host, String path);
-
-
- public void loadList(String blacklistType, String filenames, String sep);
- public void loadList(blacklistFile[] blFiles, String sep);
-
-
- public boolean hashInBlacklistedCache(String blacklistType, String urlHash);
-
- public boolean isListed(String blacklistType, yacyURL url);
-
- public boolean isListed(String blacklistType, String hostlow, String path);
-
-}
+// indexReferenceBlacklist.java
+// (C) 2008 by Michael Peter Christen; [email protected], Frankfurt a. M., Germany
+// first published 26.03.2008 on http://yacy.net
+//
+// This is a part of YaCy, a peer-to-peer based web search engine
+//
+// $LastChangedDate: 2006-04-02 22:40:07 +0200 (So, 02 Apr 2006) $
+// $LastChangedRevision: 1986 $
+// $LastChangedBy: orbiter $
+//
+// LICENSE
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+package de.anomic.index;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.HashSet;
+
+import de.anomic.yacy.yacyURL;
+
+public interface indexReferenceBlacklist {
+
+ public static final String BLACKLIST_DHT = "dht";
+ public static final String BLACKLIST_CRAWLER = "crawler";
+ public static final String BLACKLIST_PROXY = "proxy";
+ public static final String BLACKLIST_SEARCH = "search";
+ public static final String BLACKLIST_SURFTIPS = "surftips";
+ public static final String BLACKLIST_NEWS = "news";
+
+ public static final class blacklistFile {
+
+ private final String filename;
+ private final String type;
+
+ public blacklistFile(String filename, String type) {
+ this.filename = filename;
+ this.type = type;
+ }
+
+ public String getFileName() { return this.filename; }
+
+
+ /**
+ * Construct a unified array of file names from comma seperated file name
+ * list.
+ *
+ * @return unified String array of file names
+ */
+ public String[] getFileNamesUnified() {
+ HashSet<String> hs = new HashSet<String>(Arrays.asList(this.filename.split(",")));
+
+ return (String[]) hs.toArray(new String[hs.size()]);
+ }
+
+ public String getType() { return this.type; }
+ }
+
+ public String getEngineInfo();
+
+ public void setRootPath(File rootPath);
+
+ public int blacklistCacheSize();
+
+ public int size();
+
+ public void clear();
+ public void removeAll(String blacklistType, String host);
+ public void remove(String blacklistType, String host, String path);
+ public void add(String blacklistType, String host, String path);
+
+
+ public void loadList(String blacklistType, String filenames, String sep);
+ public void loadList(blacklistFile[] blFiles, String sep);
+
+
+ public boolean hashInBlacklistedCache(String blacklistType, String urlHash);
+
+ public boolean isListed(String blacklistType, yacyURL url);
+
+ public boolean isListed(String blacklistType, String hostlow, String path);
+
+}
diff --git a/source/de/anomic/index/indexRepositoryReference.java b/source/de/anomic/index/indexRepositoryReference.java
index 0328d7a39..4e61ddaa5 100644
--- a/source/de/anomic/index/indexRepositoryReference.java
+++ b/source/de/anomic/index/indexRepositoryReference.java
@@ -47,7 +47,6 @@ import de.anomic.kelondro.kelondroIndex;
import de.anomic.kelondro.kelondroRow;
import de.anomic.kelondro.kelondroRowSet;
import de.anomic.kelondro.kelondroSplitTable;
-import de.anomic.plasma.urlPattern.plasmaURLPattern;
import de.anomic.server.serverCodings;
import de.anomic.server.logging.serverLog;
import de.anomic.yacy.yacyURL;
@@ -78,7 +77,7 @@ public final class indexRepositoryReference {
}
}
- urlIndexFile = new kelondroSplitTable(indexSecondaryTextLocation, "urls", indexURLEntry.rowdef, false);
+ urlIndexFile = new kelondroSplitTable(indexSecondaryTextLocation, "urls", indexURLReference.rowdef, false);
}
public int size() {
@@ -98,22 +97,22 @@ public final class indexRepositoryReference {
return 0;
}
- public synchronized indexURLEntry load(String urlHash, indexRWIEntry searchedWord, long ranking) {
+ public synchronized indexURLReference load(String urlHash, indexRWIEntry searchedWord, long ranking) {
// generates an plasmaLURLEntry using the url hash
// if the url cannot be found, this returns null
if (urlHash == null) return null;
try {
kelondroRow.Entry entry = urlIndexFile.get(urlHash.getBytes());
if (entry == null) return null;
- return new indexURLEntry(entry, searchedWord, ranking);
+ return new indexURLReference(entry, searchedWord, ranking);
} catch (IOException e) {
return null;
}
}
- public synchronized void store(indexURLEntry entry) throws IOException {
+ public synchronized void store(indexURLReference entry) throws IOException {
// Check if there is a more recent Entry already in the DB
- indexURLEntry oldEntry;
+ indexURLReference oldEntry;
try {
if (exists(entry.hash())) {
oldEntry = load(entry.hash(), null, 0);
@@ -135,9 +134,9 @@ public final class indexRepositoryReference {
urlIndexFile.put(entry.toRowEntry(), new Date() /*entry.loaddate()*/);
}
- public synchronized indexURLEntry newEntry(String propStr) {
+ public synchronized indexURLReference newEntry(String propStr) {
if (propStr != null && propStr.startsWith("{") && propStr.endsWith("}")) try {
- return new indexURLEntry(serverCodings.s2p(propStr.substring(1, propStr.length() - 1)));
+ return new indexURLReference(serverCodings.s2p(propStr.substring(1, propStr.length() - 1)));
} catch (kelondroException e) {
// wrong format
return null;
@@ -165,12 +164,12 @@ public final class indexRepositoryReference {
}
}
- public kelondroCloneableIterator<indexURLEntry> entries(boolean up, String firstHash) throws IOException {
+ public kelondroCloneableIterator<indexURLReference> entries(boolean up, String firstHash) throws IOException {
// enumerates entry elements
return new kiter(up, firstHash);
}
- public class kiter implements kelondroCloneableIterator<indexURLEntry> {
+ public class kiter implements kelondroCloneableIterator<indexURLReference> {
// enumerates entry elements
private Iterator<kelondroRow.Entry> iter;
private boolean error;
@@ -196,12 +195,12 @@ public final class indexRepositoryReference {
return this.iter.hasNext();
}
- public final indexURLEntry next() {
+ public final indexURLReference next() {
kelondroRow.Entry e = null;
if (this.iter == null) { return null; }
if (this.iter.hasNext()) { e = this.iter.next(); }
if (e == null) { return null; }
- return new indexURLEntry(e, null, 0);
+ return new indexURLReference(e, null, 0);
}
public final void remove() {
@@ -220,7 +219,7 @@ public final class indexRepositoryReference {
serverLog log = new serverLog("URLDBCLEANUP");
HashSet<String> damagedURLS = new HashSet<String>();
try {
- Iterator<indexURLEntry> eiter = entries(true, null);
+ Iterator<indexURLReference> eiter = entries(true, null);
int iteratorCount = 0;
while (eiter.hasNext()) try {
eiter.next();
@@ -287,7 +286,7 @@ public final class indexRepositoryReference {
}
}
- public BlacklistCleaner getBlacklistCleaner(plasmaURLPattern blacklist) {
+ public BlacklistCleaner getBlacklistCleaner(indexReferenceBlacklist blacklist) {
return new BlacklistCleaner(blacklist);
}
@@ -301,16 +300,16 @@ public final class indexRepositoryReference {
public String lastBlacklistedHash = "";
public String lastUrl = "";
public String lastHash = "";
- private plasmaURLPattern blacklist;
+ private indexReferenceBlacklist blacklist;
- public BlacklistCleaner(plasmaURLPattern blacklist) {
+ public BlacklistCleaner(indexReferenceBlacklist blacklist) {
this.blacklist = blacklist;
}
public void run() {
try {
serverLog.logInfo("URLDBCLEANER", "UrldbCleaner-Thread startet");
- final Iterator<indexURLEntry> eiter = entries(true, null);
+ final Iterator<indexURLReference> eiter = entries(true, null);
while (eiter.hasNext() && run) {
synchronized (this) {
if (this.pause) {
@@ -323,19 +322,19 @@ public final class indexRepositoryReference {
}
}
}
- final indexURLEntry entry = eiter.next();
+ final indexURLReference entry = eiter.next();
if (entry == null) {
serverLog.logFine("URLDBCLEANER", "entry == null");
} else if (entry.hash() == null) {
serverLog.logFine("URLDBCLEANER", ++blacklistedUrls + " blacklisted (" + ((double) blacklistedUrls / totalSearchedUrls) * 100 + "%): " + "hash == null");
} else {
- final indexURLEntry.Components comp = entry.comp();
+ final indexURLReference.Components comp = entry.comp();
totalSearchedUrls++;
if (comp.url() == null) {
serverLog.logFine("URLDBCLEANER", ++blacklistedUrls + " blacklisted (" + ((double) blacklistedUrls / totalSearchedUrls) * 100 + "%): " + entry.hash() + "URL == null");
remove(entry.hash());
- } else if (blacklist.isListed(plasmaURLPattern.BLACKLIST_CRAWLER, comp.url()) ||
- blacklist.isListed(plasmaURLPattern.BLACKLIST_DHT, comp.url())) {
+ } else if (blacklist.isListed(indexReferenceBlacklist.BLACKLIST_CRAWLER, comp.url()) ||
+ blacklist.isListed(indexReferenceBlacklist.BLACKLIST_DHT, comp.url())) {
lastBlacklistedUrl = comp.url().toNormalform(true, true);
lastBlacklistedHash = entry.hash();
serverLog.logFine("URLDBCLEANER", ++blacklistedUrls + " blacklisted (" + ((double) blacklistedUrls / totalSearchedUrls) * 100 + "%): " + entry.hash() + " " + comp.url().toNormalform(false, true));
@@ -443,9 +442,9 @@ public final class indexRepositoryReference {
pw.println("<link>http://yacy.net</link>");
}
- Iterator<indexURLEntry> i = entries(true, null); // iterates indexURLEntry objects
- indexURLEntry entry;
- indexURLEntry.Components comp;
+ Iterator<indexURLReference> i = entries(true, null); // iterates indexURLEntry objects
+ indexURLReference entry;
+ indexURLReference.Components comp;
String url;
loop: while (i.hasNext()) {
entry = i.next();
diff --git a/source/de/anomic/index/indexURLEntry.java b/source/de/anomic/index/indexURLReference.java
similarity index 97%
rename from source/de/anomic/index/indexURLEntry.java
rename to source/de/anomic/index/indexURLReference.java
index f39a4a6c9..6e2bf4893 100644
--- a/source/de/anomic/index/indexURLEntry.java
+++ b/source/de/anomic/index/indexURLReference.java
@@ -1,4 +1,4 @@
-// indexURLEntry.java
+// indexURLReference.java
// (C) 2006 by Michael Peter Christen; [email protected], Frankfurt a. M., Germany
// first published 2006 on http://www.anomic.de
//
@@ -24,7 +24,6 @@
// 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.net.MalformedURLException;
@@ -47,7 +46,7 @@ import de.anomic.tools.crypt;
import de.anomic.tools.nxTools;
import de.anomic.yacy.yacyURL;
-public class indexURLEntry {
+public class indexURLReference {
// this object stores attributes for URL entries
@@ -118,7 +117,7 @@ public class indexURLEntry {
private indexRWIEntry word; // this is only used if the url is transported via remote search requests
private long ranking; // during generation of a search result this value is set
- public indexURLEntry(
+ public indexURLReference(
yacyURL url,
String dc_title,
String dc_creator,
@@ -185,14 +184,14 @@ public class indexURLEntry {
return s.toString().getBytes();
}
- public indexURLEntry(kelondroRow.Entry entry, indexRWIEntry searchedWord, long ranking) {
+ public indexURLReference(kelondroRow.Entry entry, indexRWIEntry searchedWord, long ranking) {
this.entry = entry;
this.snippet = null;
this.word = searchedWord;
this.ranking = ranking;
}
- public indexURLEntry(Properties prop){
+ public indexURLReference(Properties prop){
// 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());
@@ -248,9 +247,9 @@ public class indexURLEntry {
this.ranking = 0;
}
- public static indexURLEntry importEntry(String propStr) {
+ public static indexURLReference importEntry(String propStr) {
if (propStr != null && propStr.startsWith("{") && propStr.endsWith("}")) try {
- return new indexURLEntry(serverCodings.s2p(propStr.substring(1, propStr.length() - 1)));
+ return new indexURLReference(serverCodings.s2p(propStr.substring(1, propStr.length() - 1)));
} catch (kelondroException e) {
// wrong format
return null;
@@ -261,7 +260,7 @@ public class indexURLEntry {
private StringBuffer corePropList() {
// generate a parseable string; this is a simple property-list
- indexURLEntry.Components comp = this.comp();
+ indexURLReference.Components comp = this.comp();
final StringBuffer s = new StringBuffer(300);
//System.out.println("author=" + comp.author());
try {
@@ -319,9 +318,9 @@ public class indexURLEntry {
return this.ranking;
}
- public indexURLEntry.Components comp() {
+ public indexURLReference.Components comp() {
ArrayList<String> cl = nxTools.strings(this.entry.getCol("comp", null), "UTF-8");
- return new indexURLEntry.Components(
+ return new indexURLReference.Components(
(cl.size() > 0) ? ((String) cl.get(0)).trim() : "",
hash(),
(cl.size() > 1) ? ((String) cl.get(1)).trim() : "",
@@ -406,7 +405,7 @@ public class indexURLEntry {
return word;
}
- public boolean isOlder(indexURLEntry other) {
+ public boolean isOlder(indexURLReference other) {
if (other == null) return false;
Date tmoddate = moddate();
Date omoddate = other.moddate();
diff --git a/source/de/anomic/index/indexWord.java b/source/de/anomic/index/indexWord.java
new file mode 100644
index 000000000..d74852818
--- /dev/null
+++ b/source/de/anomic/index/indexWord.java
@@ -0,0 +1,101 @@
+// indexWord.java
+// (C) 2008 by Michael Peter Christen; [email protected], Frankfurt a. M., Germany
+// first published 26.03.2008 on http://yacy.net
+//
+// This is a part of YaCy, a peer-to-peer based web search engine
+//
+// $LastChangedDate: 2006-04-02 22:40:07 +0200 (So, 02 Apr 2006) $
+// $LastChangedRevision: 1986 $
+// $LastChangedBy: orbiter $
+//
+// LICENSE
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+package de.anomic.index;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.TreeSet;
+
+import de.anomic.kelondro.kelondroBase64Order;
+import de.anomic.kelondro.kelondroBitfield;
+import de.anomic.server.serverCodings;
+import de.anomic.yacy.yacySeedDB;
+
+public class indexWord {
+
+ // object carries statistics for words and sentences
+
+ public int count; // number of occurrences
+ public int posInText; // unique handle, is initialized with word position (excluding double occurring words)
+ public int posInPhrase; // position of word in phrase
+ public int numOfPhrase; // number of phrase. 'normal' phrases begin with number 100
+ HashSet<Integer> phrases; // a set of handles to all phrases where this word appears
+ public kelondroBitfield flags; // the flag bits for each word
+
+ public indexWord(int handle, int pip, int nop) {
+ this.count = 1;
+ this.posInText = handle;
+ this.posInPhrase = pip;
+ this.numOfPhrase = nop;
+ this.phrases = new HashSet<Integer>();
+ this.flags = null;
+ }
+
+ public void inc() {
+ count++;
+ }
+
+ public int occurrences() {
+ return count;
+ }
+
+ public void check(int i) {
+ phrases.add(new Integer(i));
+ }
+
+ public Iterator<Integer> phrases() {
+ // returns an iterator to handles of all phrases where the word appears
+ return phrases.iterator();
+ }
+
+ // static methods
+
+ // create a word hash
+ public static final String word2hash(String word) {
+ return kelondroBase64Order.enhancedCoder.encode(serverCodings.encodeMD5Raw(word.toLowerCase())).substring(0, yacySeedDB.commonHashLength);
+ }
+
+ public static final Set<String> words2hashSet(String[] words) {
+ TreeSet<String> hashes = new TreeSet<String>(kelondroBase64Order.enhancedComparator);
+ for (int i = 0; i < words.length; i++) hashes.add(word2hash(words[i]));
+ return hashes;
+ }
+
+ public static final String words2hashString(String[] words) {
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < words.length; i++) sb.append(word2hash(words[i]));
+ return new String(sb);
+ }
+
+ public static final TreeSet<String> words2hashes(Set<String> words) {
+ Iterator<String> i = words.iterator();
+ TreeSet<String> hashes = new TreeSet<String>(kelondroBase64Order.enhancedComparator);
+ while (i.hasNext()) hashes.add(word2hash(i.next()));
+ return hashes;
+ }
+}
diff --git a/source/de/anomic/plasma/crawler/plasmaHTTPLoader.java b/source/de/anomic/plasma/crawler/plasmaHTTPLoader.java
index 078051f96..8a59a7e1c 100644
--- a/source/de/anomic/plasma/crawler/plasmaHTTPLoader.java
+++ b/source/de/anomic/plasma/crawler/plasmaHTTPLoader.java
@@ -60,6 +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.indexReferenceBlacklist;
import de.anomic.plasma.plasmaCrawlEURL;
import de.anomic.plasma.plasmaCrawlEntry;
import de.anomic.plasma.plasmaHTCache;
@@ -67,7 +68,6 @@ import de.anomic.plasma.plasmaParser;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.plasma.cache.IResourceInfo;
import de.anomic.plasma.cache.http.ResourceInfo;
-import de.anomic.plasma.urlPattern.plasmaURLPattern;
import de.anomic.server.serverSystem;
import de.anomic.server.logging.serverLog;
import de.anomic.yacy.yacyURL;
@@ -151,7 +151,7 @@ public final class plasmaHTTPLoader {
// check if url is in blacklist
String hostlow = host.toLowerCase();
- if (plasmaSwitchboard.urlBlacklist.isListed(plasmaURLPattern.BLACKLIST_CRAWLER, hostlow, path)) {
+ if (plasmaSwitchboard.urlBlacklist.isListed(indexReferenceBlacklist.BLACKLIST_CRAWLER, hostlow, path)) {
this.log.logInfo("CRAWLER Rejecting URL '" + entry.url().toString() + "'. URL is in blacklist.");
sb.crawlQueues.errorURL.newEntry(entry, null, new Date(), 1, plasmaCrawlEURL.DENIED_URL_IN_BLACKLIST).store();
return null;
diff --git a/source/de/anomic/plasma/dbImport/plasmaDbImporter.java b/source/de/anomic/plasma/dbImport/plasmaDbImporter.java
index a57d66199..a70b265d6 100644
--- a/source/de/anomic/plasma/dbImport/plasmaDbImporter.java
+++ b/source/de/anomic/plasma/dbImport/plasmaDbImporter.java
@@ -9,7 +9,7 @@ import java.util.TreeSet;
import de.anomic.index.indexContainer;
import de.anomic.index.indexRWIEntry;
import de.anomic.index.indexRWIRowEntry;
-import de.anomic.index.indexURLEntry;
+import de.anomic.index.indexURLReference;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.plasma.plasmaWordIndex;
import de.anomic.server.serverDate;
@@ -185,7 +185,7 @@ public class plasmaDbImporter extends AbstractImporter implements dbImporter {
// we need to import the url
// getting the url entry
- indexURLEntry urlEntry = this.importWordIndex.getURL(urlHash, null, 0);
+ indexURLReference urlEntry = this.importWordIndex.getURL(urlHash, null, 0);
if (urlEntry != null) {
/* write it into the home url db */
diff --git a/source/de/anomic/plasma/plasmaCondenser.java b/source/de/anomic/plasma/plasmaCondenser.java
index 3c08e440d..4f87c2fb2 100644
--- a/source/de/anomic/plasma/plasmaCondenser.java
+++ b/source/de/anomic/plasma/plasmaCondenser.java
@@ -61,18 +61,16 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
-import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
import de.anomic.htmlFilter.htmlFilterContentScraper;
import de.anomic.htmlFilter.htmlFilterImageEntry;
+import de.anomic.index.indexPhrase;
import de.anomic.index.indexRWIEntry;
-import de.anomic.kelondro.kelondroBase64Order;
+import de.anomic.index.indexWord;
import de.anomic.kelondro.kelondroBitfield;
import de.anomic.kelondro.kelondroMSetTools;
-import de.anomic.server.serverCodings;
-import de.anomic.yacy.yacySeedDB;
import de.anomic.yacy.yacyURL;
public final class plasmaCondenser {
@@ -121,8 +119,7 @@ public final class plasmaCondenser {
}
//private Properties analysis;
- private TreeMap<String, wordStatProp> words; // a string (the words) to (wordStatProp) - relation
- private HashMap<StringBuffer, phraseStatProp> sentences;
+ private TreeMap<String, indexWord> words; // a string (the words) to (indexWord) - relation
private int wordminsize;
private int wordcut;
@@ -138,8 +135,7 @@ public final class plasmaCondenser {
// added media words are flagged with the appropriate media flag
this.wordminsize = 3;
this.wordcut = 2;
- this.words = new TreeMap<String, wordStatProp>();
- this.sentences = new HashMap<StringBuffer, phraseStatProp>();
+ this.words = new TreeMap<String, indexWord>();
this.RESULT_FLAGS = new kelondroBitfield(4);
//System.out.println("DEBUG: condensing " + document.getMainLongTitle() + ", indexText=" + Boolean.toString(indexText) + ", indexMedia=" + Boolean.toString(indexMedia));
@@ -220,9 +216,9 @@ public final class plasmaCondenser {
}
// finally check all words for missing flag entry
- Iterator<Map.Entry<String, wordStatProp>> k = words.entrySet().iterator();
- wordStatProp wprop;
- Map.Entry<String, wordStatProp> we;
+ Iterator<Map.Entry<String, indexWord>> k = words.entrySet().iterator();
+ indexWord wprop;
+ Map.Entry<String, indexWord> we;
while (k.hasNext()) {
we = k.next();
wprop = we.getValue();
@@ -242,7 +238,7 @@ public final class plasmaCondenser {
private void insertTextToWords(String text, int phrase, int flagpos, kelondroBitfield flagstemplate) {
String word;
- wordStatProp wprop;
+ indexWord wprop;
sievedWordsEnum wordenum;
try {
wordenum = new sievedWordsEnum(new ByteArrayInputStream(text.getBytes()), "UTF-8", 3);
@@ -252,8 +248,8 @@ public final class plasmaCondenser {
int pip = 0;
while (wordenum.hasMoreElements()) {
word = (new String((StringBuffer) wordenum.nextElement())).toLowerCase();
- wprop = (wordStatProp) words.get(word);
- if (wprop == null) wprop = new wordStatProp(0, pip, phrase);
+ wprop = (indexWord) words.get(word);
+ if (wprop == null) wprop = new indexWord(0, pip, phrase);
if (wprop.flags == null) wprop.flags = (kelondroBitfield) flagstemplate.clone();
wprop.flags.set(flagpos, true);
words.put(word, wprop);
@@ -271,35 +267,10 @@ public final class plasmaCondenser {
this.wordminsize = wordminsize;
this.wordcut = wordcut;
// analysis = new Properties();
- words = new TreeMap<String, wordStatProp>();
- sentences = new HashMap<StringBuffer, phraseStatProp>();
+ words = new TreeMap<String, indexWord>();
createCondensement(text, charset);
}
- // create a word hash
- public static final String word2hash(String word) {
- return kelondroBase64Order.enhancedCoder.encode(serverCodings.encodeMD5Raw(word.toLowerCase())).substring(0, yacySeedDB.commonHashLength);
- }
-
- public static final Set<String> words2hashSet(String[] words) {
- TreeSet<String> hashes = new TreeSet<String>(kelondroBase64Order.enhancedComparator);
- for (int i = 0; i < words.length; i++) hashes.add(word2hash(words[i]));
- return hashes;
- }
-
- public static final String words2hashString(String[] words) {
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < words.length; i++) sb.append(word2hash(words[i]));
- return new String(sb);
- }
-
- public static final TreeSet<String> words2hashes(Set<String> words) {
- Iterator<String> i = words.iterator();
- TreeSet<String> hashes = new TreeSet<String>(kelondroBase64Order.enhancedComparator);
- while (i.hasNext()) hashes.add(word2hash(i.next()));
- return hashes;
- }
-
public int excludeWords(TreeSet<String> stopwords) {
// subtracts the given stopwords from the word list
// the word list shrinkes. This returns the number of shrinked words
@@ -308,67 +279,10 @@ public final class plasmaCondenser {
return oldsize - words.size();
}
- public Map<String, wordStatProp> words() {
- // returns the words as word/wordStatProp relation map
+ public Map<String, indexWord> words() {
+ // returns the words as word/indexWord relation map
return words;
}
-
- public Map<StringBuffer, phraseStatProp> sentences() {
- return sentences;
- }
-
- public static class wordStatProp {
- // object carries statistics for words and sentences
-
- public int count; // number of occurrences
- public int posInText; // unique handle, is initialized with word position (excluding double occurring words)
- public int posInPhrase; // position of word in phrase
- public int numOfPhrase; // number of phrase. 'normal' phrases begin with number 100
- HashSet<Integer> hash; // a set of handles to all sentences where this word appears
- public kelondroBitfield flags; // the flag bits for each word
-
- public wordStatProp(int handle, int pip, int nop) {
- this.count = 1;
- this.posInText = handle;
- this.posInPhrase = pip;
- this.numOfPhrase = nop;
- this.hash = new HashSet<Integer>();
- this.flags = null;
- }
-
- public void inc() {
- count++;
- }
-
- public void check(int i) {
- hash.add(new Integer(i));
- }
-
- }
-
- public static class phraseStatProp {
- // object carries statistics for words and sentences
-
- public int count; // number of occurrences
- public int handle; // unique handle, is initialized with sentence counter
- private HashSet<Integer> hash; //
-
- public phraseStatProp(int handle) {
- this.count = 1;
- this.handle = handle;
- this.hash = new HashSet<Integer>();
- }
-
- public void inc() {
- count++;
- }
-
- public void check(int i) {
- hash.add(new Integer(i));
- }
-
- }
-
public String intString(int number, int length) {
String s = Integer.toString(number);
@@ -382,8 +296,8 @@ public final class plasmaCondenser {
String word = "";
String k;
int wordlen;
- wordStatProp wsp, wsp1;
- phraseStatProp psp;
+ indexWord wsp, wsp1;
+ indexPhrase psp;
int wordHandle;
int wordHandleCount = 0;
int sentenceHandleCount = 0;
@@ -394,6 +308,7 @@ public final class plasmaCondenser {
boolean comb_indexof = false, last_last = false, last_index = false;
RandomAccessFile fa;
final boolean dumpWords = false;
+ HashMap<StringBuffer, indexPhrase> sentences = new HashMap<StringBuffer, indexPhrase>();
if (dumpWords) try {
fa = new RandomAccessFile(new File("dump.txt"), "rw");
@@ -428,20 +343,20 @@ public final class plasmaCondenser {
sentence.insert(0, word); // append at beginning
if (sentences.containsKey(sentence)) {
// sentence already exists
- psp = (phraseStatProp) sentences.get(sentence);
+ psp = sentences.get(sentence);
psp.inc();
- idx = psp.handle;
+ idx = psp.handle();
sentences.put(sentence, psp);
} else {
// create new sentence
idx = sentenceHandleCount++;
- sentences.put(sentence, new phraseStatProp(idx));
+ sentences.put(sentence, new indexPhrase(idx));
}
// store to the words a link to this sentence
it = currsentwords.iterator();
while (it.hasNext()) {
k = (String) it.next();
- wsp = (wordStatProp) words.get(k);
+ wsp = (indexWord) words.get(k);
wsp.check(idx);
words.put(k, wsp);
}
@@ -464,13 +379,13 @@ public final class plasmaCondenser {
currsentwords.add(word);
if (words.containsKey(word)) {
// word already exists
- wsp = (wordStatProp) words.get(word);
+ wsp = (indexWord) words.get(word);
wordHandle = wsp.posInText;
wsp.inc();
} else {
// word does not yet exist, create new word entry
wordHandle = wordHandleCount++;
- wsp = new wordStatProp(wordHandle, wordInSentenceCounter, sentences.size() + 100);
+ wsp = new indexWord(wordHandle, wordInSentenceCounter, sentences.size() + 100);
wsp.flags = (kelondroBitfield) RESULT_FLAGS.clone();
}
words.put(word, wsp);
@@ -484,11 +399,11 @@ public final class plasmaCondenser {
allsentencecounter++;
sentence.insert(0, "."); // append at beginning
if (sentences.containsKey(sentence)) {
- psp = (phraseStatProp) sentences.get(sentence);
+ psp = (indexPhrase) sentences.get(sentence);
psp.inc();
sentences.put(sentence, psp);
} else {
- sentences.put(sentence, new phraseStatProp(sentenceHandleCount++));
+ sentences.put(sentence, new indexPhrase(sentenceHandleCount++));
}
}
@@ -515,21 +430,21 @@ public final class plasmaCondenser {
sentence = (StringBuffer) o;
wc = (sentence.length() - 1) / numlength;
s = new String[wc + 2];
- psp = (phraseStatProp) sentences.get(sentence);
- s[0] = intString(psp.count, numlength); // number of occurrences of this sentence
+ psp = (indexPhrase) sentences.get(sentence);
+ s[0] = intString(psp.occurrences(), numlength); // number of occurrences of this sentence
s[1] = sentence.substring(0, 1); // the termination symbol of this sentence
for (int i = 0; i < wc; i++) {
k = sentence.substring(i * numlength + 1, (i + 1) * numlength + 1);
s[i + 2] = k;
}
- orderedSentences[psp.handle] = s;
+ orderedSentences[psp.handle()] = s;
}
}
- Map.Entry<String, wordStatProp> entry;
+ Map.Entry<String, indexWord> entry;
// we search for similar words and reorganize the corresponding sentences
// a word is similar, if a shortened version is equal
- Iterator<Map.Entry<String, wordStatProp>> wi = words.entrySet().iterator(); // enumerates the keys in descending order
+ Iterator<Map.Entry<String, indexWord>> wi = words.entrySet().iterator(); // enumerates the keys in descending order
wordsearch: while (wi.hasNext()) {
entry = wi.next();
word = entry.getKey();
@@ -542,8 +457,8 @@ public final class plasmaCondenser {
// we will delete the word 'word' and repoint the
// corresponding links
// in sentences that use this word
- wsp1 = (wordStatProp) words.get(k);
- Iterator<Integer> it1 = wsp.hash.iterator(); // we iterate over all sentences that refer to this word
+ wsp1 = words.get(k);
+ Iterator<Integer> it1 = wsp.phrases(); // we iterate over all sentences that refer to this word
while (it1.hasNext()) {
idx = it1.next().intValue(); // number of a sentence
s = (String[]) orderedSentences[idx];
@@ -564,30 +479,6 @@ public final class plasmaCondenser {
}
}
- // depending on the orderedSentences structure, we rebuild the sentence
- // HashMap to eliminate double occurring sentences
- sentences = new HashMap<StringBuffer, phraseStatProp>();
- int le;
- for (int i = 0; i < orderedSentences.length; i++) {
- le = ((String[]) orderedSentences[i]).length;
- sentence = new StringBuffer(le * 10);
- for (int j = 1; j < le; j++)
- sentence.append(((String[]) orderedSentences[i])[j]);
- if (sentences.containsKey(sentence)) {
- // add sentence counter to counter of found sentence
- psp = sentences.get(sentence);
- psp.count = psp.count + Integer.parseInt(((String[]) orderedSentences[i])[0]);
- sentences.put(sentence, psp);
- // System.out.println("Found double occurring sentence " + i + "
- // = " + sp.handle);
- } else {
- // create new sentence entry
- psp = new phraseStatProp(i);
- psp.count = Integer.parseInt(((String[]) orderedSentences[i])[0]);
- sentences.put(sentence, psp);
- }
- }
-
// store result
//this.RESULT_NUMB_TEXT_BYTES = wordenum.count();
this.RESULT_NUMB_WORDS = allwordcounter;
@@ -596,79 +487,6 @@ public final class plasmaCondenser {
this.RESULT_DIFF_SENTENCES = sentenceHandleCount;
}
- public void print() {
- String[] s = sentenceReconstruction();
-
- // printout a reconstruction of the text
- for (int i = 0; i < s.length; i++) {
- if (s[i] != null) System.out.print("#T " + intString(i, numlength) + " " + s[i]);
- }
- }
-
- private String[] sentenceReconstruction() {
- // we reconstruct the word hashtable
- // and order the entries by the number of the sentence
- // this structure is only needed to reconstruct the text
- String word;
- wordStatProp wsp;
- Map.Entry<String, wordStatProp> entry;
- Iterator<Map.Entry<String, wordStatProp>> it;
- String[] orderedWords = new String[words.size() + 99]; // uuiiii, the '99' is only a quick hack...
- it = words.entrySet().iterator(); // enumerates the keys in ascending order
- while (it.hasNext()) {
- entry = it.next();
- word = entry.getKey();
- wsp = entry.getValue();
- orderedWords[wsp.posInText] = word;
- }
-
- Object[] orderedSentences = makeOrderedSentences();
-
- // create a reconstruction of the text
- String[] result = new String[orderedSentences.length];
- String s;
- for (int i = 0; i < orderedSentences.length; i++) {
- if (orderedSentences[i] != null) {
- // TODO: bugfix for UTF-8: avoid this form of string concatenation
- s = "";
- for (int j = 2; j < ((String[]) orderedSentences[i]).length; j++) {
- s += " " + orderedWords[Integer.parseInt(((String[]) orderedSentences[i])[j])];
- }
- s += ((String[]) orderedSentences[i])[1];
- result[i] = (s.length() > 1) ? s.substring(1) : s;
- } else {
- result[i] = "";
- }
- }
- return result;
- }
-
- private Object[] makeOrderedSentences() {
- // we reconstruct the sentence hashtable again and create by-handle ordered entries
- // this structure is needed to present the strings in the right order in a printout
- int wc;
- phraseStatProp psp;
- String[] s;
- StringBuffer sentence;
- Object[] orderedSentences = new Object[sentences.size()];
- for (int i = 0; i < sentences.size(); i++) {
- orderedSentences[i] = null; // this array must be initialized
- }
- Iterator<StringBuffer> it = sentences.keySet().iterator();
- while (it.hasNext()) {
- sentence = (StringBuffer) it.next();
- wc = (sentence.length() - 1) / numlength;
- s = new String[wc + 2];
- psp = (phraseStatProp) sentences.get(sentence);
- s[0] = intString(psp.count, numlength); // number of occurrences of this sentence
- s[1] = sentence.substring(0, 1); // the termination symbol of this sentence
- for (int i = 0; i < wc; i++)
- s[i + 2] = sentence.substring(i * numlength + 1, (i + 1) * numlength + 1);
- orderedSentences[psp.handle] = s;
- }
- return orderedSentences;
- }
-
public final static boolean invisible(char c) {
// TODO: Bugfix for UTF-8: does this work for non ISO-8859-1 chars?
if ((c < ' ') || (c > 'z')) return true;
@@ -900,15 +718,15 @@ public final class plasmaCondenser {
return s;
}
- public static Map<String, wordStatProp> getWords(byte[] text, String charset) throws UnsupportedEncodingException {
- // returns a word/wordStatProp relation map
+ public static Map<String, indexWord> getWords(byte[] text, String charset) throws UnsupportedEncodingException {
+ // returns a word/indexWord relation map
if (text == null) return null;
ByteArrayInputStream buffer = new ByteArrayInputStream(text);
return new plasmaCondenser(buffer, charset, 2, 1).words();
}
- public static Map<String, wordStatProp> getWords(String text) {
- // returns a word/wordStatProp relation map
+ public static Map<String, indexWord> getWords(String text) {
+ // returns a word/indexWord relation map
if (text == null) return null;
ByteArrayInputStream buffer = new ByteArrayInputStream(text.getBytes());
try {
@@ -931,7 +749,7 @@ public final class plasmaCondenser {
String s = p.getProperty("keywords" + i);
String[] l = s.split(",");
for (int j = 0; j < l.length; j++) {
- sb.append(word2hash(l[j]));
+ sb.append(indexWord.word2hash(l[j]));
}
if (i < 15) sb.append(",\n");
}
diff --git a/source/de/anomic/plasma/plasmaCrawlResults.java b/source/de/anomic/plasma/plasmaCrawlResults.java
index a480d7e11..6bf9ccc6e 100644
--- a/source/de/anomic/plasma/plasmaCrawlResults.java
+++ b/source/de/anomic/plasma/plasmaCrawlResults.java
@@ -54,7 +54,7 @@ package de.anomic.plasma;
import java.util.LinkedList;
-import de.anomic.index.indexURLEntry;
+import de.anomic.index.indexURLReference;
import de.anomic.yacy.yacySeedDB;
import de.anomic.yacy.yacyURL;
@@ -80,7 +80,7 @@ public final class plasmaCrawlResults {
gcrawlResultStack = new LinkedList<String>();
}
- public synchronized void stack(indexURLEntry e, String initiatorHash, String executorHash, int stackType) {
+ public synchronized void stack(indexURLReference e, String initiatorHash, String executorHash, int stackType) {
if (e == null) { return; }
try {
if (initiatorHash == null) { initiatorHash = yacyURL.dummyHash; }
diff --git a/source/de/anomic/plasma/plasmaCrawlStacker.java b/source/de/anomic/plasma/plasmaCrawlStacker.java
index 60ac46eaa..bc668c38c 100644
--- a/source/de/anomic/plasma/plasmaCrawlStacker.java
+++ b/source/de/anomic/plasma/plasmaCrawlStacker.java
@@ -55,7 +55,8 @@ import java.util.Date;
import java.util.Iterator;
import java.util.LinkedList;
-import de.anomic.index.indexURLEntry;
+import de.anomic.index.indexReferenceBlacklist;
+import de.anomic.index.indexURLReference;
import de.anomic.kelondro.kelondroCache;
import de.anomic.kelondro.kelondroEcoTable;
import de.anomic.kelondro.kelondroException;
@@ -63,7 +64,6 @@ import de.anomic.kelondro.kelondroIndex;
import de.anomic.kelondro.kelondroRow;
import de.anomic.kelondro.kelondroRowSet;
import de.anomic.kelondro.kelondroTree;
-import de.anomic.plasma.urlPattern.plasmaURLPattern;
import de.anomic.server.serverDomains;
import de.anomic.server.logging.serverLog;
import de.anomic.yacy.yacyCore;
@@ -393,7 +393,7 @@ public final class plasmaCrawlStacker extends Thread {
}
// check blacklist
- if (plasmaSwitchboard.urlBlacklist.isListed(plasmaURLPattern.BLACKLIST_CRAWLER, entry.url())) {
+ if (plasmaSwitchboard.urlBlacklist.isListed(indexReferenceBlacklist.BLACKLIST_CRAWLER, entry.url())) {
reason = plasmaCrawlEURL.DENIED_URL_IN_BLACKLIST;
this.log.logFine("URL '" + entry.url().toString() + "' is in blacklist. " +
"Stack processing time: " + (System.currentTimeMillis()-startTime) + "ms");
@@ -459,7 +459,7 @@ public final class plasmaCrawlStacker extends Thread {
// check if the url is double registered
String dbocc = sb.crawlQueues.urlExists(entry.url().hash());
- indexURLEntry oldEntry = this.sb.wordIndex.getURL(entry.url().hash(), null, 0);
+ indexURLReference oldEntry = this.sb.wordIndex.getURL(entry.url().hash(), null, 0);
boolean recrawl = (oldEntry != null) && ((System.currentTimeMillis() - oldEntry.loaddate().getTime()) > profile.recrawlIfOlder());
// do double-check
if ((dbocc != null) && (!recrawl)) {
diff --git a/source/de/anomic/plasma/plasmaDHTChunk.java b/source/de/anomic/plasma/plasmaDHTChunk.java
index d1a649041..6486f124b 100644
--- a/source/de/anomic/plasma/plasmaDHTChunk.java
+++ b/source/de/anomic/plasma/plasmaDHTChunk.java
@@ -53,7 +53,7 @@ import java.util.Iterator;
import de.anomic.index.indexContainer;
import de.anomic.index.indexRWIEntry;
import de.anomic.index.indexRWIRowEntry;
-import de.anomic.index.indexURLEntry;
+import de.anomic.index.indexURLReference;
import de.anomic.kelondro.kelondroBase64Order;
import de.anomic.kelondro.kelondroException;
import de.anomic.server.serverCodings;
@@ -79,7 +79,7 @@ public class plasmaDHTChunk {
private int status = chunkStatus_UNDEFINED;
private String startPointHash = "AAAAAAAAAAAA";
private indexContainer[] indexContainers = null;
- private HashMap<String, indexURLEntry> urlCache; // String (url-hash) / plasmaCrawlLURL.Entry
+ private HashMap<String, indexURLReference> urlCache; // String (url-hash) / plasmaCrawlLURL.Entry
private int idxCount;
private long selectionStartTime = 0;
@@ -115,7 +115,7 @@ public class plasmaDHTChunk {
return c;
}
- public HashMap<String, indexURLEntry> urlCacheMap() {
+ public HashMap<String, indexURLReference> urlCacheMap() {
return urlCache;
}
@@ -214,11 +214,11 @@ public class plasmaDHTChunk {
indexContainer container;
Iterator<indexRWIRowEntry> urlIter;
indexRWIRowEntry iEntry;
- indexURLEntry lurl;
+ indexURLReference lurl;
int refcount = 0;
int wholesize;
- urlCache = new HashMap<String, indexURLEntry>();
+ urlCache = new HashMap<String, indexURLReference>();
final double maximumDistance = ((double) peerRedundancy * 2) / ((double) yacyCore.seedDB.sizeConnected());
final long timeout = (maxtime < 0) ? Long.MAX_VALUE : System.currentTimeMillis() + maxtime;
while (
@@ -289,7 +289,7 @@ public class plasmaDHTChunk {
} catch (kelondroException e) {
log.logSevere("selectTransferIndexes database corrupted: " + e.getMessage(), e);
indexContainers = new indexContainer[0];
- urlCache = new HashMap<String, indexURLEntry>();
+ urlCache = new HashMap<String, indexURLReference>();
this.status = chunkStatus_FAILED;
return 0;
}
diff --git a/source/de/anomic/plasma/plasmaSearchAPI.java b/source/de/anomic/plasma/plasmaSearchAPI.java
index f5ae147ae..e84d32753 100644
--- a/source/de/anomic/plasma/plasmaSearchAPI.java
+++ b/source/de/anomic/plasma/plasmaSearchAPI.java
@@ -33,9 +33,9 @@ import java.util.Iterator;
import de.anomic.data.listManager;
import de.anomic.index.indexRWIEntry;
-import de.anomic.index.indexURLEntry;
+import de.anomic.index.indexReferenceBlacklist;
+import de.anomic.index.indexURLReference;
import de.anomic.kelondro.kelondroBitfield;
-import de.anomic.plasma.urlPattern.plasmaURLPattern;
import de.anomic.server.serverDate;
import de.anomic.server.serverObjects;
import de.anomic.yacy.yacyCore;
@@ -129,7 +129,7 @@ public class plasmaSearchAPI {
prop.put("genUrlList_lines", maxlines);
int i = 0;
yacyURL url;
- indexURLEntry entry;
+ indexURLReference entry;
String us;
long rn = -1;
while ((ranked.size() > 0) && ((entry = ranked.bestURL(false)) != null)) {
@@ -177,7 +177,7 @@ public class plasmaSearchAPI {
((entry.word().flags().get(indexRWIEntry.flag_app_emphasized)) ? "appears emphasized, " : "") +
((yacyURL.probablyRootURL(entry.word().urlHash())) ? "probably root url" : "")
);
- if (plasmaSwitchboard.urlBlacklist.isListed(plasmaURLPattern.BLACKLIST_DHT, url)) {
+ if (plasmaSwitchboard.urlBlacklist.isListed(indexReferenceBlacklist.BLACKLIST_DHT, url)) {
prop.put("genUrlList_urlList_"+i+"_urlExists_urlhxChecked", "1");
}
i++;
diff --git a/source/de/anomic/plasma/plasmaSearchEvent.java b/source/de/anomic/plasma/plasmaSearchEvent.java
index bcd1e7d34..9065331e9 100644
--- a/source/de/anomic/plasma/plasmaSearchEvent.java
+++ b/source/de/anomic/plasma/plasmaSearchEvent.java
@@ -39,7 +39,7 @@ import java.util.TreeSet;
import de.anomic.index.indexContainer;
import de.anomic.index.indexRWIEntry;
import de.anomic.index.indexRWIVarEntry;
-import de.anomic.index.indexURLEntry;
+import de.anomic.index.indexURLReference;
import de.anomic.kelondro.kelondroBitfield;
import de.anomic.kelondro.kelondroMSetTools;
import de.anomic.kelondro.kelondroSortStack;
@@ -208,7 +208,7 @@ public final class plasmaSearchEvent {
} else {
// prepare result vector directly without worker threads
long timer = System.currentTimeMillis();
- indexURLEntry uentry;
+ indexURLReference uentry;
ResultEntry resultEntry;
yacyURL url;
synchronized (rankedCache) {
@@ -276,7 +276,7 @@ public final class plasmaSearchEvent {
}
}
- ResultEntry obtainResultEntry(indexURLEntry page, int snippetFetchMode) {
+ ResultEntry obtainResultEntry(indexURLReference page, int snippetFetchMode) {
// a search result entry needs some work to produce a result Entry:
// - check if url entry exists in LURL-db
@@ -292,7 +292,7 @@ public final class plasmaSearchEvent {
// find the url entry
long startTime = System.currentTimeMillis();
- indexURLEntry.Components comp = page.comp();
+ indexURLReference.Components comp = page.comp();
String pagetitle = comp.dc_title().toLowerCase();
if (comp.url() == null) {
registerFailure(page.hash(), "url corrupted (null)");
@@ -521,7 +521,7 @@ public final class plasmaSearchEvent {
public void run() {
// start fetching urls and snippets
- indexURLEntry page;
+ indexURLReference page;
while (System.currentTimeMillis() < this.timeout) {
this.lastLifeSign = System.currentTimeMillis();
@@ -767,8 +767,8 @@ public final class plasmaSearchEvent {
public static class ResultEntry {
// payload objects
- private indexURLEntry urlentry;
- private indexURLEntry.Components urlcomps; // buffer for components
+ private indexURLReference urlentry;
+ private indexURLReference.Components urlcomps; // buffer for components
private String alternative_urlstring;
private String alternative_urlname;
private plasmaSnippetCache.TextSnippet textSnippet;
@@ -777,7 +777,7 @@ public final class plasmaSearchEvent {
// statistic objects
public long dbRetrievalTime, snippetComputationTime;
- public ResultEntry(indexURLEntry urlentry, plasmaWordIndex wordIndex,
+ public ResultEntry(indexURLReference urlentry, plasmaWordIndex wordIndex,
plasmaSnippetCache.TextSnippet textSnippet,
ArrayList<plasmaSnippetCache.MediaSnippet> mediaSnippets,
long dbRetrievalTime, long snippetComputationTime) {
diff --git a/source/de/anomic/plasma/plasmaSearchQuery.java b/source/de/anomic/plasma/plasmaSearchQuery.java
index 4f7a49f95..dac5ff0df 100644
--- a/source/de/anomic/plasma/plasmaSearchQuery.java
+++ b/source/de/anomic/plasma/plasmaSearchQuery.java
@@ -47,6 +47,7 @@ import java.util.Set;
import java.util.TreeSet;
import de.anomic.htmlFilter.htmlFilterAbstractScraper;
+import de.anomic.index.indexWord;
import de.anomic.kelondro.kelondroBase64Order;
import de.anomic.kelondro.kelondroBitfield;
import de.anomic.kelondro.kelondroMSetTools;
@@ -107,8 +108,8 @@ public final class plasmaSearchQuery {
} else {
this.queryString = queryString;
TreeSet<String>[] cq = cleanQuery(queryString);
- this.queryHashes = plasmaCondenser.words2hashes(cq[0]);
- this.excludeHashes = plasmaCondenser.words2hashes(cq[1]);
+ this.queryHashes = indexWord.words2hashes(cq[0]);
+ this.excludeHashes = indexWord.words2hashes(cq[1]);
}
this.ranking = ranking;
this.maxDistance = Integer.MAX_VALUE;
@@ -233,7 +234,7 @@ public final class plasmaSearchQuery {
public static final boolean matches(String text, TreeSet<String> keyhashes) {
// returns true if any of the word hashes in keyhashes appear in the String text
// to do this, all words in the string must be recognized and transcoded to word hashes
- TreeSet<String> wordhashes = plasmaCondenser.words2hashes(plasmaCondenser.getWords(text).keySet());
+ TreeSet<String> wordhashes = indexWord.words2hashes(plasmaCondenser.getWords(text).keySet());
return kelondroMSetTools.anymatch(wordhashes, keyhashes);
}
@@ -282,16 +283,16 @@ public final class plasmaSearchQuery {
public void filterOut(Set<String> blueList) {
// filter out words that appear in this set
// this is applied to the queryHashes
- TreeSet<String> blues = plasmaCondenser.words2hashes(blueList);
+ TreeSet<String> blues = indexWord.words2hashes(blueList);
kelondroMSetTools.excludeDestructive(queryHashes, blues);
}
public String id(boolean anonymized) {
// generate a string that identifies a search so results can be re-used in a cache
if (anonymized) {
- return anonymizedQueryHashes(this.queryHashes) + "-" + anonymizedQueryHashes(this.excludeHashes) + "*" + this.contentdom + "*" + this.zonecode + "*" + plasmaCondenser.word2hash(this.ranking.toExternalString());
+ return anonymizedQueryHashes(this.queryHashes) + "-" + anonymizedQueryHashes(this.excludeHashes) + "*" + this.contentdom + "*" + this.zonecode + "*" + indexWord.word2hash(this.ranking.toExternalString());
} else {
- return hashSet2hashString(this.queryHashes) + "-" + hashSet2hashString(this.excludeHashes) + "*" + this.contentdom + "*" + this.zonecode + "*" + plasmaCondenser.word2hash(this.ranking.toExternalString());
+ return hashSet2hashString(this.queryHashes) + "-" + hashSet2hashString(this.excludeHashes) + "*" + this.contentdom + "*" + this.zonecode + "*" + indexWord.word2hash(this.ranking.toExternalString());
}
}
diff --git a/source/de/anomic/plasma/plasmaSearchRankingProcess.java b/source/de/anomic/plasma/plasmaSearchRankingProcess.java
index d9245fa5b..bad0fcb43 100644
--- a/source/de/anomic/plasma/plasmaSearchRankingProcess.java
+++ b/source/de/anomic/plasma/plasmaSearchRankingProcess.java
@@ -41,7 +41,8 @@ import de.anomic.index.indexContainer;
import de.anomic.index.indexRWIEntry;
import de.anomic.index.indexRWIEntryOrder;
import de.anomic.index.indexRWIVarEntry;
-import de.anomic.index.indexURLEntry;
+import de.anomic.index.indexURLReference;
+import de.anomic.index.indexWord;
import de.anomic.kelondro.kelondroBinSearch;
import de.anomic.kelondro.kelondroMScoreCluster;
import de.anomic.kelondro.kelondroSortStack;
@@ -288,13 +289,13 @@ public final class plasmaSearchRankingProcess {
return bestEntry;
}
- public synchronized indexURLEntry bestURL(boolean skipDoubleDom) {
+ public synchronized indexURLReference bestURL(boolean skipDoubleDom) {
// returns from the current RWI list the best URL entry and removed this entry from the list
while ((stack.size() > 0) || (size() > 0)) {
kelondroSortStack<indexRWIVarEntry>.stackElement obrwi = bestRWI(skipDoubleDom);
- indexURLEntry u = wordIndex.getURL(obrwi.element.urlHash(), obrwi.element, obrwi.weight.longValue());
+ indexURLReference u = wordIndex.getURL(obrwi.element.urlHash(), obrwi.element, obrwi.weight.longValue());
if (u != null) {
- indexURLEntry.Components comp = u.comp();
+ indexURLReference.Components comp = u.comp();
if (comp.url() != null) this.handover.put(u.hash(), comp.url().toNormalform(true, false)); // remember that we handed over this url
return u;
}
@@ -370,7 +371,7 @@ public final class plasmaSearchRankingProcess {
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(plasmaCondenser.word2hash(word)))))
+ (!(query.queryHashes.contains(indexWord.word2hash(word)))))
ref.incScore(word);
}
}
@@ -470,8 +471,8 @@ public final class plasmaSearchRankingProcess {
}
// apply query-in-result matching
- Set<String> urlcomph = plasmaCondenser.words2hashSet(urlcomps);
- Set<String> descrcomph = plasmaCondenser.words2hashSet(descrcomps);
+ Set<String> urlcomph = indexWord.words2hashSet(urlcomps);
+ Set<String> descrcomph = indexWord.words2hashSet(descrcomps);
Iterator<String> shi = query.queryHashes.iterator();
String queryhash;
while (shi.hasNext()) {
diff --git a/source/de/anomic/plasma/plasmaSnippetCache.java b/source/de/anomic/plasma/plasmaSnippetCache.java
index 0eae70318..2067dc924 100644
--- a/source/de/anomic/plasma/plasmaSnippetCache.java
+++ b/source/de/anomic/plasma/plasmaSnippetCache.java
@@ -59,7 +59,8 @@ import java.util.TreeSet;
import de.anomic.htmlFilter.htmlFilterImageEntry;
import de.anomic.http.httpHeader;
import de.anomic.http.httpc;
-import de.anomic.index.indexURLEntry;
+import de.anomic.index.indexURLReference;
+import de.anomic.index.indexWord;
import de.anomic.kelondro.kelondroMScoreCluster;
import de.anomic.kelondro.kelondroMSetTools;
import de.anomic.plasma.cache.IResourceInfo;
@@ -193,14 +194,14 @@ public class plasmaSnippetCache {
for(int k=0; k < w[j].length(); k++) {
//is character a special character?
if(w[j].substring(k,k+1).matches("[^\\p{L}\\p{N}]")) {
- if (plasmaCondenser.word2hash(temp).equals(h)) temp = "<b>" + temp + "</b>";
+ if (indexWord.word2hash(temp).equals(h)) temp = "<b>" + temp + "</b>";
out = out + temp + w[j].substring(k,k+1);
temp = "";
}
//last character
else if(k == (w[j].length()-1)) {
temp = temp + w[j].substring(k,k+1);
- if (plasmaCondenser.word2hash(temp).equals(h)) temp = "<b>" + temp + "</b>";
+ if (indexWord.word2hash(temp).equals(h)) temp = "<b>" + temp + "</b>";
out = out + temp;
temp = "";
}
@@ -210,7 +211,7 @@ public class plasmaSnippetCache {
}
//end contrib [MN]
- else if (plasmaCondenser.word2hash(w[j]).equals(h)) w[j] = "<b>" + w[j] + "</b>";
+ else if (indexWord.word2hash(w[j]).equals(h)) w[j] = "<b>" + w[j] + "</b>";
w[j] = prefix + w[j] + postfix;
}
@@ -254,7 +255,7 @@ public class plasmaSnippetCache {
}
@SuppressWarnings("unchecked")
- public static TextSnippet retrieveTextSnippet(indexURLEntry.Components comp, Set<String> queryhashes, boolean fetchOnline, boolean pre, int snippetMaxLength, int timeout, int maxDocLen) {
+ public static TextSnippet retrieveTextSnippet(indexURLReference.Components comp, Set<String> queryhashes, boolean fetchOnline, boolean pre, int snippetMaxLength, int timeout, int maxDocLen) {
// heise = "0OQUNU3JSs05"
yacyURL url = comp.url();
if (queryhashes.size() == 0) {
@@ -754,7 +755,7 @@ public class plasmaSnippetCache {
String hash;
while (words.hasMoreElements()) {
word = words.nextElement();
- hash = plasmaCondenser.word2hash(new String(word));
+ hash = indexWord.word2hash(new String(word));
if (!map.containsKey(hash)) map.put(hash, new Integer(pos)); // dont overwrite old values, that leads to too far word distances
pos += word.length() + 1;
}
diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.java
index 556a52c5a..5b9660e97 100644
--- a/source/de/anomic/plasma/plasmaSwitchboard.java
+++ b/source/de/anomic/plasma/plasmaSwitchboard.java
@@ -122,7 +122,9 @@ import de.anomic.http.httpRemoteProxyConfig;
import de.anomic.http.httpc;
import de.anomic.http.httpd;
import de.anomic.http.httpdRobotsTxtConfig;
-import de.anomic.index.indexURLEntry;
+import de.anomic.index.indexDefaultReferenceBlacklist;
+import de.anomic.index.indexReferenceBlacklist;
+import de.anomic.index.indexURLReference;
import de.anomic.kelondro.kelondroBitfield;
import de.anomic.kelondro.kelondroCache;
import de.anomic.kelondro.kelondroCachedRecords;
@@ -134,8 +136,6 @@ import de.anomic.plasma.crawler.plasmaCrawlQueues;
import de.anomic.plasma.crawler.plasmaProtocolLoader;
import de.anomic.plasma.dbImport.dbImportManager;
import de.anomic.plasma.parser.ParserException;
-import de.anomic.plasma.urlPattern.defaultURLPattern;
-import de.anomic.plasma.urlPattern.plasmaURLPattern;
import de.anomic.server.serverAbstractSwitch;
import de.anomic.server.serverDomains;
import de.anomic.server.serverFileUtils;
@@ -179,7 +179,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<plasmaSwitchbo
public static TreeSet<String> badwords = null;
public static TreeSet<String> blueList = null;
public static TreeSet<String> stopwords = null;
- public static plasmaURLPattern urlBlacklist;
+ public static indexReferenceBlacklist urlBlacklist;
public static wikiParser wikiParser = null;
@@ -677,11 +677,11 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<plasmaSwitchbo
public static final String BLACKLIST_CLASS = "BlackLists.class";
/**
* <p><code>public static final String <strong>BLACKLIST_CLASS_DEFAULT</strong> = "de.anomic.plasma.urlPattern.defaultURLPattern"</code></p>
- * <p>Package and name of YaCy's {@link defaultURLPattern default} blacklist implementation</p>
+ * <p>Package and name of YaCy's {@link indexDefaultReferenceBlacklist default} blacklist implementation</p>
*
- * @see defaultURLPattern for a detailed overview about the syntax of the default implementation
+ * @see indexDefaultReferenceBlacklist for a detailed overview about the syntax of the default implementation
*/
- public static final String BLACKLIST_CLASS_DEFAULT = "de.anomic.plasma.urlPattern.defaultURLPattern";
+ public static final String BLACKLIST_CLASS_DEFAULT = "de.anomic.index.indexDefaultReferenceBlacklist";
public static final String LIST_BLUE = "plasmaBlueList";
public static final String LIST_BLUE_DEFAULT = null;
@@ -990,12 +990,17 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<plasmaSwitchbo
// load the black-list / inspired by [AS]
File blacklistsPath = getConfigPath(LISTS_PATH, LISTS_PATH_DEFAULT);
String blacklistClassName = getConfig(BLACKLIST_CLASS, BLACKLIST_CLASS_DEFAULT);
-
+ if (blacklistClassName.equals("de.anomic.plasma.urlPattern.defaultURLPattern")) {
+ // patch old class location
+ blacklistClassName = BLACKLIST_CLASS_DEFAULT;
+ setConfig(BLACKLIST_CLASS, blacklistClassName);
+ }
+
this.log.logConfig("Starting blacklist engine ...");
try {
Class<?> blacklistClass = Class.forName(blacklistClassName);
Constructor<?> blacklistClassConstr = blacklistClass.getConstructor( new Class[] { File.class } );
- urlBlacklist = (plasmaURLPattern) blacklistClassConstr.newInstance(new Object[] { blacklistsPath });
+ urlBlacklist = (indexReferenceBlacklist) blacklistClassConstr.newInstance(new Object[] { blacklistsPath });
this.log.logFine("Used blacklist engine class: " + blacklistClassName);
this.log.logConfig("Using blacklist engine: " + urlBlacklist.getEngineInfo());
} catch (Exception e) {
@@ -1459,7 +1464,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<plasmaSwitchbo
if (urlhash.equals(yacyURL.dummyHash)) return null;
yacyURL ne = crawlQueues.getURL(urlhash);
if (ne != null) return ne;
- indexURLEntry le = wordIndex.getURL(urlhash, null, 0);
+ indexURLReference le = wordIndex.getURL(urlhash, null, 0);
if (le != null) return le.comp().url();
return null;
}
@@ -2241,7 +2246,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<plasmaSwitchbo
// create a new loaded URL db entry
long ldate = System.currentTimeMillis();
- indexURLEntry newEntry = new indexURLEntry(
+ indexURLReference newEntry = new indexURLReference(
entry.url(), // URL
dc_title, // document description
document.dc_creator(), // author
@@ -2377,9 +2382,9 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<plasmaSwitchbo
// finally, delete the url entry
// determine the url string
- indexURLEntry entry = wordIndex.getURL(urlhash, null, 0);
+ indexURLReference entry = wordIndex.getURL(urlhash, null, 0);
if (entry == null) return 0;
- indexURLEntry.Components comp = entry.comp();
+ indexURLReference.Components comp = entry.comp();
if (comp.url() == null) return 0;
InputStream resourceContent = null;
diff --git a/source/de/anomic/plasma/plasmaSwitchboardQueue.java b/source/de/anomic/plasma/plasmaSwitchboardQueue.java
index fb5605028..4ac1018b0 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.Date;
import java.util.Iterator;
-import de.anomic.index.indexURLEntry;
+import de.anomic.index.indexURLReference;
import de.anomic.kelondro.kelondroBase64Order;
import de.anomic.kelondro.kelondroNaturalOrder;
import de.anomic.kelondro.kelondroRow;
@@ -341,7 +341,7 @@ public class plasmaSwitchboardQueue {
public yacyURL referrerURL() {
if (referrerURL == null) {
if ((referrerHash == null) || (referrerHash.equals(yacyURL.dummyHash))) return null;
- indexURLEntry entry = index.getURL(referrerHash, null, 0);
+ indexURLReference entry = index.getURL(referrerHash, null, 0);
if (entry == null) referrerURL = null; else referrerURL = entry.comp().url();
}
return referrerURL;
diff --git a/source/de/anomic/plasma/plasmaWordIndex.java b/source/de/anomic/plasma/plasmaWordIndex.java
index c5feed5cf..f2c032940 100644
--- a/source/de/anomic/plasma/plasmaWordIndex.java
+++ b/source/de/anomic/plasma/plasmaWordIndex.java
@@ -45,8 +45,10 @@ import de.anomic.index.indexRAMRI;
import de.anomic.index.indexRI;
import de.anomic.index.indexRWIEntry;
import de.anomic.index.indexRWIRowEntry;
+import de.anomic.index.indexReferenceBlacklist;
import de.anomic.index.indexRepositoryReference;
-import de.anomic.index.indexURLEntry;
+import de.anomic.index.indexURLReference;
+import de.anomic.index.indexWord;
import de.anomic.index.indexRepositoryReference.Export;
import de.anomic.kelondro.kelondroBase64Order;
import de.anomic.kelondro.kelondroByteOrder;
@@ -55,7 +57,6 @@ import de.anomic.kelondro.kelondroMergeIterator;
import de.anomic.kelondro.kelondroOrder;
import de.anomic.kelondro.kelondroRotateIterator;
import de.anomic.kelondro.kelondroRowSet;
-import de.anomic.plasma.urlPattern.plasmaURLPattern;
import de.anomic.server.serverMemory;
import de.anomic.server.logging.serverLog;
import de.anomic.yacy.yacyDHTAction;
@@ -112,11 +113,11 @@ public final class plasmaWordIndex implements indexRI {
this.flushsize = 2000;
}
- public void putURL(indexURLEntry entry) throws IOException {
+ public void putURL(indexURLReference entry) throws IOException {
this.referenceURL.store(entry);
}
- public indexURLEntry getURL(String urlHash, indexRWIEntry searchedWord, long ranking) {
+ public indexURLReference getURL(String urlHash, indexRWIEntry searchedWord, long ranking) {
return this.referenceURL.load(urlHash, searchedWord, ranking);
}
@@ -140,11 +141,11 @@ public final class plasmaWordIndex implements indexRI {
return this.referenceURL.export();
}
- public kelondroCloneableIterator<indexURLEntry> entriesURL(boolean up, String firstHash) throws IOException {
+ public kelondroCloneableIterator<indexURLReference> entriesURL(boolean up, String firstHash) throws IOException {
return this.referenceURL.entries(up, firstHash);
}
- public indexRepositoryReference.BlacklistCleaner getURLCleaner(plasmaURLPattern blacklist) {
+ public indexRepositoryReference.BlacklistCleaner getURLCleaner(indexReferenceBlacklist blacklist) {
return this.referenceURL.getBlacklistCleaner(blacklist); // thread is not already started after this is called!
}
@@ -354,11 +355,11 @@ public final class plasmaWordIndex implements indexRI {
int urlComps = htmlFilterContentScraper.urlComps(url.toString()).length;
// iterate over all words of context text
- Iterator<Map.Entry<String, plasmaCondenser.wordStatProp>> i = condenser.words().entrySet().iterator();
- Map.Entry<String, plasmaCondenser.wordStatProp> wentry;
+ Iterator<Map.Entry<String, indexWord>> i = condenser.words().entrySet().iterator();
+ Map.Entry<String, indexWord> wentry;
String word;
indexRWIRowEntry ientry;
- plasmaCondenser.wordStatProp wprop;
+ indexWord wprop;
while (i.hasNext()) {
wentry = i.next();
word = wentry.getKey();
@@ -367,8 +368,8 @@ public final class plasmaWordIndex implements indexRI {
ientry = new indexRWIRowEntry(url.hash(),
urlLength, urlComps, (document == null) ? urlLength : document.dc_title().length(),
wprop.count,
- condenser.words().size(),
- condenser.sentences().size(),
+ condenser.RESULT_NUMB_WORDS,
+ condenser.RESULT_NUMB_SENTENCES,
wprop.posInText,
wprop.posInPhrase,
wprop.numOfPhrase,
@@ -378,7 +379,7 @@ public final class plasmaWordIndex implements indexRI {
doctype,
outlinksSame, outlinksOther,
wprop.flags);
- addEntry(plasmaCondenser.word2hash(word), ientry, System.currentTimeMillis(), false);
+ addEntry(indexWord.word2hash(word), ientry, System.currentTimeMillis(), false);
wordCount++;
}
@@ -564,7 +565,7 @@ public final class plasmaWordIndex implements indexRI {
int count = 0;
while (iter.hasNext()) {
// delete the URL reference in this word index
- if (removeEntry(plasmaCondenser.word2hash((String) iter.next()), urlhash)) count++;
+ if (removeEntry(indexWord.word2hash((String) iter.next()), urlhash)) count++;
}
return count;
}
@@ -664,12 +665,12 @@ public final class plasmaWordIndex implements indexRI {
entry = containerIterator.next();
// System.out.println("Wordhash: "+wordHash+" UrlHash:
// "+entry.getUrlHash());
- indexURLEntry ue = referenceURL.load(entry.urlHash(), entry, 0);
+ indexURLReference ue = referenceURL.load(entry.urlHash(), entry, 0);
if (ue == null) {
urlHashs.add(entry.urlHash());
} else {
url = ue.comp().url();
- if ((url == null) || (plasmaSwitchboard.urlBlacklist.isListed(plasmaURLPattern.BLACKLIST_CRAWLER, url) == true)) {
+ if ((url == null) || (plasmaSwitchboard.urlBlacklist.isListed(indexReferenceBlacklist.BLACKLIST_CRAWLER, url) == true)) {
urlHashs.add(entry.urlHash());
}
}
diff --git a/source/de/anomic/yacy/yacyClient.java b/source/de/anomic/yacy/yacyClient.java
index d77031084..aeff6332b 100644
--- a/source/de/anomic/yacy/yacyClient.java
+++ b/source/de/anomic/yacy/yacyClient.java
@@ -57,17 +57,17 @@ import de.anomic.http.httpc;
import de.anomic.index.indexContainer;
import de.anomic.index.indexRWIEntry;
import de.anomic.index.indexRWIRowEntry;
-import de.anomic.index.indexURLEntry;
+import de.anomic.index.indexReferenceBlacklist;
+import de.anomic.index.indexURLReference;
+import de.anomic.index.indexWord;
import de.anomic.kelondro.kelondroBase64Order;
import de.anomic.kelondro.kelondroBitfield;
-import de.anomic.plasma.plasmaCondenser;
import de.anomic.plasma.plasmaCrawlResults;
import de.anomic.plasma.plasmaSearchRankingProcess;
import de.anomic.plasma.plasmaSearchRankingProfile;
import de.anomic.plasma.plasmaSnippetCache;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.plasma.plasmaWordIndex;
-import de.anomic.plasma.urlPattern.plasmaURLPattern;
import de.anomic.server.serverByteBuffer;
import de.anomic.server.serverCodings;
import de.anomic.server.serverCore;
@@ -391,7 +391,7 @@ public final class yacyClient {
plasmaCrawlResults crawlResults,
plasmaSearchRankingProcess containerCache,
Map<String, TreeMap<String, String>> abstractCache,
- plasmaURLPattern blacklist,
+ indexReferenceBlacklist blacklist,
plasmaSearchRankingProfile rankingProfile,
kelondroBitfield constraint
) {
@@ -500,16 +500,16 @@ public final class yacyClient {
}
// insert results to containers
- indexURLEntry urlEntry;
+ indexURLReference urlEntry;
String[] urls = new String[results];
for (int n = 0; n < results; n++) {
// get one single search result
- urlEntry = indexURLEntry.importEntry((String) result.get("resource" + n));
+ urlEntry = indexURLReference.importEntry((String) result.get("resource" + n));
if (urlEntry == null) continue;
assert (urlEntry.hash().length() == 12) : "urlEntry.hash() = " + urlEntry.hash();
if (urlEntry.hash().length() != 12) continue; // bad url hash
- indexURLEntry.Components comp = urlEntry.comp();
- if (blacklist.isListed(plasmaURLPattern.BLACKLIST_SEARCH, comp.url())) {
+ indexURLReference.Components comp = urlEntry.comp();
+ if (blacklist.isListed(indexReferenceBlacklist.BLACKLIST_SEARCH, comp.url())) {
yacyCore.log.logInfo("remote search (client): filtered blacklisted url " + comp.url() + " from peer " + target.getName());
continue; // block with backlist
}
@@ -796,7 +796,7 @@ public final class yacyClient {
return "wrong protocol: " + protocol;
}
- public static HashMap<String, String> crawlReceipt(yacySeed target, String process, String result, String reason, indexURLEntry entry, String wordhashes) {
+ public static HashMap<String, String> crawlReceipt(yacySeed target, String process, String result, String reason, indexURLReference entry, String wordhashes) {
assert (target != null);
assert (yacyCore.seedDB.mySeed() != null);
assert (yacyCore.seedDB.mySeed() != target);
@@ -854,7 +854,7 @@ public final class yacyClient {
}
}
- public static HashMap<String, Object> transferIndex(yacySeed targetSeed, indexContainer[] indexes, HashMap<String, indexURLEntry> urlCache, boolean gzipBody, int timeout) {
+ public static HashMap<String, Object> transferIndex(yacySeed targetSeed, indexContainer[] indexes, HashMap<String, indexURLReference> urlCache, boolean gzipBody, int timeout) {
HashMap<String, Object> resultObj = new HashMap<String, Object>();
int payloadSize = 0;
@@ -907,9 +907,9 @@ public final class yacyClient {
if (uhs.length == 0) { return resultObj; } // all url's known
// extract the urlCache from the result
- indexURLEntry[] urls = new indexURLEntry[uhs.length];
+ indexURLReference[] urls = new indexURLReference[uhs.length];
for (int i = 0; i < uhs.length; i++) {
- urls[i] = (indexURLEntry) urlCache.get(uhs[i]);
+ urls[i] = (indexURLReference) urlCache.get(uhs[i]);
if (urls[i] == null) {
yacyCore.log.logFine("DEBUG transferIndex: requested url hash '" + uhs[i] + "', unknownURL='" + uhss + "'");
}
@@ -1009,7 +1009,7 @@ public final class yacyClient {
}
}
- private static HashMap<String, String> transferURL(yacySeed targetSeed, indexURLEntry[] urls, boolean gzipBody, int timeout) {
+ private static HashMap<String, String> transferURL(yacySeed targetSeed, indexURLReference[] urls, boolean gzipBody, int timeout) {
// this post a message to the remote message board
final String address = targetSeed.getPublicAddress();
if (address == null) { return null; }
@@ -1100,7 +1100,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 = plasmaCondenser.word2hash("test");
+ final String wordhashe = indexWord.word2hash("test");
//System.out.println("permission=" + permissionMessage(args[1]));
// should we use the proxy?
diff --git a/source/de/anomic/yacy/yacyNewsPool.java b/source/de/anomic/yacy/yacyNewsPool.java
index e4f99dc77..c7464d429 100644
--- a/source/de/anomic/yacy/yacyNewsPool.java
+++ b/source/de/anomic/yacy/yacyNewsPool.java
@@ -50,8 +50,8 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
+import de.anomic.index.indexReferenceBlacklist;
import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.urlPattern.plasmaURLPattern;
public class yacyNewsPool {
@@ -325,13 +325,13 @@ public class yacyNewsPool {
if (record.created().getTime() == 0) return;
Map<String, String> attributes = record.attributes();
if (attributes.containsKey("url")){
- if (plasmaSwitchboard.urlBlacklist.isListed(plasmaURLPattern.BLACKLIST_NEWS, new yacyURL((String) attributes.get("url"), null))){
+ if (plasmaSwitchboard.urlBlacklist.isListed(indexReferenceBlacklist.BLACKLIST_NEWS, new yacyURL((String) attributes.get("url"), null))){
System.out.println("DEBUG: ignored news-entry url blacklisted: " + attributes.get("url"));
return;
}
}
if (attributes.containsKey("startURL")){
- if (plasmaSwitchboard.urlBlacklist.isListed(plasmaURLPattern.BLACKLIST_NEWS, new yacyURL((String) attributes.get("startURL"), null))){
+ if (plasmaSwitchboard.urlBlacklist.isListed(indexReferenceBlacklist.BLACKLIST_NEWS, new yacyURL((String) attributes.get("startURL"), null))){
System.out.println("DEBUG: ignored news-entry url blacklisted: " + attributes.get("startURL"));
return;
}
diff --git a/source/de/anomic/yacy/yacySearch.java b/source/de/anomic/yacy/yacySearch.java
index 705c0b13f..878695c5e 100644
--- a/source/de/anomic/yacy/yacySearch.java
+++ b/source/de/anomic/yacy/yacySearch.java
@@ -50,6 +50,7 @@ import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
+import de.anomic.index.indexReferenceBlacklist;
import de.anomic.kelondro.kelondroBitfield;
import de.anomic.kelondro.kelondroMScoreCluster;
import de.anomic.plasma.plasmaCrawlResults;
@@ -57,7 +58,6 @@ import de.anomic.plasma.plasmaSearchRankingProcess;
import de.anomic.plasma.plasmaSearchQuery;
import de.anomic.plasma.plasmaSearchRankingProfile;
import de.anomic.plasma.plasmaWordIndex;
-import de.anomic.plasma.urlPattern.plasmaURLPattern;
import de.anomic.server.logging.serverLog;
public class yacySearch extends Thread {
@@ -68,7 +68,7 @@ public class yacySearch extends Thread {
final private plasmaWordIndex wordIndex;
final private plasmaSearchRankingProcess containerCache;
final private Map<String, TreeMap<String, String>> abstractCache;
- final private plasmaURLPattern blacklist;
+ final private indexReferenceBlacklist blacklist;
final private yacySeed targetPeer;
private String[] urls;
private int count, maxDistance;
@@ -82,7 +82,7 @@ public class yacySearch extends Thread {
plasmaCrawlResults crawlResults,
plasmaSearchRankingProcess containerCache,
Map<String, TreeMap<String, String>> abstractCache,
- plasmaURLPattern blacklist,
+ indexReferenceBlacklist blacklist,
plasmaSearchRankingProfile rankingProfile,
kelondroBitfield constraint) {
super("yacySearch_" + targetPeer.getName());
@@ -256,7 +256,7 @@ public class yacySearch extends Thread {
plasmaSearchRankingProcess containerCache,
Map<String, TreeMap<String, String>> abstractCache,
int targets,
- plasmaURLPattern blacklist,
+ indexReferenceBlacklist blacklist,
plasmaSearchRankingProfile rankingProfile,
kelondroBitfield constraint,
TreeMap<String, String> clusterselection) {
@@ -282,7 +282,7 @@ public class yacySearch extends Thread {
plasmaWordIndex wordIndex,
plasmaCrawlResults crawlResults,
plasmaSearchRankingProcess containerCache,
- String targethash, plasmaURLPattern blacklist,
+ String targethash, indexReferenceBlacklist blacklist,
plasmaSearchRankingProfile rankingProfile,
kelondroBitfield constraint, TreeMap<String, String> clusterselection) {
// check own peer status
diff --git a/source/de/anomic/yacy/yacySeed.java b/source/de/anomic/yacy/yacySeed.java
index 2a0dd6eaf..0199bf7c3 100644
--- a/source/de/anomic/yacy/yacySeed.java
+++ b/source/de/anomic/yacy/yacySeed.java
@@ -71,9 +71,9 @@ import java.util.Random;
import java.util.Set;
import java.util.TreeMap;
+import de.anomic.index.indexWord;
import de.anomic.kelondro.kelondroBase64Order;
import de.anomic.net.natLib;
-import de.anomic.plasma.plasmaCondenser;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.server.serverCodings;
import de.anomic.server.serverCore;
@@ -582,7 +582,7 @@ public class yacySeed {
Set<String> tags = serverCodings.string2set(get(PEERTAGS, ""), "|");
Iterator<String> i = tags.iterator();
while (i.hasNext()) {
- if (searchHashes.contains(plasmaCondenser.word2hash((String) i.next()))) return true;
+ if (searchHashes.contains(indexWord.word2hash((String) i.next()))) return true;
}
return false;
}
diff --git a/source/yacy.java b/source/yacy.java
index bb6a35770..2c9129842 100644
--- a/source/yacy.java
+++ b/source/yacy.java
@@ -71,13 +71,13 @@ import de.anomic.index.indexContainer;
import de.anomic.index.indexRWIEntry;
import de.anomic.index.indexRWIRowEntry;
import de.anomic.index.indexRepositoryReference;
-import de.anomic.index.indexURLEntry;
+import de.anomic.index.indexURLReference;
+import de.anomic.index.indexWord;
import de.anomic.kelondro.kelondroBase64Order;
import de.anomic.kelondro.kelondroDyn;
import de.anomic.kelondro.kelondroMScoreCluster;
import de.anomic.kelondro.kelondroMapObjects;
import de.anomic.kelondro.kelondroRowCollection;
-import de.anomic.plasma.plasmaCondenser;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.plasma.plasmaWordIndex;
import de.anomic.server.serverCore;
@@ -635,7 +635,7 @@ public final class yacy {
iEntry = (indexRWIEntry) wordIdxEntries.next();
String urlHash = iEntry.urlHash();
if ((currentUrlDB.exists(urlHash)) && (!minimizedUrlDB.exists(urlHash))) try {
- indexURLEntry urlEntry = currentUrlDB.load(urlHash, null, 0);
+ indexURLReference urlEntry = currentUrlDB.load(urlHash, null, 0);
urlCounter++;
minimizedUrlDB.store(urlEntry);
if (urlCounter % 500 == 0) {
@@ -699,7 +699,7 @@ public final class yacy {
try {
String word;
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(wordlist)));
- while ((word = br.readLine()) != null) wordmap.put(plasmaCondenser.word2hash(word), word);
+ while ((word = br.readLine()) != null) wordmap.put(indexWord.word2hash(word), word);
br.close();
} catch (IOException e) {}
return wordmap;