Skip to content

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

refactoring of index package: better names for the classes (to be continued)

orbiter76ef5f0f1446
diff --git a/htroot/Bookmarks.java b/htroot/Bookmarks.java
index 5b2bdeac6..7ce2c0f85 100644
--- a/htroot/Bookmarks.java
+++ b/htroot/Bookmarks.java
@@ -41,7 +41,7 @@ import de.anomic.data.listManager;
import de.anomic.data.userDB;
import de.anomic.data.bookmarksDB.Tag;
import de.anomic.http.httpRequestHeader;
-import de.anomic.index.indexURLReference;
+import de.anomic.index.URLMetadata;
import de.anomic.kelondro.order.DateFormatter;
import de.anomic.kelondro.util.Log;
import de.anomic.plasma.plasmaParserDocument;
@@ -183,10 +183,10 @@ public class Bookmarks {
final bookmarksDB.Bookmark bookmark = sb.bookmarksDB.getBookmark(urlHash);
if (bookmark == null) {
// try to get the bookmark from the LURL database
- final indexURLReference urlentry = sb.webIndex.getURL(urlHash, null, 0);
+ final URLMetadata urlentry = sb.webIndex.getURL(urlHash, null, 0);
plasmaParserDocument document = null;
if (urlentry != null) {
- final indexURLReference.Components comp = urlentry.comp();
+ final URLMetadata.Components comp = urlentry.comp();
document = plasmaSnippetCache.retrieveDocument(comp.url(), true, 5000, true, false);
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 1d19cbe3a..9db060795 100644
--- a/htroot/CrawlResults.java
+++ b/htroot/CrawlResults.java
@@ -31,7 +31,7 @@ import java.util.Iterator;
import java.util.Locale;
import de.anomic.http.httpRequestHeader;
-import de.anomic.index.indexURLReference;
+import de.anomic.index.URLMetadata;
import de.anomic.kelondro.util.Log;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.server.serverObjects;
@@ -169,8 +169,8 @@ public class CrawlResults {
String urlHash, initiatorHash, executorHash;
String urlstr, urltxt;
yacySeed initiatorSeed, executorSeed;
- indexURLReference urle;
- indexURLReference.Components comp;
+ URLMetadata urle;
+ URLMetadata.Components comp;
int i, cnt = 0;
for (i = sb.crawlResults.getStackSize(tabletype) - 1; i >= (sb.crawlResults.getStackSize(tabletype) - lines); i--) {
diff --git a/htroot/IndexCleaner_p.java b/htroot/IndexCleaner_p.java
index bba735405..e5d0512de 100755
--- a/htroot/IndexCleaner_p.java
+++ b/htroot/IndexCleaner_p.java
@@ -25,14 +25,14 @@
//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import de.anomic.http.httpRequestHeader;
-import de.anomic.index.indexRepositoryReference;
+import de.anomic.index.URLMetadataRepository;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.plasma.plasmaWordIndex;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class IndexCleaner_p {
- private static indexRepositoryReference.BlacklistCleaner urldbCleanerThread = null;
+ private static URLMetadataRepository.BlacklistCleaner urldbCleanerThread = null;
private static plasmaWordIndex.ReferenceCleaner indexCleanerThread = null;
public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch<?> env) {
diff --git a/htroot/IndexControlRWIs_p.java b/htroot/IndexControlRWIs_p.java
index b0039fb3a..c553e2b71 100644
--- a/htroot/IndexControlRWIs_p.java
+++ b/htroot/IndexControlRWIs_p.java
@@ -37,12 +37,12 @@ import java.util.Set;
import de.anomic.data.listManager;
import de.anomic.http.httpRequestHeader;
import de.anomic.index.indexAbstractReferenceBlacklist;
-import de.anomic.index.indexContainer;
+import de.anomic.index.ReferenceContainer;
import de.anomic.index.indexContainerCache;
-import de.anomic.index.indexRWIEntry;
-import de.anomic.index.indexRWIRowEntry;
-import de.anomic.index.indexURLReference;
-import de.anomic.index.indexWord;
+import de.anomic.index.Reference;
+import de.anomic.index.ReferenceRow;
+import de.anomic.index.URLMetadata;
+import de.anomic.index.Word;
import de.anomic.kelondro.order.Bitfield;
import de.anomic.plasma.plasmaSearchAPI;
import de.anomic.plasma.plasmaSearchEvent;
@@ -86,7 +86,7 @@ public class IndexControlRWIs_p {
final boolean delurlref = post.containsKey("delurlref");
if (post.containsKey("keystringsearch")) {
- keyhash = indexWord.word2hash(keystring);
+ keyhash = Word.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 || !indexWord.word2hash(keystring).equals(keyhash)) {
+ if (keystring.length() == 0 || !Word.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);
@@ -123,9 +123,9 @@ public class IndexControlRWIs_p {
if (post.containsKey("keyhashdeleteall")) {
if (delurl || delurlref) {
// generate an urlx array
- indexContainer index = null;
- index = sb.webIndex.getContainer(keyhash, null);
- final Iterator<indexRWIRowEntry> en = index.entries();
+ ReferenceContainer index = null;
+ index = sb.webIndex.getReferences(keyhash, null);
+ final Iterator<ReferenceRow> en = index.entries();
int i = 0;
urlx = new String[index.size()];
while (en.hasNext()) {
@@ -141,7 +141,7 @@ public class IndexControlRWIs_p {
sb.urlRemove(urlx[i]);
}
}
- sb.webIndex.deleteContainer(keyhash);
+ sb.webIndex.deleteAllReferences(keyhash);
post.remove("keyhashdeleteall");
post.put("urllist", "generated");
}
@@ -158,7 +158,7 @@ public class IndexControlRWIs_p {
}
final Set<String> urlHashes = new HashSet<String>();
for (int i = 0; i < urlx.length; i++) urlHashes.add(urlx[i]);
- sb.webIndex.removeEntries(keyhash, urlHashes);
+ sb.webIndex.removeReferences(keyhash, urlHashes);
// this shall lead to a presentation of the list; so handle that the remaining program
// thinks that it was called for a list presentation
post.remove("keyhashdelete");
@@ -166,7 +166,7 @@ public class IndexControlRWIs_p {
}
if (post.containsKey("urllist")) {
- if (keystring.length() == 0 || !indexWord.word2hash(keystring).equals(keyhash)) {
+ if (keystring.length() == 0 || !Word.word2hash(keystring).equals(keyhash)) {
prop.put("keystring", "&lt;not possible to compute word from hash&gt;");
}
final Bitfield flags = plasmaSearchAPI.compileFlags(post);
@@ -177,7 +177,7 @@ public class IndexControlRWIs_p {
// transfer to other peer
if (post.containsKey("keyhashtransfer")) {
- if (keystring.length() == 0 || !indexWord.word2hash(keystring).equals(keyhash)) {
+ if (keystring.length() == 0 || !Word.word2hash(keystring).equals(keyhash)) {
prop.put("keystring", "&lt;not possible to compute word from hash&gt;");
}
@@ -198,15 +198,15 @@ public class IndexControlRWIs_p {
}
// prepare index
- indexContainer index;
+ ReferenceContainer index;
final long starttime = System.currentTimeMillis();
- index = sb.webIndex.getContainer(keyhash, null);
+ index = sb.webIndex.getReferences(keyhash, null);
// built urlCache
- final Iterator<indexRWIRowEntry> urlIter = index.entries();
- final HashMap<String, indexURLReference> knownURLs = new HashMap<String, indexURLReference>();
+ final Iterator<ReferenceRow> urlIter = index.entries();
+ final HashMap<String, URLMetadata> knownURLs = new HashMap<String, URLMetadata>();
final HashSet<String> unknownURLEntries = new HashSet<String>();
- indexRWIEntry iEntry;
- indexURLReference lurl;
+ Reference iEntry;
+ URLMetadata lurl;
while (urlIter.hasNext()) {
iEntry = urlIter.next();
lurl = sb.webIndex.getURL(iEntry.urlHash(), null, 0);
@@ -220,7 +220,7 @@ public class IndexControlRWIs_p {
// make an indexContainerCache
indexContainerCache icc = new indexContainerCache(index.rowdef);
- icc.addEntries(index);
+ icc.addReferences(index);
// transport to other peer
final String gzipBody = sb.getConfig("indexControl.gzipBody","false");
@@ -237,8 +237,8 @@ public class IndexControlRWIs_p {
// generate list
if (post.containsKey("keyhashsimilar")) {
- final Iterator<indexContainer> containerIt = sb.webIndex.indexContainerSet(keyhash, false, true, 256).iterator();
- indexContainer container;
+ final Iterator<ReferenceContainer> containerIt = sb.webIndex.indexContainerSet(keyhash, false, true, 256).iterator();
+ ReferenceContainer container;
int i = 0;
int rows = 0, cols = 0;
prop.put("keyhashsimilar", "1");
@@ -269,7 +269,7 @@ public class IndexControlRWIs_p {
yacyURL url;
for (int i=0; i<urlx.length; i++) {
urlHashes.add(urlx[i]);
- final indexURLReference e = sb.webIndex.getURL(urlx[i], null, 0);
+ final URLMetadata e = sb.webIndex.getURL(urlx[i], null, 0);
sb.webIndex.removeURL(urlx[i]);
if (e != null) {
url = e.comp().url();
@@ -297,7 +297,7 @@ public class IndexControlRWIs_p {
yacyURL url;
for (int i=0; i<urlx.length; i++) {
urlHashes.add(urlx[i]);
- final indexURLReference e = sb.webIndex.getURL(urlx[i], null, 0);
+ final URLMetadata e = sb.webIndex.getURL(urlx[i], null, 0);
sb.webIndex.removeURL(urlx[i]);
if (e != null) {
url = e.comp().url();
@@ -315,7 +315,7 @@ public class IndexControlRWIs_p {
} catch (final IOException e) {
}
}
- sb.webIndex.removeEntries(keyhash, urlHashes);
+ sb.webIndex.removeReferences(keyhash, urlHashes);
}
if (prop.getInt("searchresult", 0) == 3) plasmaSearchAPI.listHosts(prop, keyhash, sb);
diff --git a/htroot/IndexControlURLs_p.java b/htroot/IndexControlURLs_p.java
index 2231c1b78..019c917eb 100644
--- a/htroot/IndexControlURLs_p.java
+++ b/htroot/IndexControlURLs_p.java
@@ -31,8 +31,8 @@ import java.net.MalformedURLException;
import java.util.Iterator;
import de.anomic.http.httpRequestHeader;
-import de.anomic.index.indexRepositoryReference;
-import de.anomic.index.indexURLReference;
+import de.anomic.index.URLMetadataRepository;
+import de.anomic.index.URLMetadata;
import de.anomic.kelondro.order.Base64Order;
import de.anomic.kelondro.order.DateFormatter;
import de.anomic.kelondro.order.RotateIterator;
@@ -61,7 +61,7 @@ public class IndexControlURLs_p {
prop.put("reload", 0);
// show export messages
- final indexRepositoryReference.Export export = sb.webIndex.exportURL();
+ final URLMetadataRepository.Export export = sb.webIndex.exportURL();
if ((export != null) && (export.isAlive())) {
// there is currently a running export
prop.put("lurlexport", 2);
@@ -115,7 +115,7 @@ public class IndexControlURLs_p {
}
if (post.containsKey("urlhashdelete")) {
- final indexURLReference entry = sb.webIndex.getURL(urlhash, null, 0);
+ final URLMetadata entry = sb.webIndex.getURL(urlhash, null, 0);
if (entry == null) {
prop.putHTML("result", "No Entry for URL hash " + urlhash + "; nothing deleted.");
} else {
@@ -149,7 +149,7 @@ public class IndexControlURLs_p {
final yacyURL url = new yacyURL(urlstring, null);
urlhash = url.hash();
prop.put("urlhash", urlhash);
- final indexURLReference entry = sb.webIndex.getURL(urlhash, null, 0);
+ final URLMetadata entry = sb.webIndex.getURL(urlhash, null, 0);
if (entry == null) {
prop.putHTML("urlstring", "unknown url: " + urlstring);
prop.put("urlhash", "");
@@ -166,7 +166,7 @@ public class IndexControlURLs_p {
}
if (post.containsKey("urlhashsearch")) {
- final indexURLReference entry = sb.webIndex.getURL(urlhash, null, 0);
+ final URLMetadata entry = sb.webIndex.getURL(urlhash, null, 0);
if (entry == null) {
prop.putHTML("result", "No Entry for URL hash " + urlhash);
} else {
@@ -181,9 +181,9 @@ public class IndexControlURLs_p {
// generate list
if (post.containsKey("urlhashsimilar")) {
try {
- final Iterator<indexURLReference> entryIt = new RotateIterator<indexURLReference>(sb.webIndex.entriesURL(true, urlhash), new String(Base64Order.zero((urlhash == null ? 0 : urlhash.length()))), sb.webIndex.size());
+ final Iterator<URLMetadata> entryIt = new RotateIterator<URLMetadata>(sb.webIndex.entriesURL(true, urlhash), new String(Base64Order.zero((urlhash == null ? 0 : urlhash.length()))), sb.webIndex.size());
final StringBuilder result = new StringBuilder("Sequential List of URL-Hashes:<br />");
- indexURLReference entry;
+ URLMetadata entry;
int i = 0;
int rows = 0, cols = 0;
prop.put("urlhashsimilar", "1");
@@ -228,7 +228,7 @@ public class IndexControlURLs_p {
final File f = new File(s);
f.getParentFile().mkdirs();
final String filter = post.get("exportfilter", ".*");
- final indexRepositoryReference.Export running = sb.webIndex.exportURL(f, filter, format, dom);
+ final URLMetadataRepository.Export running = sb.webIndex.exportURL(f, filter, format, dom);
prop.put("lurlexport_exportfile", s);
prop.put("lurlexport_urlcount", running.count());
@@ -253,13 +253,13 @@ public class IndexControlURLs_p {
if (post.containsKey("statistics")) {
int count = post.getInt("lines", 100);
- Iterator<indexRepositoryReference.hostStat> statsiter;
+ Iterator<URLMetadataRepository.hostStat> statsiter;
prop.put("statistics_lines", count);
int cnt = 0;
try {
statsiter = sb.webIndex.statistics(count);
boolean dark = true;
- indexRepositoryReference.hostStat hs;
+ URLMetadataRepository.hostStat hs;
while (statsiter.hasNext() && cnt < count) {
hs = statsiter.next();
prop.put("statisticslines_domains_" + cnt + "_dark", (dark) ? "1" : "0");
@@ -285,15 +285,15 @@ public class IndexControlURLs_p {
return prop;
}
- private static serverObjects genUrlProfile(final plasmaSwitchboard switchboard, final indexURLReference entry, final String urlhash) {
+ private static serverObjects genUrlProfile(final plasmaSwitchboard switchboard, final URLMetadata entry, final String urlhash) {
final serverObjects prop = new serverObjects();
if (entry == null) {
prop.put("genUrlProfile", "1");
prop.put("genUrlProfile_urlhash", urlhash);
return prop;
}
- final indexURLReference.Components comp = entry.comp();
- final indexURLReference le = ((entry.referrerHash() == null) || (entry.referrerHash().length() != yacySeedDB.commonHashLength)) ? null : switchboard.webIndex.getURL(entry.referrerHash(), null, 0);
+ final URLMetadata.Components comp = entry.comp();
+ final URLMetadata le = ((entry.referrerHash() == null) || (entry.referrerHash().length() != yacySeedDB.commonHashLength)) ? null : switchboard.webIndex.getURL(entry.referrerHash(), null, 0);
if (comp.url() == null) {
prop.put("genUrlProfile", "1");
prop.put("genUrlProfile_urlhash", urlhash);
diff --git a/htroot/ViewFile.java b/htroot/ViewFile.java
index 493eaf8a4..cc44f091c 100644
--- a/htroot/ViewFile.java
+++ b/htroot/ViewFile.java
@@ -40,7 +40,7 @@ import de.anomic.http.httpClient;
import de.anomic.http.httpRequestHeader;
import de.anomic.http.httpResponseHeader;
import de.anomic.index.indexDocumentMetadata;
-import de.anomic.index.indexURLReference;
+import de.anomic.index.URLMetadata;
import de.anomic.kelondro.util.FileUtils;
import de.anomic.plasma.plasmaCondenser;
import de.anomic.plasma.plasmaHTCache;
@@ -94,7 +94,7 @@ public class ViewFile {
final String urlHash = post.get("urlHash","");
if (urlHash.length() > 0) {
// getting the urlEntry that belongs to the url hash
- indexURLReference urlEntry = null;
+ URLMetadata urlEntry = null;
urlEntry = sb.webIndex.getURL(urlHash, null, 0);
if (urlEntry == null) {
prop.put("error", "2");
@@ -103,7 +103,7 @@ public class ViewFile {
}
// getting the url that belongs to the entry
- final indexURLReference.Components comp = urlEntry.comp();
+ final URLMetadata.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/api/yacydoc.java b/htroot/api/yacydoc.java
index ca4262b83..15605860c 100644
--- a/htroot/api/yacydoc.java
+++ b/htroot/api/yacydoc.java
@@ -28,7 +28,7 @@
import java.net.MalformedURLException;
import de.anomic.http.httpRequestHeader;
-import de.anomic.index.indexURLReference;
+import de.anomic.index.URLMetadata;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
@@ -68,14 +68,14 @@ public class yacydoc {
}
if (urlhash == null || urlhash.length() == 0) return prop;
- final indexURLReference entry = sb.webIndex.getURL(urlhash, null, 0);
+ final URLMetadata entry = sb.webIndex.getURL(urlhash, null, 0);
if (entry == null) return prop;
- final indexURLReference.Components comp = entry.comp();
+ final URLMetadata.Components comp = entry.comp();
if (comp.url() == null) {
return prop;
}
- final indexURLReference le = ((entry.referrerHash() == null) || (entry.referrerHash().length() != yacySeedDB.commonHashLength)) ? null : sb.webIndex.getURL(entry.referrerHash(), null, 0);
+ final URLMetadata le = ((entry.referrerHash() == null) || (entry.referrerHash().length() != yacySeedDB.commonHashLength)) ? null : sb.webIndex.getURL(entry.referrerHash(), null, 0);
prop.putXML("dc_title", comp.dc_title());
prop.putXML("dc_creator", comp.dc_creator());
diff --git a/htroot/yacy/crawlReceipt.java b/htroot/yacy/crawlReceipt.java
index 566f0b2a7..e980e3c68 100644
--- a/htroot/yacy/crawlReceipt.java
+++ b/htroot/yacy/crawlReceipt.java
@@ -31,7 +31,7 @@ import java.io.IOException;
import de.anomic.crawler.ZURL;
import de.anomic.http.httpRequestHeader;
-import de.anomic.index.indexURLReference;
+import de.anomic.index.URLMetadata;
import de.anomic.kelondro.util.Log;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.server.serverObjects;
@@ -112,14 +112,14 @@ public final class crawlReceipt {
}
// generating a new loaded URL entry
- final indexURLReference entry = indexURLReference.importEntry(propStr);
+ final URLMetadata entry = URLMetadata.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;
}
- final indexURLReference.Components comp = entry.comp();
+ final URLMetadata.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/query.java b/htroot/yacy/query.java
index e92e12546..9fc232463 100644
--- a/htroot/yacy/query.java
+++ b/htroot/yacy/query.java
@@ -82,7 +82,7 @@ public final class query {
if (obj.equals("rwiurlcount")) {
// the total number of different urls in the rwi is returned
// <env> shall contain a word hash, the number of assigned lurls to this hash is returned
- prop.put("response", sb.webIndex.getContainer(env, null).size());
+ prop.put("response", sb.webIndex.getReferences(env, null).size());
return prop;
}
diff --git a/htroot/yacy/search.java b/htroot/yacy/search.java
index 7ef67d498..c1c498474 100644
--- a/htroot/yacy/search.java
+++ b/htroot/yacy/search.java
@@ -35,7 +35,7 @@ import java.util.Set;
import java.util.TreeSet;
import de.anomic.http.httpRequestHeader;
-import de.anomic.index.indexContainer;
+import de.anomic.index.ReferenceContainer;
import de.anomic.kelondro.order.Base64Order;
import de.anomic.kelondro.order.Bitfield;
import de.anomic.kelondro.util.SortStack;
@@ -185,18 +185,18 @@ public final class search {
yacyCore.log.logInfo("INIT HASH SEARCH (abstracts only): " + plasmaSearchQuery.anonymizedQueryHashes(theQuery.queryHashes) + " - " + theQuery.displayResults() + " links");
final long timer = System.currentTimeMillis();
- final Map<String, indexContainer>[] containers = sb.webIndex.localSearchContainers(theQuery, plasmaSearchQuery.hashes2Set(urls));
+ final Map<String, ReferenceContainer>[] containers = sb.webIndex.localSearchContainers(theQuery, plasmaSearchQuery.hashes2Set(urls));
serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(theQuery.id(true), plasmaSearchEvent.COLLECTION, containers[0].size(), System.currentTimeMillis() - timer));
if (containers != null) {
- final Iterator<Map.Entry<String, indexContainer>> ci = containers[0].entrySet().iterator();
- Map.Entry<String, indexContainer> entry;
+ final Iterator<Map.Entry<String, ReferenceContainer>> ci = containers[0].entrySet().iterator();
+ Map.Entry<String, ReferenceContainer> entry;
String wordhash;
while (ci.hasNext()) {
entry = ci.next();
wordhash = entry.getKey();
- final indexContainer container = entry.getValue();
+ final ReferenceContainer container = entry.getValue();
indexabstractContainercount += container.size();
- indexabstract.append("indexabstract." + wordhash + "=").append(indexContainer.compressIndex(container, null, 1000).toString()).append(serverCore.CRLF_STRING);
+ indexabstract.append("indexabstract." + wordhash + "=").append(ReferenceContainer.compressIndex(container, null, 1000).toString()).append(serverCore.CRLF_STRING);
}
}
diff --git a/htroot/yacy/transferRWI.java b/htroot/yacy/transferRWI.java
index f3106da6e..18b343be7 100644
--- a/htroot/yacy/transferRWI.java
+++ b/htroot/yacy/transferRWI.java
@@ -32,7 +32,7 @@ import java.util.Iterator;
import java.util.List;
import de.anomic.http.httpRequestHeader;
-import de.anomic.index.indexRWIRowEntry;
+import de.anomic.index.ReferenceRow;
import de.anomic.index.indexReferenceBlacklist;
import de.anomic.kelondro.util.FileUtils;
import de.anomic.kelondro.util.Log;
@@ -126,7 +126,7 @@ public final class transferRWI {
int p;
String wordHash;
String urlHash;
- indexRWIRowEntry iEntry;
+ ReferenceRow iEntry;
final HashSet<String> unknownURL = new HashSet<String>();
final HashSet<String> knownURL = new HashSet<String>();
final String[] wordhashes = new String[v.size()];
@@ -146,7 +146,7 @@ public final class transferRWI {
}
wordHash = estring.substring(0, p);
wordhashes[received] = wordHash;
- iEntry = new indexRWIRowEntry(estring.substring(p));
+ iEntry = new ReferenceRow(estring.substring(p));
urlHash = iEntry.urlHash();
// block blacklisted entries
diff --git a/htroot/yacy/transferURL.java b/htroot/yacy/transferURL.java
index 1dff26358..d84c42f0f 100644
--- a/htroot/yacy/transferURL.java
+++ b/htroot/yacy/transferURL.java
@@ -31,7 +31,7 @@ import java.text.ParseException;
import de.anomic.http.httpRequestHeader;
import de.anomic.index.indexReferenceBlacklist;
-import de.anomic.index.indexURLReference;
+import de.anomic.index.URLMetadata;
import de.anomic.kelondro.order.DateFormatter;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.server.serverCore;
@@ -84,7 +84,7 @@ public final class transferURL {
final int sizeBefore = sb.webIndex.countURL();
// read the urls from the other properties and store
String urls;
- indexURLReference lEntry;
+ URLMetadata lEntry;
for (int i = 0; i < urlc; i++) {
serverCore.checkInterruption();
@@ -97,7 +97,7 @@ public final class transferURL {
}
// parse new lurl-entry
- lEntry = indexURLReference.importEntry(urls);
+ lEntry = URLMetadata.importEntry(urls);
if (lEntry == null) {
yacyCore.log.logWarning("transferURL: received invalid URL (entry null) from peer " + otherPeerName + "\n\tURL Property: " + urls);
blocked++;
@@ -105,7 +105,7 @@ public final class transferURL {
}
// check if entry is well-formed
- final indexURLReference.Components comp = lEntry.comp();
+ final URLMetadata.Components comp = lEntry.comp();
if (comp.url() == null) {
yacyCore.log.logWarning("transferURL: received invalid URL from peer " + otherPeerName + "\n\tURL Property: " + urls);
blocked++;
diff --git a/htroot/yacy/urls.java b/htroot/yacy/urls.java
index 528d567a6..b9fb243c6 100644
--- a/htroot/yacy/urls.java
+++ b/htroot/yacy/urls.java
@@ -30,7 +30,7 @@ import java.util.Date;
import de.anomic.crawler.CrawlEntry;
import de.anomic.crawler.NoticedURL;
import de.anomic.http.httpRequestHeader;
-import de.anomic.index.indexURLReference;
+import de.anomic.index.URLMetadata;
import de.anomic.kelondro.order.DateFormatter;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.server.serverObjects;
@@ -108,8 +108,8 @@ public class urls {
if (urlhashes.length() % 12 != 0) return prop;
final int count = urlhashes.length() / 12;
int c = 0;
- indexURLReference entry;
- indexURLReference.Components comp;
+ URLMetadata entry;
+ URLMetadata.Components comp;
yacyURL referrer;
for (int i = 0; i < count; i++) {
entry = sb.webIndex.getURL(urlhashes.substring(12 * i, 12 * (i + 1)), null, 0);
diff --git a/htroot/yacysearch.java b/htroot/yacysearch.java
index 1d317baf6..0d6acea84 100644
--- a/htroot/yacysearch.java
+++ b/htroot/yacysearch.java
@@ -31,8 +31,8 @@ import java.util.HashMap;
import java.util.TreeSet;
import de.anomic.http.httpRequestHeader;
-import de.anomic.index.indexURLReference;
-import de.anomic.index.indexWord;
+import de.anomic.index.URLMetadata;
+import de.anomic.index.Word;
import de.anomic.kelondro.order.Bitfield;
import de.anomic.kelondro.util.MemoryControl;
import de.anomic.kelondro.util.SetTools;
@@ -321,9 +321,9 @@ public class yacysearch {
return prop;
}
final String recommendHash = post.get("recommendref", ""); // urlhash
- final indexURLReference urlentry = sb.webIndex.getURL(recommendHash, null, 0);
+ final URLMetadata urlentry = sb.webIndex.getURL(recommendHash, null, 0);
if (urlentry != null) {
- final indexURLReference.Components comp = urlentry.comp();
+ final URLMetadata.Components comp = urlentry.comp();
plasmaParserDocument document;
document = plasmaSnippetCache.retrieveDocument(comp.url(), true, 5000, true, false);
if (document != null) {
@@ -345,12 +345,12 @@ public class yacysearch {
final boolean globalsearch = (global) /* && (yacyonline)*/ && (sb.getConfigBool(plasmaSwitchboardConstants.INDEX_RECEIVE_ALLOW, false));
// do the search
- final TreeSet<String> queryHashes = indexWord.words2hashes(query[0]);
+ final TreeSet<String> queryHashes = Word.words2hashes(query[0]);
final plasmaSearchQuery theQuery = new plasmaSearchQuery(
querystring,
queryHashes,
- indexWord.words2hashes(query[1]),
- indexWord.words2hashes(query[2]),
+ Word.words2hashes(query[1]),
+ Word.words2hashes(query[2]),
ranking,
maxDistance,
prefermask,
diff --git a/source/de/anomic/crawler/CrawlStacker.java b/source/de/anomic/crawler/CrawlStacker.java
index 55fecfee8..74c9617a0 100644
--- a/source/de/anomic/crawler/CrawlStacker.java
+++ b/source/de/anomic/crawler/CrawlStacker.java
@@ -32,7 +32,7 @@ import java.net.UnknownHostException;
import java.util.Date;
import de.anomic.index.indexReferenceBlacklist;
-import de.anomic.index.indexURLReference;
+import de.anomic.index.URLMetadata;
import de.anomic.kelondro.util.Log;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.plasma.plasmaWordIndex;
@@ -256,7 +256,7 @@ public final class CrawlStacker {
// check if the url is double registered
final String dbocc = nextQueue.urlExists(entry.url().hash());
if (dbocc != null || wordIndex.existsURL(entry.url().hash())) {
- final indexURLReference oldEntry = wordIndex.getURL(entry.url().hash(), null, 0);
+ final URLMetadata oldEntry = wordIndex.getURL(entry.url().hash(), null, 0);
final boolean recrawl = (oldEntry != null) && (profile.recrawlIfOlder() > oldEntry.loaddate().getTime());
// do double-check
if ((dbocc != null) && (!recrawl)) {
diff --git a/source/de/anomic/crawler/IndexingStack.java b/source/de/anomic/crawler/IndexingStack.java
index fffdee356..6b4178082 100644
--- a/source/de/anomic/crawler/IndexingStack.java
+++ b/source/de/anomic/crawler/IndexingStack.java
@@ -35,7 +35,7 @@ import java.util.Iterator;
import java.util.concurrent.ConcurrentHashMap;
import de.anomic.http.httpResponseHeader;
-import de.anomic.index.indexURLReference;
+import de.anomic.index.URLMetadata;
import de.anomic.kelondro.index.Row;
import de.anomic.kelondro.order.Base64Order;
import de.anomic.kelondro.order.DateFormatter;
@@ -367,7 +367,7 @@ public class IndexingStack {
if (referrerURL == null) {
// FIXME the equals seems to be incorrect: String.equals(boolean)
if ((referrerHash == null) || ((initiator != null) && (referrerHash.equals(initiator.length() == 0)))) return null;
- final indexURLReference entry = wordIndex.getURL(referrerHash, null, 0);
+ final URLMetadata entry = wordIndex.getURL(referrerHash, null, 0);
if (entry == null) referrerURL = null; else referrerURL = entry.comp().url();
}
return referrerURL;
diff --git a/source/de/anomic/crawler/ResultURLs.java b/source/de/anomic/crawler/ResultURLs.java
index 3ad533c89..bc7b54760 100644
--- a/source/de/anomic/crawler/ResultURLs.java
+++ b/source/de/anomic/crawler/ResultURLs.java
@@ -39,7 +39,7 @@ import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
-import de.anomic.index.indexURLReference;
+import de.anomic.index.URLMetadata;
import de.anomic.kelondro.order.Bitfield;
import de.anomic.kelondro.util.ScoreCluster;
import de.anomic.kelondro.util.Log;
@@ -82,7 +82,7 @@ public final class ResultURLs {
gcrawlResultDomains = new ScoreCluster<String>();
}
- public synchronized void stack(final indexURLReference e, final String initiatorHash, final String executorHash, final int stackType) {
+ public synchronized void stack(final URLMetadata e, final String initiatorHash, final String executorHash, final int stackType) {
assert initiatorHash != null;
assert executorHash != null;
if (e == null) { return; }
@@ -305,7 +305,7 @@ public final class ResultURLs {
final ResultURLs results = new ResultURLs();
try {
final yacyURL url = new yacyURL("http", "www.yacy.net", 80, "/");
- final indexURLReference urlRef = new indexURLReference(url, "YaCy Homepage", "", "", "", new Date(), new Date(), new Date(), "", new byte[] {}, 123, 42, '?', new Bitfield(), "de", 0, 0, 0, 0, 0, 0);
+ final URLMetadata urlRef = new URLMetadata(url, "YaCy Homepage", "", "", "", new Date(), new Date(), new Date(), "", new byte[] {}, 123, 42, '?', new Bitfield(), "de", 0, 0, 0, 0, 0, 0);
int stackNo = 1;
System.out.println("valid test:\n=======");
// add
diff --git a/source/de/anomic/data/SitemapParser.java b/source/de/anomic/data/SitemapParser.java
index 91ad060f6..8d97cbb8a 100644
--- a/source/de/anomic/data/SitemapParser.java
+++ b/source/de/anomic/data/SitemapParser.java
@@ -45,7 +45,7 @@ import de.anomic.http.httpClient;
import de.anomic.http.httpResponse;
import de.anomic.http.httpRequestHeader;
import de.anomic.http.httpdByteCountInputStream;
-import de.anomic.index.indexURLReference;
+import de.anomic.index.URLMetadata;
import de.anomic.kelondro.order.DateFormatter;
import de.anomic.kelondro.util.Log;
import de.anomic.plasma.plasmaSwitchboard;
@@ -260,7 +260,7 @@ public class SitemapParser extends DefaultHandler {
final String dbocc = this.sb.urlExists(nexturlhash);
if ((dbocc != null) && (dbocc.equalsIgnoreCase("loaded"))) {
// the url was already loaded. we need to check the date
- final indexURLReference oldEntry = this.sb.webIndex.getURL(nexturlhash, null, 0);
+ final URLMetadata oldEntry = this.sb.webIndex.getURL(nexturlhash, null, 0);
if (oldEntry != null) {
final 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 45a6b700d..b3a8cf0d7 100644
--- a/source/de/anomic/data/bookmarksDB.java
+++ b/source/de/anomic/data/bookmarksDB.java
@@ -64,7 +64,7 @@ import de.anomic.crawler.CrawlEntry;
import de.anomic.crawler.CrawlProfile;
import de.anomic.htmlFilter.htmlFilterContentScraper;
import de.anomic.htmlFilter.htmlFilterWriter;
-import de.anomic.index.indexWord;
+import de.anomic.index.Word;
import de.anomic.kelondro.blob.BLOBTree;
import de.anomic.kelondro.blob.MapView;
import de.anomic.kelondro.order.CloneableIterator;
@@ -305,10 +305,10 @@ public class bookmarksDB {
* tagName is converted to lower case before hash is generated!
*/
public static String tagHash(final String tagName){
- return indexWord.word2hash(tagName.toLowerCase());
+ return Word.word2hash(tagName.toLowerCase());
}
public static String tagHash(final String tagName, final String user){
- return indexWord.word2hash(user+":"+tagName.toLowerCase());
+ return Word.word2hash(user+":"+tagName.toLowerCase());
}
public Iterator<String> getFolderList(final boolean priv){
diff --git a/source/de/anomic/index/indexRWIEntry.java b/source/de/anomic/index/Reference.java
similarity index 94%
rename from source/de/anomic/index/indexRWIEntry.java
rename to source/de/anomic/index/Reference.java
index 4ccc3c2dd..1f4dce563 100644
--- a/source/de/anomic/index/indexRWIEntry.java
+++ b/source/de/anomic/index/Reference.java
@@ -1,4 +1,4 @@
-// indexRWIEntry.java
+// Reference.java
// (C) 2007 by Michael Peter Christen; [email protected], Frankfurt a. M., Germany
// first published 07.11.2007 on http://www.anomic.de
//
@@ -28,7 +28,7 @@ package de.anomic.index;
import de.anomic.kelondro.order.Bitfield;
-public interface indexRWIEntry {
+public interface Reference {
// appearance flags, used in RWI entry
// some names are derived from the Dublin Core Metadata tag set
@@ -82,9 +82,9 @@ public interface indexRWIEntry {
public String toString();
- public boolean isNewer(indexRWIEntry other);
+ public boolean isNewer(Reference other);
- public boolean isOlder(indexRWIEntry other);
+ public boolean isOlder(Reference other);
public int hashCode();
}
\ No newline at end of file
diff --git a/source/de/anomic/index/indexContainer.java b/source/de/anomic/index/ReferenceContainer.java
similarity index 73%
rename from source/de/anomic/index/indexContainer.java
rename to source/de/anomic/index/ReferenceContainer.java
index fa890713b..1843dd19c 100644
--- a/source/de/anomic/index/indexContainer.java
+++ b/source/de/anomic/index/ReferenceContainer.java
@@ -1,4 +1,4 @@
-// indexContainer.java
+// ReferenceContainer.java
// (C) 2006 by Michael Peter Christen; [email protected], Frankfurt a. M., Germany
// first published 04.07.2006 on http://yacy.net
//
@@ -40,23 +40,23 @@ import de.anomic.kelondro.order.Base64Order;
import de.anomic.kelondro.util.ByteBuffer;
import de.anomic.plasma.plasmaWordIndex;
-public class indexContainer extends RowSet {
+public class ReferenceContainer extends RowSet {
private String wordHash;
- public indexContainer(final String wordHash, final RowSet collection) {
+ public ReferenceContainer(final String wordHash, final RowSet collection) {
super(collection);
this.wordHash = wordHash;
}
- public indexContainer(final String wordHash, final Row rowdef, final int objectCount) {
+ public ReferenceContainer(final String wordHash, final Row rowdef, final int objectCount) {
super(rowdef, objectCount);
this.wordHash = wordHash;
this.lastTimeWrote = 0;
}
- public indexContainer topLevelClone() {
- final indexContainer newContainer = new indexContainer(this.wordHash, this.rowdef, this.size());
+ public ReferenceContainer topLevelClone() {
+ final ReferenceContainer newContainer = new ReferenceContainer(this.wordHash, this.rowdef, this.size());
newContainer.addAllUnique(this);
return newContainer;
}
@@ -73,57 +73,57 @@ public class indexContainer extends RowSet {
return wordHash;
}
- public void add(final indexRWIRowEntry entry) {
+ public void add(final ReferenceRow entry) {
// add without double-occurrence test
assert entry.toKelondroEntry().objectsize() == super.rowdef.objectsize;
this.addUnique(entry.toKelondroEntry());
}
- public void add(final indexRWIEntry entry, final long updateTime) {
+ public void add(final Reference entry, final long updateTime) {
// add without double-occurrence test
- if (entry instanceof indexRWIRowEntry) {
- assert ((indexRWIRowEntry) entry).toKelondroEntry().objectsize() == super.rowdef.objectsize;
- this.add((indexRWIRowEntry) entry);
+ if (entry instanceof ReferenceRow) {
+ assert ((ReferenceRow) entry).toKelondroEntry().objectsize() == super.rowdef.objectsize;
+ this.add((ReferenceRow) entry);
} else {
- this.add(((indexRWIVarEntry) entry).toRowEntry());
+ this.add(((ReferenceVars) entry).toRowEntry());
}
this.lastTimeWrote = updateTime;
}
- public static final indexContainer mergeUnique(final indexContainer a, final boolean aIsClone, final indexContainer b, final boolean bIsClone) {
+ public static final ReferenceContainer mergeUnique(final ReferenceContainer a, final boolean aIsClone, final ReferenceContainer b, final boolean bIsClone) {
if ((aIsClone) && (bIsClone)) {
- if (a.size() > b.size()) return (indexContainer) mergeUnique(a, b); else return (indexContainer) mergeUnique(b, a);
+ if (a.size() > b.size()) return (ReferenceContainer) mergeUnique(a, b); else return (ReferenceContainer) mergeUnique(b, a);
}
- if (aIsClone) return (indexContainer) mergeUnique(a, b);
- if (bIsClone) return (indexContainer) mergeUnique(b, a);
- if (a.size() > b.size()) return (indexContainer) mergeUnique(a, b); else return (indexContainer) mergeUnique(b, a);
+ if (aIsClone) return (ReferenceContainer) mergeUnique(a, b);
+ if (bIsClone) return (ReferenceContainer) mergeUnique(b, a);
+ if (a.size() > b.size()) return (ReferenceContainer) mergeUnique(a, b); else return (ReferenceContainer) mergeUnique(b, a);
}
public static Object mergeUnique(final Object a, final Object b) {
- final indexContainer c = (indexContainer) a;
- c.addAllUnique((indexContainer) b);
+ final ReferenceContainer c = (ReferenceContainer) a;
+ c.addAllUnique((ReferenceContainer) b);
return c;
}
- public indexContainer merge(final indexContainer c) {
- return new indexContainer(this.wordHash, this.merge(c));
+ public ReferenceContainer merge(final ReferenceContainer c) {
+ return new ReferenceContainer(this.wordHash, this.merge(c));
}
- public indexRWIEntry put(final indexRWIRowEntry entry) {
+ public Reference put(final ReferenceRow entry) {
assert entry.toKelondroEntry().objectsize() == super.rowdef.objectsize;
final Row.Entry r = super.put(entry.toKelondroEntry());
if (r == null) return null;
- return new indexRWIRowEntry(r);
+ return new ReferenceRow(r);
}
- public boolean putRecent(final indexRWIRowEntry entry) {
+ public boolean putRecent(final ReferenceRow entry) {
assert entry.toKelondroEntry().objectsize() == super.rowdef.objectsize;
// returns true if the new entry was added, false if it already existed
final Row.Entry oldEntryRow = this.put(entry.toKelondroEntry());
if (oldEntryRow == null) {
return true;
}
- final indexRWIRowEntry oldEntry = new indexRWIRowEntry(oldEntryRow);
+ final ReferenceRow oldEntry = new ReferenceRow(oldEntryRow);
if (entry.isOlder(oldEntry)) { // A more recent Entry is already in this container
this.put(oldEntry.toKelondroEntry()); // put it back
return false;
@@ -131,13 +131,13 @@ public class indexContainer extends RowSet {
return true;
}
- public int putAllRecent(final indexContainer c) {
+ public int putAllRecent(final ReferenceContainer c) {
// adds all entries in c and checks every entry for double-occurrence
// returns the number of new elements
if (c == null) return 0;
int x = 0;
synchronized (c) {
- final Iterator<indexRWIRowEntry> i = c.entries();
+ final Iterator<ReferenceRow> i = c.entries();
while (i.hasNext()) {
try {
if (putRecent(i.next())) x++;
@@ -150,10 +150,10 @@ public class indexContainer extends RowSet {
return x;
}
- public indexRWIEntry get(final String urlHash) {
+ public Reference get(final String urlHash) {
final Row.Entry entry = this.get(urlHash.getBytes());
if (entry == null) return null;
- return new indexRWIRowEntry(entry);
+ return new ReferenceRow(entry);
}
/**
@@ -161,10 +161,10 @@ public class indexContainer extends RowSet {
* if the url hash was found, return the entry, but delete the entry from the container
* if the entry was not found, return null.
*/
- public indexRWIEntry remove(final String urlHash) {
+ public Reference remove(final String urlHash) {
final Row.Entry entry = remove(urlHash.getBytes());
if (entry == null) return null;
- return new indexRWIRowEntry(entry);
+ return new ReferenceRow(entry);
}
public int removeEntries(final Set<String> urlHashes) {
@@ -174,12 +174,12 @@ public class indexContainer extends RowSet {
return count;
}
- public Iterator<indexRWIRowEntry> entries() {
+ public Iterator<ReferenceRow> entries() {
// returns an iterator of indexRWIEntry objects
return new entryIterator();
}
- public class entryIterator implements Iterator<indexRWIRowEntry> {
+ public class entryIterator implements Iterator<ReferenceRow> {
Iterator<Row.Entry> rowEntryIterator;
@@ -191,10 +191,10 @@ public class indexContainer extends RowSet {
return rowEntryIterator.hasNext();
}
- public indexRWIRowEntry next() {
+ public ReferenceRow next() {
final Row.Entry rentry = rowEntryIterator.next();
if (rentry == null) return null;
- return new indexRWIRowEntry(rentry);
+ return new ReferenceRow(rentry);
}
public void remove() {
@@ -207,7 +207,7 @@ public class indexContainer extends RowSet {
static {
Method meth = null;
try {
- final Class<?> c = Class.forName("de.anomic.index.indexContainer");
+ final Class<?> c = Class.forName("de.anomic.index.ReferenceContainer");
meth = c.getMethod("mergeUnique", new Class[]{Object.class, Object.class});
} catch (final SecurityException e) {
System.out.println("Error while initializing containerMerge.SecurityException: " + e.getMessage());
@@ -222,9 +222,9 @@ public class indexContainer extends RowSet {
containerMergeMethod = meth;
}
- public static indexContainer joinExcludeContainers(
- final Collection<indexContainer> includeContainers,
- final Collection<indexContainer> excludeContainers,
+ public static ReferenceContainer joinExcludeContainers(
+ final Collection<ReferenceContainer> includeContainers,
+ final Collection<ReferenceContainer> excludeContainers,
final int maxDistance) {
// join a search result and return the joincount (number of pages after join)
@@ -232,19 +232,19 @@ public class indexContainer extends RowSet {
if (includeContainers == null) return plasmaWordIndex.emptyContainer(null, 0);
// join the result
- final indexContainer rcLocal = indexContainer.joinContainers(includeContainers, maxDistance);
+ final ReferenceContainer rcLocal = ReferenceContainer.joinContainers(includeContainers, maxDistance);
if (rcLocal == null) return plasmaWordIndex.emptyContainer(null, 0);
excludeContainers(rcLocal, excludeContainers);
return rcLocal;
}
- public static indexContainer joinContainers(final Collection<indexContainer> containers, final int maxDistance) {
+ public static ReferenceContainer joinContainers(final Collection<ReferenceContainer> containers, final int maxDistance) {
// order entities by their size
- final TreeMap<Long, indexContainer> map = new TreeMap<Long, indexContainer>();
- indexContainer singleContainer;
- final Iterator<indexContainer> i = containers.iterator();
+ final TreeMap<Long, ReferenceContainer> map = new TreeMap<Long, ReferenceContainer>();
+ ReferenceContainer singleContainer;
+ final Iterator<ReferenceContainer> i = containers.iterator();
int count = 0;
while (i.hasNext()) {
// get next entity:
@@ -264,13 +264,13 @@ public class indexContainer extends RowSet {
// the map now holds the search results in order of number of hits per word
// we now must pairwise build up a conjunction of these sets
Long k = map.firstKey(); // the smallest, which means, the one with the least entries
- indexContainer searchA, searchB, searchResult = map.remove(k);
+ ReferenceContainer searchA, searchB, searchResult = map.remove(k);
while ((map.size() > 0) && (searchResult.size() > 0)) {
// take the first element of map which is a result and combine it with result
k = map.firstKey(); // the next smallest...
searchA = searchResult;
searchB = map.remove(k);
- searchResult = indexContainer.joinConstructive(searchA, searchB, maxDistance);
+ searchResult = ReferenceContainer.joinConstructive(searchA, searchB, maxDistance);
// free resources
searchA = null;
searchB = null;
@@ -281,12 +281,12 @@ public class indexContainer extends RowSet {
return searchResult;
}
- public static indexContainer excludeContainers(indexContainer pivot, final Collection<indexContainer> containers) {
+ public static ReferenceContainer excludeContainers(ReferenceContainer pivot, final Collection<ReferenceContainer> containers) {
// check if there is any result
if ((containers == null) || (containers.size() == 0)) return pivot; // no result, nothing found
- final Iterator<indexContainer> i = containers.iterator();
+ final Iterator<ReferenceContainer> i = containers.iterator();
while (i.hasNext()) {
pivot = excludeDestructive(pivot, i.next());
if ((pivot == null) || (pivot.size() == 0)) return null;
@@ -302,7 +302,7 @@ public class indexContainer extends RowSet {
return l;
}
- public static indexContainer joinConstructive(final indexContainer i1, final indexContainer i2, final int maxDistance) {
+ public static ReferenceContainer joinConstructive(final ReferenceContainer i1, final ReferenceContainer i2, final int maxDistance) {
if ((i1 == null) || (i2 == null)) return null;
if ((i1.size() == 0) || (i2.size() == 0)) return null;
@@ -322,17 +322,17 @@ public class indexContainer extends RowSet {
return joinConstructiveByEnumeration(i1, i2, maxDistance);
}
- private static indexContainer joinConstructiveByTest(final indexContainer small, final indexContainer large, final int maxDistance) {
+ private static ReferenceContainer joinConstructiveByTest(final ReferenceContainer small, final ReferenceContainer large, final int maxDistance) {
System.out.println("DEBUG: JOIN METHOD BY TEST, maxdistance = " + maxDistance);
assert small.rowdef.equals(large.rowdef) : "small = " + small.rowdef.toString() + "; large = " + large.rowdef.toString();
final int keylength = small.rowdef.width(0);
assert (keylength == large.rowdef.width(0));
- final indexContainer conj = new indexContainer(null, small.rowdef, 0); // start with empty search result
- final Iterator<indexRWIRowEntry> se = small.entries();
- indexRWIVarEntry ie0;
- indexRWIEntry ie1;
+ final ReferenceContainer conj = new ReferenceContainer(null, small.rowdef, 0); // start with empty search result
+ final Iterator<ReferenceRow> se = small.entries();
+ ReferenceVars ie0;
+ Reference ie1;
while (se.hasNext()) {
- ie0 = new indexRWIVarEntry(se.next());
+ ie0 = new ReferenceVars(se.next());
ie1 = large.get(ie0.urlHash());
if ((ie0 != null) && (ie1 != null)) {
assert (ie0.urlHash().length() == keylength) : "ie0.urlHash() = " + ie0.urlHash();
@@ -345,21 +345,21 @@ public class indexContainer extends RowSet {
return conj;
}
- private static indexContainer joinConstructiveByEnumeration(final indexContainer i1, final indexContainer i2, final int maxDistance) {
+ private static ReferenceContainer joinConstructiveByEnumeration(final ReferenceContainer i1, final ReferenceContainer i2, final int maxDistance) {
System.out.println("DEBUG: JOIN METHOD BY ENUMERATION, maxdistance = " + maxDistance);
assert i1.rowdef.equals(i2.rowdef) : "i1 = " + i1.rowdef.toString() + "; i2 = " + i2.rowdef.toString();
final int keylength = i1.rowdef.width(0);
assert (keylength == i2.rowdef.width(0));
- final indexContainer conj = new indexContainer(null, i1.rowdef, 0); // start with empty search result
+ final ReferenceContainer conj = new ReferenceContainer(null, i1.rowdef, 0); // start with empty search result
if (!((i1.rowdef.getOrdering().signature().equals(i2.rowdef.getOrdering().signature())) &&
(i1.rowdef.primaryKeyIndex == i2.rowdef.primaryKeyIndex))) return conj; // ordering must be equal
- final Iterator<indexRWIRowEntry> e1 = i1.entries();
- final Iterator<indexRWIRowEntry> e2 = i2.entries();
+ final Iterator<ReferenceRow> e1 = i1.entries();
+ final Iterator<ReferenceRow> e2 = i2.entries();
int c;
if ((e1.hasNext()) && (e2.hasNext())) {
- indexRWIVarEntry ie1;
- indexRWIEntry ie2;
- ie1 = new indexRWIVarEntry(e1.next());
+ ReferenceVars ie1;
+ Reference ie2;
+ ie1 = new ReferenceVars(e1.next());
ie2 = e2.next();
while (true) {
@@ -368,14 +368,14 @@ public class indexContainer extends RowSet {
c = i1.rowdef.getOrdering().compare(ie1.urlHash().getBytes(), ie2.urlHash().getBytes());
//System.out.println("** '" + ie1.getUrlHash() + "'.compareTo('" + ie2.getUrlHash() + "')="+c);
if (c < 0) {
- if (e1.hasNext()) ie1 = new indexRWIVarEntry(e1.next()); else break;
+ if (e1.hasNext()) ie1 = new ReferenceVars(e1.next()); else break;
} else if (c > 0) {
if (e2.hasNext()) ie2 = e2.next(); else break;
} else {
// we have found the same urls in different searches!
ie1.join(ie2);
if (ie1.worddistance() <= maxDistance) conj.add(ie1.toRowEntry());
- if (e1.hasNext()) ie1 = new indexRWIVarEntry(e1.next()); else break;
+ if (e1.hasNext()) ie1 = new ReferenceVars(e1.next()); else break;
if (e2.hasNext()) ie2 = e2.next(); else break;
}
}
@@ -383,7 +383,7 @@ public class indexContainer extends RowSet {
return conj;
}
- public static indexContainer excludeDestructive(final indexContainer pivot, final indexContainer excl) {
+ public static ReferenceContainer excludeDestructive(final ReferenceContainer pivot, final ReferenceContainer excl) {
if (pivot == null) return null;
if (excl == null) return pivot;
if (pivot.size() == 0) return null;
@@ -402,13 +402,13 @@ public class indexContainer extends RowSet {
return excludeDestructiveByEnumeration(pivot, excl);
}
- private static indexContainer excludeDestructiveByTest(final indexContainer pivot, final indexContainer excl) {
+ private static ReferenceContainer excludeDestructiveByTest(final ReferenceContainer pivot, final ReferenceContainer excl) {
assert pivot.rowdef.equals(excl.rowdef) : "small = " + pivot.rowdef.toString() + "; large = " + excl.rowdef.toString();
final int keylength = pivot.rowdef.width(0);
assert (keylength == excl.rowdef.width(0));
final boolean iterate_pivot = pivot.size() < excl.size();
- final Iterator<indexRWIRowEntry> se = (iterate_pivot) ? pivot.entries() : excl.entries();
- indexRWIEntry ie0, ie1;
+ final Iterator<ReferenceRow> se = (iterate_pivot) ? pivot.entries() : excl.entries();
+ Reference ie0, ie1;
while (se.hasNext()) {
ie0 = se.next();
ie1 = excl.get(ie0.urlHash());
@@ -421,19 +421,19 @@ public class indexContainer extends RowSet {
return pivot;
}
- private static indexContainer excludeDestructiveByEnumeration(final indexContainer pivot, final indexContainer excl) {
+ private static ReferenceContainer excludeDestructiveByEnumeration(final ReferenceContainer pivot, final ReferenceContainer excl) {
assert pivot.rowdef.equals(excl.rowdef) : "i1 = " + pivot.rowdef.toString() + "; i2 = " + excl.rowdef.toString();
final int keylength = pivot.rowdef.width(0);
assert (keylength == excl.rowdef.width(0));
if (!((pivot.rowdef.getOrdering().signature().equals(excl.rowdef.getOrdering().signature())) &&
(pivot.rowdef.primaryKeyIndex == excl.rowdef.primaryKeyIndex))) return pivot; // ordering must be equal
- final Iterator<indexRWIRowEntry> e1 = pivot.entries();
- final Iterator<indexRWIRowEntry> e2 = excl.entries();
+ final Iterator<ReferenceRow> e1 = pivot.entries();
+ final Iterator<ReferenceRow> e2 = excl.entries();
int c;
if ((e1.hasNext()) && (e2.hasNext())) {
- indexRWIVarEntry ie1;
- indexRWIEntry ie2;
- ie1 = new indexRWIVarEntry(e1.next());
+ ReferenceVars ie1;
+ Reference ie2;
+ ie1 = new ReferenceVars(e1.next());
ie2 = e2.next();
while (true) {
@@ -442,14 +442,14 @@ public class indexContainer extends RowSet {
c = pivot.rowdef.getOrdering().compare(ie1.urlHash().getBytes(), ie2.urlHash().getBytes());
//System.out.println("** '" + ie1.getUrlHash() + "'.compareTo('" + ie2.getUrlHash() + "')="+c);
if (c < 0) {
- if (e1.hasNext()) ie1 = new indexRWIVarEntry(e1.next()); else break;
+ if (e1.hasNext()) ie1 = new ReferenceVars(e1.next()); else break;
} else if (c > 0) {
if (e2.hasNext()) ie2 = e2.next(); else break;
} else {
// we have found the same urls in different searches!
ie1.join(ie2);
e1.remove();
- if (e1.hasNext()) ie1 = new indexRWIVarEntry(e1.next()); else break;
+ if (e1.hasNext()) ie1 = new ReferenceVars(e1.next()); else break;
if (e2.hasNext()) ie2 = e2.next(); else break;
}
}
@@ -466,13 +466,13 @@ public class indexContainer extends RowSet {
}
- public static final ByteBuffer compressIndex(final indexContainer inputContainer, final indexContainer excludeContainer, final long maxtime) {
+ public static final ByteBuffer compressIndex(final ReferenceContainer inputContainer, final ReferenceContainer excludeContainer, final long maxtime) {
// collect references according to domains
final long timeout = (maxtime < 0) ? Long.MAX_VALUE : System.currentTimeMillis() + maxtime;
final TreeMap<String, String> doms = new TreeMap<String, String>();
synchronized (inputContainer) {
- final Iterator<indexRWIRowEntry> i = inputContainer.entries();
- indexRWIEntry iEntry;
+ final Iterator<ReferenceRow> i = inputContainer.entries();
+ Reference iEntry;
String dom, paths;
while (i.hasNext()) {
iEntry = i.next();
diff --git a/source/de/anomic/index/indexRWIEntryOrder.java b/source/de/anomic/index/ReferenceOrder.java
similarity index 87%
rename from source/de/anomic/index/indexRWIEntryOrder.java
rename to source/de/anomic/index/ReferenceOrder.java
index 23240ca37..6a46ac167 100644
--- a/source/de/anomic/index/indexRWIEntryOrder.java
+++ b/source/de/anomic/index/ReferenceOrder.java
@@ -1,4 +1,4 @@
-// indexRWIEntryOrder.java
+// ReferenceOrder.java
// (C) 2007 by Michael Peter Christen; [email protected], Frankfurt a. M., Germany
// first published 07.11.2007 on http://yacy.net
//
@@ -39,14 +39,14 @@ import de.anomic.plasma.plasmaSearchRankingProfile;
import de.anomic.server.serverProcessor;
import de.anomic.yacy.yacyURL;
-public class indexRWIEntryOrder {
- private indexRWIVarEntry min, max;
+public class ReferenceOrder {
+ private ReferenceVars min, max;
private final plasmaSearchRankingProfile ranking;
private final ScoreCluster<String> doms; // collected for "authority" heuristic
private int maxdomcount;
private String language;
- public indexRWIEntryOrder(final plasmaSearchRankingProfile profile, String language) {
+ public ReferenceOrder(final plasmaSearchRankingProfile profile, String language) {
this.min = null;
this.max = null;
this.ranking = profile;
@@ -55,10 +55,10 @@ public class indexRWIEntryOrder {
this.language = language;
}
- public ArrayList<indexRWIVarEntry> normalizeWith(final indexContainer container) {
+ public ArrayList<ReferenceVars> normalizeWith(final ReferenceContainer container) {
// normalize ranking: find minimum and maxiumum of separate ranking criteria
assert (container != null);
- ArrayList<indexRWIVarEntry> result = null;
+ ArrayList<ReferenceVars> result = null;
//long s0 = System.currentTimeMillis();
if ((serverProcessor.useCPU > 1) && (container.size() > 600)) {
@@ -112,7 +112,7 @@ public class indexRWIEntryOrder {
return (doms.getScore(urlHash.substring(6)) << 8) / (1 + this.maxdomcount);
}
- public long cardinal(final indexRWIVarEntry t) {
+ public long cardinal(final ReferenceVars t) {
//return Long.MAX_VALUE - preRanking(ranking, iEntry, this.entryMin, this.entryMax, this.searchWords);
// the normalizedEntry must be a normalized indexEntry
final Bitfield flags = t.flags();
@@ -136,12 +136,12 @@ public class indexRWIEntryOrder {
+ ((max.hitcount() == min.hitcount()) ? 0 : (((t.hitcount() - min.hitcount() ) << 8) / (max.hitcount() - min.hitcount()) ) << ranking.coeff_hitcount)
+ tf
+ ((ranking.coeff_authority > 12) ? (authority(t.urlHash()) << ranking.coeff_authority) : 0)
- + ((flags.get(indexRWIEntry.flag_app_dc_identifier)) ? 255 << ranking.coeff_appurl : 0)
- + ((flags.get(indexRWIEntry.flag_app_dc_title)) ? 255 << ranking.coeff_app_dc_title : 0)
- + ((flags.get(indexRWIEntry.flag_app_dc_creator)) ? 255 << ranking.coeff_app_dc_creator : 0)
- + ((flags.get(indexRWIEntry.flag_app_dc_subject)) ? 255 << ranking.coeff_app_dc_subject : 0)
- + ((flags.get(indexRWIEntry.flag_app_dc_description)) ? 255 << ranking.coeff_app_dc_description : 0)
- + ((flags.get(indexRWIEntry.flag_app_emphasized)) ? 255 << ranking.coeff_appemph : 0)
+ + ((flags.get(Reference.flag_app_dc_identifier)) ? 255 << ranking.coeff_appurl : 0)
+ + ((flags.get(Reference.flag_app_dc_title)) ? 255 << ranking.coeff_app_dc_title : 0)
+ + ((flags.get(Reference.flag_app_dc_creator)) ? 255 << ranking.coeff_app_dc_creator : 0)
+ + ((flags.get(Reference.flag_app_dc_subject)) ? 255 << ranking.coeff_app_dc_subject : 0)
+ + ((flags.get(Reference.flag_app_dc_description)) ? 255 << ranking.coeff_app_dc_description : 0)
+ + ((flags.get(Reference.flag_app_emphasized)) ? 255 << ranking.coeff_appemph : 0)
+ ((flags.get(plasmaCondenser.flag_cat_indexof)) ? 255 << ranking.coeff_catindexof : 0)
+ ((flags.get(plasmaCondenser.flag_cat_hasimage)) ? 255 << ranking.coeff_cathasimage : 0)
+ ((flags.get(plasmaCondenser.flag_cat_hasaudio)) ? 255 << ranking.coeff_cathasaudio : 0)
@@ -161,33 +161,33 @@ public class indexRWIEntryOrder {
public static class minmaxfinder extends Thread {
- indexRWIVarEntry entryMin;
- indexRWIVarEntry entryMax;
- private final indexContainer container;
+ ReferenceVars entryMin;
+ ReferenceVars entryMax;
+ private final ReferenceContainer container;
private final int start, end;
private final HashMap<String, Integer> doms;
private final Integer int1;
- ArrayList<indexRWIVarEntry> decodedEntries;
+ ArrayList<ReferenceVars> decodedEntries;
- public minmaxfinder(final indexContainer container, final int start /*including*/, final int end /*excluding*/) {
+ public minmaxfinder(final ReferenceContainer container, final int start /*including*/, final int end /*excluding*/) {
this.container = container;
this.start = start;
this.end = end;
this.doms = new HashMap<String, Integer>();
this.int1 = 1;
- this.decodedEntries = new ArrayList<indexRWIVarEntry>();
+ this.decodedEntries = new ArrayList<ReferenceVars>();
}
public void run() {
// find min/max to obtain limits for normalization
this.entryMin = null;
this.entryMax = null;
- indexRWIVarEntry iEntry;
+ ReferenceVars iEntry;
int p = this.start;
String dom;
Integer count;
while (p < this.end) {
- iEntry = new indexRWIVarEntry(new indexRWIRowEntry(container.get(p++, false)));
+ iEntry = new ReferenceVars(new ReferenceRow(container.get(p++, false)));
this.decodedEntries.add(iEntry);
// find min/max
if (this.entryMin == null) this.entryMin = iEntry.clone(); else this.entryMin.min(iEntry);
@@ -203,7 +203,7 @@ public class indexRWIEntryOrder {
}
}
- public ArrayList<indexRWIVarEntry> decodedContainer() {
+ public ArrayList<ReferenceVars> decodedContainer() {
return this.decodedEntries;
}
diff --git a/source/de/anomic/index/indexRWIRowEntry.java b/source/de/anomic/index/ReferenceRow.java
similarity index 94%
rename from source/de/anomic/index/indexRWIRowEntry.java
rename to source/de/anomic/index/ReferenceRow.java
index e6fcd06fd..47cefb67f 100644
--- a/source/de/anomic/index/indexRWIRowEntry.java
+++ b/source/de/anomic/index/ReferenceRow.java
@@ -1,4 +1,4 @@
-// indexRWIRowEntry.java
+// ReferenceRow.java
// (C) 2006 by Michael Peter Christen; [email protected], Frankfurt a. M., Germany
// first published 20.05.2006 on http://yacy.net
//
@@ -34,7 +34,7 @@ import de.anomic.kelondro.order.Bitfield;
import de.anomic.kelondro.order.MicroDate;
import de.anomic.yacy.yacySeedDB;
-public final class indexRWIRowEntry implements indexRWIEntry, Cloneable {
+public final class ReferenceRow implements Reference, Cloneable {
// this object stores attributes to URL references inside RWI collections
@@ -90,7 +90,7 @@ public final class indexRWIRowEntry implements indexRWIEntry, Cloneable {
private final Row.Entry entry;
- public indexRWIRowEntry(final String urlHash,
+ public ReferenceRow(final String urlHash,
final int urlLength, // byte-length of complete URL
final int urlComps, // number of path components
final int titleLength, // length of description/length (longer are better?)
@@ -136,32 +136,32 @@ public final class indexRWIRowEntry implements indexRWIEntry, Cloneable {
this.entry.setCol(col_reserve2, 0);
}
- public indexRWIRowEntry(final String urlHash, final String code) {
+ public ReferenceRow(final String urlHash, final String code) {
// the code is the external form of the row minus the leading urlHash entry
this.entry = urlEntryRow.newEntry((urlHash + code).getBytes());
}
- public indexRWIRowEntry(final String external) {
+ public ReferenceRow(final String external) {
this.entry = urlEntryRow.newEntry(external, true);
}
- public indexRWIRowEntry(final byte[] row) {
+ public ReferenceRow(final byte[] row) {
this.entry = urlEntryRow.newEntry(row);
}
- public indexRWIRowEntry(final byte[] row, final int offset, final boolean clone) {
+ public ReferenceRow(final byte[] row, final int offset, final boolean clone) {
this.entry = urlEntryRow.newEntry(row, offset, clone);
}
- public indexRWIRowEntry(final Row.Entry rentry) {
+ public ReferenceRow(final Row.Entry rentry) {
// FIXME: see if cloning is necessary
this.entry = rentry;
}
- public indexRWIRowEntry clone() {
+ public ReferenceRow clone() {
final byte[] b = new byte[urlEntryRow.objectsize];
System.arraycopy(entry.bytes(), 0, b, 0, urlEntryRow.objectsize);
- return new indexRWIRowEntry(b);
+ return new ReferenceRow(b);
}
public String toPropertyForm() {
@@ -252,13 +252,13 @@ public final class indexRWIRowEntry implements indexRWIEntry, Cloneable {
return toPropertyForm();
}
- public boolean isNewer(final indexRWIEntry other) {
+ public boolean isNewer(final Reference other) {
if (other == null) return true;
if (this.lastModified() > other.lastModified()) return true;
return false;
}
- public boolean isOlder(final indexRWIEntry other) {
+ public boolean isOlder(final Reference other) {
if (other == null) return false;
if (this.lastModified() < other.lastModified()) return true;
return false;
diff --git a/source/de/anomic/index/indexRWIVarEntry.java b/source/de/anomic/index/ReferenceVars.java
similarity index 94%
rename from source/de/anomic/index/indexRWIVarEntry.java
rename to source/de/anomic/index/ReferenceVars.java
index c7be5ba94..17fc98e5c 100644
--- a/source/de/anomic/index/indexRWIVarEntry.java
+++ b/source/de/anomic/index/ReferenceVars.java
@@ -1,4 +1,4 @@
-// indexRWIVarEntry.java
+// ReferenceVars.java
// (C) 2007 by Michael Peter Christen; [email protected], Frankfurt a. M., Germany
// first published 07.11.2007 on http://yacy.net
//
@@ -29,7 +29,7 @@ package de.anomic.index;
import de.anomic.kelondro.order.Bitfield;
import de.anomic.kelondro.order.MicroDate;
-public class indexRWIVarEntry implements indexRWIEntry, Cloneable {
+public class ReferenceVars implements Reference, Cloneable {
public Bitfield flags;
public long freshUntil, lastModified;
@@ -41,7 +41,7 @@ public class indexRWIVarEntry implements indexRWIEntry, Cloneable {
worddistance, wordsintext, wordsintitle;
public double termFrequency;
- public indexRWIVarEntry(final String urlHash,
+ public ReferenceVars(final String urlHash,
final int urlLength, // byte-length of complete URL
final int urlComps, // number of path components
final int titleLength, // length of description/length (longer are better?)
@@ -86,7 +86,7 @@ public class indexRWIVarEntry implements indexRWIEntry, Cloneable {
this.termFrequency = termfrequency;
}
- public indexRWIVarEntry(final indexRWIRowEntry e) {
+ public ReferenceVars(final ReferenceRow e) {
this.flags = e.flags();
this.freshUntil = e.freshUntil();
this.lastModified = e.lastModified();
@@ -109,8 +109,8 @@ public class indexRWIVarEntry implements indexRWIEntry, Cloneable {
this.termFrequency = e.termFrequency();
}
- public indexRWIVarEntry clone() {
- final indexRWIVarEntry c = new indexRWIVarEntry(
+ public ReferenceVars clone() {
+ final ReferenceVars c = new ReferenceVars(
this.urlHash,
this.urllength,
this.urlcomps,
@@ -133,7 +133,7 @@ public class indexRWIVarEntry implements indexRWIEntry, Cloneable {
return c;
}
- public void join(final indexRWIVarEntry oe) {
+ public void join(final ReferenceVars oe) {
// combine the distance
this.worddistance = this.worddistance + oe.worddistance + Math.abs(this.posintext - oe.posintext);
this.posintext = Math.min(this.posintext, oe.posintext);
@@ -165,12 +165,12 @@ public class indexRWIVarEntry implements indexRWIEntry, Cloneable {
return hitcount;
}
- public boolean isNewer(final indexRWIEntry other) {
+ public boolean isNewer(final Reference other) {
assert false; // should not be used
return false;
}
- public boolean isOlder(final indexRWIEntry other) {
+ public boolean isOlder(final Reference other) {
assert false; // should not be used
return false;
}
@@ -203,8 +203,8 @@ public class indexRWIVarEntry implements indexRWIEntry, Cloneable {
return posofphrase;
}
- public indexRWIRowEntry toRowEntry() {
- return new indexRWIRowEntry(
+ public ReferenceRow toRowEntry() {
+ return new ReferenceRow(
urlHash,
urllength, // byte-length of complete URL
urlcomps, // number of path components
@@ -262,7 +262,7 @@ public class indexRWIVarEntry implements indexRWIEntry, Cloneable {
return this.termFrequency;
}
- public final void min(final indexRWIVarEntry other) {
+ public final void min(final ReferenceVars other) {
int v;
long w;
double d;
@@ -284,7 +284,7 @@ public class indexRWIVarEntry implements indexRWIEntry, Cloneable {
if (this.termFrequency > (d = other.termFrequency)) this.termFrequency = d;
}
- public final void max(final indexRWIVarEntry other) {
+ public final void max(final ReferenceVars other) {
int v;
long w;
double d;
@@ -306,7 +306,7 @@ public class indexRWIVarEntry implements indexRWIEntry, Cloneable {
if (this.termFrequency < (d = other.termFrequency)) this.termFrequency = d;
}
- public void join(final indexRWIEntry oe) {
+ public void join(final Reference oe) {
// joins two entries into one entry
// combine the distance
diff --git a/source/de/anomic/index/ReverseIndex.java b/source/de/anomic/index/ReverseIndex.java
new file mode 100644
index 000000000..fa38602bb
--- /dev/null
+++ b/source/de/anomic/index/ReverseIndex.java
@@ -0,0 +1,134 @@
+// ReverseIndex.java
+// -----------------------------
+// (C) 2005 by Michael Peter Christen; [email protected], Frankfurt a. M., Germany
+// first published 6.5.2005 on http://www.anomic.de
+//
+// This is a part of YaCy, a peer-to-peer based web search engine
+//
+// $LastChangedDate: 2006-04-02 22:40:07 +0200 (So, 02 Apr 2006) $
+// $LastChangedRevision: 1986 $
+// $LastChangedBy: orbiter $
+//
+// LICENSE
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+package de.anomic.index;
+
+import java.io.IOException;
+import java.util.Set;
+
+import de.anomic.kelondro.order.CloneableIterator;
+
+public interface ReverseIndex {
+
+ /**
+ * add references to the reverse index
+ * when no references are stored, the new Entries are simply added,
+ * if there are already references to the word that is denoted
+ * with the reference stored, then merge the old and the new reference
+ * @param newEntries the References to be merged with existing references
+ * @throws IOException
+ */
+ public void addReferences(ReferenceContainer newEntries) throws IOException;
+
+ /**
+ * check if there are references stored to the given word hash
+ * @param wordHash
+ * @return true if references exist, false if not
+ */
+ public boolean hasReferences(String wordHash); // should only be used if in case that true is returned the getContainer is NOT called
+
+ /**
+ * count the number of references for the given word
+ * do not use this method to check the existence of a reference by comparing
+ * the result with zero, use hasReferences instead.
+ * @param wordHash
+ * @return the number of references to the given word
+ */
+ public int countReferences(final String wordHash);
+
+ /**
+ * get the references to a given word.
+ * if referenceselection is not null, then all url references which are not
+ * in referenceselection are removed from the container
+ * @param wordHash
+ * @param referenceselection
+ * @return the references
+ * @throws IOException
+ */
+ public ReferenceContainer getReferences(String wordHash, Set<String> referenceselection) throws IOException;
+
+ /**
+ * delete all references for a word
+ * @param wordHash
+ * @return the deleted references
+ * @throws IOException
+ */
+ public ReferenceContainer deleteAllReferences(String wordHash) throws IOException;
+
+ /**
+ * remove a specific reference entry
+ * @param wordHash
+ * @param referenceHash the key for the reference entry to be removed
+ * @return
+ * @throws IOException
+ */
+ public boolean removeReference(String wordHash, String referenceHash) throws IOException;
+
+ /**
+ * remove a set of reference entries for a given word
+ * @param wordHash the key for the references
+ * @param referenceHash the reference entry keys
+ * @return
+ * @throws IOException
+ */
+ public int removeReferences(String wordHash, Set<String> referenceHashes) throws IOException;
+
+ /**
+ * iterate all references from the beginning of a specific word hash
+ * @param startWordHash
+ * @param rot if true, then rotate at the end to the beginning
+ * @param ram
+ * @return
+ * @throws IOException
+ */
+ public CloneableIterator<ReferenceContainer> referenceIterator(String startWordHash, boolean rot, boolean ram) throws IOException; // method to replace wordHashes
+
+ /**
+ * delete all references entries
+ * @throws IOException
+ */
+ public void clear() throws IOException;
+
+ /**
+ * close the reverse index
+ */
+ public void close();
+
+ /**
+ * the number of all references
+ * @return the nnumber of all references
+ */
+ public int size();
+
+ /**
+ * calculate needed memory
+ * @return the memory needed to operate the object
+ */
+ public int minMem();
+
+}
diff --git a/source/de/anomic/index/indexRAMRI.java b/source/de/anomic/index/ReverseIndexCache.java
similarity index 80%
rename from source/de/anomic/index/indexRAMRI.java
rename to source/de/anomic/index/ReverseIndexCache.java
index 6e7ea8c69..be7bd7e5c 100644
--- a/source/de/anomic/index/indexRAMRI.java
+++ b/source/de/anomic/index/ReverseIndexCache.java
@@ -1,4 +1,4 @@
-// indexRAMRI.java
+// ReverseIndexCache.java
// (C) 2005, 2006 by Michael Peter Christen; [email protected], Frankfurt a. M., Germany
// first published 2005 on http://yacy.net
//
@@ -38,7 +38,7 @@ import de.anomic.kelondro.util.MemoryControl;
import de.anomic.kelondro.util.ScoreCluster;
import de.anomic.kelondro.util.Log;
-public final class indexRAMRI implements indexRI, indexRIReader, Iterable<indexContainer> {
+public final class ReverseIndexCache implements ReverseIndex, ReverseIndexReader, Iterable<ReferenceContainer> {
// class variables
private final ScoreCluster<String> hashScore;
@@ -52,7 +52,7 @@ public final class indexRAMRI implements indexRI, indexRIReader, Iterable<indexC
private indexContainerCache heap;
@SuppressWarnings("unchecked")
- public indexRAMRI(
+ public ReverseIndexCache(
final File databaseRoot,
final Row payloadrow,
final int entityCacheMaxSize,
@@ -87,7 +87,7 @@ public final class indexRAMRI implements indexRI, indexRIReader, Iterable<indexC
heap.initWriteMode();
} else if (dumpFile.exists()) {
// initialize scores for cache organization
- for (final indexContainer ic : (Iterable<indexContainer>) heap.wordContainerIterator(null, false, true)) {
+ for (final ReferenceContainer ic : (Iterable<ReferenceContainer>) heap.referenceIterator(null, false, true)) {
this.hashDate.setScore(ic.getWordHash(), intTime(ic.lastWrote()));
this.hashScore.setScore(ic.getWordHash(), ic.size());
}
@@ -142,12 +142,12 @@ public final class indexRAMRI implements indexRI, indexRIReader, Iterable<indexC
return heap.size();
}
- public synchronized CloneableIterator<indexContainer> wordContainerIterator(final String startWordHash, final boolean rot, final boolean ram) {
+ public synchronized CloneableIterator<ReferenceContainer> referenceIterator(final String startWordHash, final boolean rot, final boolean ram) {
// we return an iterator object that creates top-level-clones of the indexContainers
// in the cache, so that manipulations of the iterated objects do not change
// objects in the cache.
assert ram == true;
- return heap.wordContainerIterator(startWordHash, rot, ram);
+ return heap.referenceIterator(startWordHash, rot, ram);
}
public synchronized String maxScoreWordHash() {
@@ -191,7 +191,7 @@ public final class indexRAMRI implements indexRI, indexRIReader, Iterable<indexC
hash = hashDate.getMinObject(); // flush oldest entries
}
if (hash == null) {
- final indexContainer ic = heap.wordContainerIterator(null, false, true).next();
+ final ReferenceContainer ic = heap.referenceIterator(null, false, true).next();
if (ic != null) hash = ic.getWordHash();
}
return hash;
@@ -202,14 +202,14 @@ public final class indexRAMRI implements indexRI, indexRIReader, Iterable<indexC
return null;
}
- public synchronized ArrayList<indexContainer> bestFlushContainers(final int count) {
- final ArrayList<indexContainer> containerList = new ArrayList<indexContainer>();
+ public synchronized ArrayList<ReferenceContainer> bestFlushContainers(final int count) {
+ final ArrayList<ReferenceContainer> containerList = new ArrayList<ReferenceContainer>();
String hash;
- indexContainer container;
+ ReferenceContainer container;
for (int i = 0; i < count; i++) {
hash = bestFlushWordHash();
if (hash == null) return containerList;
- container = heap.deleteContainer(hash);
+ container = heap.deleteAllReferences(hash);
assert (container != null);
if (container == null) return containerList;
hashScore.deleteScore(hash);
@@ -227,20 +227,19 @@ public final class indexRAMRI implements indexRI, indexRIReader, Iterable<indexC
return (((long) intTime) * (long) 1000) + initTime;
}
- public boolean hasContainer(final String wordHash) {
- return heap.hasContainer(wordHash);
+ public boolean hasReferences(final String wordHash) {
+ return heap.hasReferences(wordHash);
}
- public int sizeContainer(final String wordHash) {
- final indexContainer c = heap.getContainer(wordHash, null);
- return (c == null) ? 0 : c.size();
+ public int countReferences(String key) {
+ return this.heap.countReferences(key);
}
-
- public synchronized indexContainer getContainer(final String wordHash, final Set<String> urlselection) {
+
+ public synchronized ReferenceContainer getReferences(final String wordHash, final Set<String> urlselection) {
if (wordHash == null) return null;
// retrieve container
- indexContainer container = heap.getContainer(wordHash, null);
+ ReferenceContainer container = heap.getReferences(wordHash, null);
// We must not use the container from cache to store everything we find,
// as that container remains linked to in the cache and might be changed later
@@ -254,19 +253,19 @@ public final class indexRAMRI implements indexRI, indexRIReader, Iterable<indexC
return container;
}
- public synchronized indexContainer deleteContainer(final String wordHash) {
+ public synchronized ReferenceContainer deleteAllReferences(final String wordHash) {
// returns the index that had been deleted
if (wordHash == null || heap == null) return null;
- final indexContainer container = heap.deleteContainer(wordHash);
+ final ReferenceContainer container = heap.deleteAllReferences(wordHash);
hashScore.deleteScore(wordHash);
hashDate.deleteScore(wordHash);
return container;
}
- public synchronized boolean removeEntry(final String wordHash, final String urlHash) {
- final boolean removed = heap.removeEntry(wordHash, urlHash);
+ public synchronized boolean removeReference(final String wordHash, final String urlHash) {
+ final boolean removed = heap.removeReference(wordHash, urlHash);
if (removed) {
- if (heap.hasContainer(wordHash)) {
+ if (heap.hasReferences(wordHash)) {
hashScore.decScore(wordHash);
hashDate.setScore(wordHash, intTime(System.currentTimeMillis()));
} else {
@@ -278,12 +277,12 @@ public final class indexRAMRI implements indexRI, indexRIReader, Iterable<indexC
return false;
}
- public synchronized int removeEntries(final String wordHash, final Set<String> urlHashes) {
+ public synchronized int removeReferences(final String wordHash, final Set<String> urlHashes) {
if (urlHashes.size() == 0) return 0;
- final int c = heap.removeEntries(wordHash, urlHashes);
+ final int c = heap.removeReferences(wordHash, urlHashes);
if (c > 0) {
// removal successful
- if (heap.hasContainer(wordHash)) {
+ if (heap.hasReferences(wordHash)) {
hashScore.addScore(wordHash, -c);
hashDate.setScore(wordHash, intTime(System.currentTimeMillis()));
} else {
@@ -295,17 +294,17 @@ public final class indexRAMRI implements indexRI, indexRIReader, Iterable<indexC
return 0;
}
- public synchronized void addEntries(final indexContainer container) {
+ public synchronized void addReferences(final ReferenceContainer container) {
// this puts the entries into the cache, not into the assortment directly
if ((container == null) || (container.size() == 0) || heap == null) return;
// put new words into cache
- heap.addEntries(container);
- hashScore.setScore(container.getWordHash(), heap.sizeEntry(container.getWordHash()));
+ heap.addReferences(container);
+ hashScore.setScore(container.getWordHash(), heap.countReferences(container.getWordHash()));
hashDate.setScore(container.getWordHash(), intTime(System.currentTimeMillis()));
}
- public synchronized void addEntry(final String wordHash, final indexRWIRowEntry newEntry, final long updateTime, final boolean dhtCase) {
+ public synchronized void addEntry(final String wordHash, final ReferenceRow newEntry, final long updateTime, final boolean dhtCase) {
heap.addEntry(wordHash, newEntry);
hashScore.incScore(wordHash);
hashDate.setScore(wordHash, intTime(updateTime));
@@ -324,11 +323,7 @@ public final class indexRAMRI implements indexRI, indexRIReader, Iterable<indexC
hashDate.clear();
}
- public Iterator<indexContainer> iterator() {
- return wordContainerIterator(null, false, true);
- }
-
- public int sizeEntry(String key) {
- return this.heap.sizeEntry(key);
+ public Iterator<ReferenceContainer> iterator() {
+ return referenceIterator(null, false, true);
}
}
diff --git a/source/de/anomic/index/indexCell.java b/source/de/anomic/index/ReverseIndexCell.java
similarity index 77%
rename from source/de/anomic/index/indexCell.java
rename to source/de/anomic/index/ReverseIndexCell.java
index dde274c70..9b368684b 100644
--- a/source/de/anomic/index/indexCell.java
+++ b/source/de/anomic/index/ReverseIndexCell.java
@@ -1,6 +1,6 @@
-// indexRAMRI.java
-// (C) 2005, 2006 by Michael Peter Christen; [email protected], Frankfurt a. M., Germany
-// first published 2005 on http://yacy.net
+// ReverseIndexCell.java
+// (C) 2009 by Michael Peter Christen; [email protected], Frankfurt a. M., Germany
+// first published 1.3.2009 on http://yacy.net
//
// This is a part of YaCy, a peer-to-peer based web search engine
//
@@ -47,14 +47,14 @@ import de.anomic.kelondro.order.Order;
* another BLOB file in the index array.
*/
-public final class indexCell implements indexRI {
+public final class ReverseIndexCell implements ReverseIndex {
// class variables
private indexContainerBLOBArray array;
private indexContainerCache ram;
private int maxRamEntries;
- public indexCell(
+ public ReverseIndexCell(
final File cellPath,
final Row payloadrow,
final int maxRamEntries
@@ -78,8 +78,8 @@ public final class indexCell implements indexRI {
* add entries to the cell: this adds the new entries always to the RAM part, never to BLOBs
* @throws IOException
*/
- public synchronized void addEntries(indexContainer newEntries) throws IOException {
- this.ram.addEntries(newEntries);
+ public synchronized void addReferences(ReferenceContainer newEntries) throws IOException {
+ this.ram.addReferences(newEntries);
if (this.ram.size() > this.maxRamEntries) cacheDump();
}
@@ -112,9 +112,9 @@ public final class indexCell implements indexRI {
* deleting a container affects the containers in RAM and all the BLOB files
* the deleted containers are merged and returned as result of the method
*/
- public indexContainer deleteContainer(String wordHash) throws IOException {
- indexContainer c0 = this.ram.deleteContainer(wordHash);
- indexContainer c1 = this.array.get(wordHash);
+ public ReferenceContainer deleteAllReferences(String wordHash) throws IOException {
+ ReferenceContainer c0 = this.ram.deleteAllReferences(wordHash);
+ ReferenceContainer c1 = this.array.get(wordHash);
if (c1 == null) {
if (c0 == null) return null;
return c0;
@@ -127,9 +127,9 @@ public final class indexCell implements indexRI {
/**
* all containers in the BLOBs and the RAM are merged and returned
*/
- public indexContainer getContainer(String wordHash, Set<String> urlselection) throws IOException {
- indexContainer c0 = this.ram.getContainer(wordHash, null);
- indexContainer c1 = this.array.get(wordHash);
+ public ReferenceContainer getReferences(String wordHash, Set<String> urlselection) throws IOException {
+ ReferenceContainer c0 = this.ram.getReferences(wordHash, null);
+ ReferenceContainer c1 = this.array.get(wordHash);
if (c1 == null) {
if (c0 == null) return null;
return c0;
@@ -138,9 +138,9 @@ public final class indexCell implements indexRI {
return c1.merge(c0);
}
- public int sizeEntry(String wordHash) {
- indexContainer c0 = this.ram.getContainer(wordHash, null);
- indexContainer c1;
+ public int countReferences(String wordHash) {
+ ReferenceContainer c0 = this.ram.getReferences(wordHash, null);
+ ReferenceContainer c1;
try {
c1 = this.array.get(wordHash);
} catch (IOException e) {
@@ -157,8 +157,8 @@ public final class indexCell implements indexRI {
/**
* checks if there is any container for this wordHash, either in RAM or any BLOB
*/
- public boolean hasContainer(String wordHash) {
- if (this.ram.hasContainer(wordHash)) return true;
+ public boolean hasReferences(String wordHash) {
+ if (this.ram.hasReferences(wordHash)) return true;
return this.array.has(wordHash);
}
@@ -174,12 +174,12 @@ public final class indexCell implements indexRI {
* @throws IOException
* @throws IOException
*/
- public int removeEntries(String wordHash, Set<String> urlHashes) throws IOException {
+ public int removeReferences(String wordHash, Set<String> urlHashes) throws IOException {
int reduced = this.array.replace(wordHash, new RemoveRewriter(urlHashes));
return reduced / this.array.rowdef().objectsize;
}
- public boolean removeEntry(String wordHash, String urlHash) throws IOException {
+ public boolean removeReference(String wordHash, String urlHash) throws IOException {
int reduced = this.array.replace(wordHash, new RemoveRewriter(urlHash));
return reduced > 0;
}
@@ -188,17 +188,17 @@ public final class indexCell implements indexRI {
return this.ram.size() + this.array.size();
}
- public CloneableIterator<indexContainer> wordContainerIterator(String startWordHash, boolean rot, boolean ram) throws IOException {
- final Order<indexContainer> containerOrder = new indexContainerOrder(this.ram.rowdef().getOrdering().clone());
- containerOrder.rotate(new indexContainer(startWordHash, this.ram.rowdef(), 0));
+ public CloneableIterator<ReferenceContainer> referenceIterator(String startWordHash, boolean rot, boolean ram) throws IOException {
+ final Order<ReferenceContainer> containerOrder = new indexContainerOrder(this.ram.rowdef().getOrdering().clone());
+ containerOrder.rotate(new ReferenceContainer(startWordHash, this.ram.rowdef(), 0));
if (ram) {
- return this.ram.wordContainerIterator(startWordHash, rot, true);
+ return this.ram.referenceIterator(startWordHash, rot, true);
}
- return new MergeIterator<indexContainer>(
- this.ram.wordContainerIterator(startWordHash, false, true),
+ return new MergeIterator<ReferenceContainer>(
+ this.ram.referenceIterator(startWordHash, false, true),
this.array.wordContainerIterator(startWordHash, false, false),
containerOrder,
- indexContainer.containerMergeMethod,
+ ReferenceContainer.containerMergeMethod,
true);
}
@@ -215,7 +215,7 @@ public final class indexCell implements indexRI {
this.urlHashes.add(urlHash);
}
- public indexContainer rewrite(indexContainer container) {
+ public ReferenceContainer rewrite(ReferenceContainer container) {
container.removeEntries(urlHashes);
return container;
}
diff --git a/source/de/anomic/index/indexRIReader.java b/source/de/anomic/index/ReverseIndexReader.java
similarity index 78%
rename from source/de/anomic/index/indexRIReader.java
rename to source/de/anomic/index/ReverseIndexReader.java
index d52f8afc6..d3c63323b 100644
--- a/source/de/anomic/index/indexRIReader.java
+++ b/source/de/anomic/index/ReverseIndexReader.java
@@ -1,4 +1,4 @@
-// indexRIReader.java
+// ReverseIndexReader.java
// (C) 2008 by Michael Peter Christen; [email protected], Frankfurt a. M., Germany
// first published 2.4.2008 on http://yacy.net
//
@@ -30,12 +30,12 @@ import java.util.Set;
import de.anomic.kelondro.order.CloneableIterator;
-public interface indexRIReader {
+public interface ReverseIndexReader {
public int size();
- public boolean hasContainer(String wordHash); // should only be used if in case that true is returned the getContainer is NOT called
- public indexContainer getContainer(String wordHash, Set<String> urlselection);
- public CloneableIterator<indexContainer> wordContainerIterator(String startWordHash, boolean rot, boolean ram);
+ public boolean hasReferences(String wordHash); // should only be used if in case that true is returned the getContainer is NOT called
+ public ReferenceContainer getReferences(String wordHash, Set<String> urlselection);
+ public CloneableIterator<ReferenceContainer> referenceIterator(String startWordHash, boolean rot, boolean ram);
public void close();
}
diff --git a/source/de/anomic/index/indexURLReference.java b/source/de/anomic/index/URLMetadata.java
similarity index 95%
rename from source/de/anomic/index/indexURLReference.java
rename to source/de/anomic/index/URLMetadata.java
index 6852c32ec..d82bd7a90 100644
--- a/source/de/anomic/index/indexURLReference.java
+++ b/source/de/anomic/index/URLMetadata.java
@@ -1,4 +1,4 @@
-// indexURLReference.java
+// URLMetadata.java
// (C) 2006 by Michael Peter Christen; [email protected], Frankfurt a. M., Germany
// first published 2006 on http://www.anomic.de
//
@@ -48,7 +48,7 @@ import de.anomic.server.serverCodings;
import de.anomic.tools.crypt;
import de.anomic.yacy.yacyURL;
-public class indexURLReference {
+public class URLMetadata {
// this object stores attributes for URL entries
@@ -116,10 +116,10 @@ public class indexURLReference {
private final Row.Entry entry;
private final String snippet;
- private indexRWIEntry word; // this is only used if the url is transported via remote search requests
+ private Reference word; // this is only used if the url is transported via remote search requests
private final long ranking; // during generation of a search result this value is set
- public indexURLReference(
+ public URLMetadata(
final yacyURL url,
final String dc_title,
final String dc_creator,
@@ -198,14 +198,14 @@ public class indexURLReference {
}
}
- public indexURLReference(final Row.Entry entry, final indexRWIEntry searchedWord, final long ranking) {
+ public URLMetadata(final Row.Entry entry, final Reference searchedWord, final long ranking) {
this.entry = entry;
this.snippet = null;
this.word = searchedWord;
this.ranking = ranking;
}
- public indexURLReference(final Properties prop) {
+ public URLMetadata(final 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());
@@ -264,17 +264,17 @@ public class indexURLReference {
this.word = null;
if (prop.containsKey("word")) throw new kelondroException("old database structure is not supported");
if (prop.containsKey("wi")) {
- this.word = new indexRWIRowEntry(Base64Order.enhancedCoder.decodeString(prop.getProperty("wi", ""), "de.anomic.index.indexURLEntry.indexURLEntry()"));
+ this.word = new ReferenceRow(Base64Order.enhancedCoder.decodeString(prop.getProperty("wi", ""), "de.anomic.index.indexURLEntry.indexURLEntry()"));
}
this.ranking = 0;
}
- public static indexURLReference importEntry(final String propStr) {
+ public static URLMetadata importEntry(final String propStr) {
if (propStr == null || !propStr.startsWith("{") || !propStr.endsWith("}")) {
return null;
}
try {
- return new indexURLReference(serverCodings.s2p(propStr.substring(1, propStr.length() - 1)));
+ return new URLMetadata(serverCodings.s2p(propStr.substring(1, propStr.length() - 1)));
} catch (final kelondroException e) {
// wrong format
return null;
@@ -283,7 +283,7 @@ public class indexURLReference {
private StringBuilder corePropList() {
// generate a parseable string; this is a simple property-list
- final indexURLReference.Components comp = this.comp();
+ final URLMetadata.Components comp = this.comp();
final StringBuilder s = new StringBuilder(300);
//System.out.println("author=" + comp.author());
try {
@@ -341,9 +341,9 @@ public class indexURLReference {
return this.ranking;
}
- public indexURLReference.Components comp() {
+ public URLMetadata.Components comp() {
final ArrayList<String> cl = FileUtils.strings(this.entry.getCol("comp", null), "UTF-8");
- return new indexURLReference.Components(
+ return new URLMetadata.Components(
(cl.size() > 0) ? (cl.get(0)).trim() : "",
hash(),
(cl.size() > 1) ? (cl.get(1)).trim() : "",
@@ -424,11 +424,11 @@ public class indexURLReference {
return snippet;
}
- public indexRWIEntry word() {
+ public Reference word() {
return word;
}
- public boolean isOlder(final indexURLReference other) {
+ public boolean isOlder(final URLMetadata other) {
if (other == null) return false;
final Date tmoddate = moddate();
final Date omoddate = other.moddate();
diff --git a/source/de/anomic/index/indexRepositoryReference.java b/source/de/anomic/index/URLMetadataRepository.java
similarity index 94%
rename from source/de/anomic/index/indexRepositoryReference.java
rename to source/de/anomic/index/URLMetadataRepository.java
index 072966278..8b1915fd0 100644
--- a/source/de/anomic/index/indexRepositoryReference.java
+++ b/source/de/anomic/index/URLMetadataRepository.java
@@ -52,7 +52,7 @@ import de.anomic.kelondro.util.ScoreCluster;
import de.anomic.kelondro.util.Log;
import de.anomic.yacy.yacyURL;
-public final class indexRepositoryReference {
+public final class URLMetadataRepository {
// class objects
ObjectIndex urlIndexFile;
@@ -60,10 +60,10 @@ public final class indexRepositoryReference {
private File location = null;
ArrayList<hostStat> statsDump = null;
- public indexRepositoryReference(final File indexSecondaryPath) {
+ public URLMetadataRepository(final File indexSecondaryPath) {
super();
this.location = new File(indexSecondaryPath, "TEXT");
- urlIndexFile = new Cache(new SplitTable(this.location, "urls", indexURLReference.rowdef, false));
+ urlIndexFile = new Cache(new SplitTable(this.location, "urls", URLMetadata.rowdef, false));
}
public void clearCache() {
@@ -95,7 +95,7 @@ public final class indexRepositoryReference {
return 0;
}
- public synchronized indexURLReference load(final String urlHash, final indexRWIEntry searchedWord, final long ranking) {
+ public synchronized URLMetadata load(final String urlHash, final Reference searchedWord, final long ranking) {
// generates an plasmaLURLEntry using the url hash
// if the url cannot be found, this returns null
if (urlHash == null) return null;
@@ -103,15 +103,15 @@ public final class indexRepositoryReference {
try {
final Row.Entry entry = urlIndexFile.get(urlHash.getBytes());
if (entry == null) return null;
- return new indexURLReference(entry, searchedWord, ranking);
+ return new URLMetadata(entry, searchedWord, ranking);
} catch (final IOException e) {
return null;
}
}
- public synchronized void store(final indexURLReference entry) throws IOException {
+ public synchronized void store(final URLMetadata entry) throws IOException {
// Check if there is a more recent Entry already in the DB
- indexURLReference oldEntry;
+ URLMetadata oldEntry;
try {
if (exists(entry.hash())) {
oldEntry = load(entry.hash(), null, 0);
@@ -151,17 +151,17 @@ public final class indexRepositoryReference {
return urlIndexFile.has(urlHash.getBytes());
}
- public CloneableIterator<indexURLReference> entries() throws IOException {
+ public CloneableIterator<URLMetadata> entries() throws IOException {
// enumerates entry elements
return new kiter();
}
- public CloneableIterator<indexURLReference> entries(final boolean up, final String firstHash) throws IOException {
+ public CloneableIterator<URLMetadata> entries(final boolean up, final String firstHash) throws IOException {
// enumerates entry elements
return new kiter(up, firstHash);
}
- public class kiter implements CloneableIterator<indexURLReference> {
+ public class kiter implements CloneableIterator<URLMetadata> {
// enumerates entry elements
private final Iterator<Row.Entry> iter;
private final boolean error;
@@ -193,12 +193,12 @@ public final class indexRepositoryReference {
return this.iter.hasNext();
}
- public final indexURLReference next() {
+ public final URLMetadata next() {
Row.Entry e = null;
if (this.iter == null) { return null; }
if (this.iter.hasNext()) { e = this.iter.next(); }
if (e == null) { return null; }
- return new indexURLReference(e, null, 0);
+ return new URLMetadata(e, null, 0);
}
public final void remove() {
@@ -217,7 +217,7 @@ public final class indexRepositoryReference {
final Log log = new Log("URLDBCLEANUP");
final HashSet<String> damagedURLS = new HashSet<String>();
try {
- final Iterator<indexURLReference> eiter = entries(true, null);
+ final Iterator<URLMetadata> eiter = entries(true, null);
int iteratorCount = 0;
while (eiter.hasNext()) try {
eiter.next();
@@ -310,7 +310,7 @@ public final class indexRepositoryReference {
public void run() {
try {
Log.logInfo("URLDBCLEANER", "UrldbCleaner-Thread startet");
- final Iterator<indexURLReference> eiter = entries(true, null);
+ final Iterator<URLMetadata> eiter = entries(true, null);
while (eiter.hasNext() && run) {
synchronized (this) {
if (this.pause) {
@@ -323,13 +323,13 @@ public final class indexRepositoryReference {
}
}
}
- final indexURLReference entry = eiter.next();
+ final URLMetadata entry = eiter.next();
if (entry == null) {
if (Log.isFine("URLDBCLEANER")) Log.logFine("URLDBCLEANER", "entry == null");
} else if (entry.hash() == null) {
if (Log.isFine("URLDBCLEANER")) Log.logFine("URLDBCLEANER", ++blacklistedUrls + " blacklisted (" + ((double) blacklistedUrls / totalSearchedUrls) * 100 + "%): " + "hash == null");
} else {
- final indexURLReference.Components comp = entry.comp();
+ final URLMetadata.Components comp = entry.comp();
totalSearchedUrls++;
if (comp.url() == null) {
if (Log.isFine("URLDBCLEANER")) Log.logFine("URLDBCLEANER", ++blacklistedUrls + " blacklisted (" + ((double) blacklistedUrls / totalSearchedUrls) * 100 + "%): " + entry.hash() + "URL == null");
@@ -450,9 +450,9 @@ public final class indexRepositoryReference {
count++;
}
} else {
- final Iterator<indexURLReference> i = entries(); // iterates indexURLEntry objects
- indexURLReference entry;
- indexURLReference.Components comp;
+ final Iterator<URLMetadata> i = entries(); // iterates indexURLEntry objects
+ URLMetadata entry;
+ URLMetadata.Components comp;
String url;
while (i.hasNext()) {
entry = i.next();
@@ -533,7 +533,7 @@ public final class indexRepositoryReference {
HashMap<String, hashStat> map = domainSampleCollector();
// fetch urls from the database to determine the host in clear text
- indexURLReference urlref;
+ URLMetadata urlref;
if (count < 0 || count > map.size()) count = map.size();
statsDump = new ArrayList<hostStat>();
TreeSet<String> set = new TreeSet<String>();
@@ -563,12 +563,12 @@ public final class indexRepositoryReference {
// fetch urls from the database to determine the host in clear text
Iterator<String> j = s.scores(false); // iterate urlhash-examples in reverse order (biggest first)
- indexURLReference urlref;
+ URLMetadata urlref;
String urlhash;
count += 10; // make some more to prevent that we have to do this again after deletions too soon.
if (count < 0 || count > s.size()) count = s.size();
statsDump = new ArrayList<hostStat>();
- indexURLReference.Components comps;
+ URLMetadata.Components comps;
yacyURL url;
while (j.hasNext()) {
urlhash = j.next();
diff --git a/source/de/anomic/index/indexWord.java b/source/de/anomic/index/Word.java
similarity index 97%
rename from source/de/anomic/index/indexWord.java
rename to source/de/anomic/index/Word.java
index 91c284096..a4c3d65ec 100644
--- a/source/de/anomic/index/indexWord.java
+++ b/source/de/anomic/index/Word.java
@@ -1,4 +1,4 @@
-// indexWord.java
+// Word.java
// (C) 2008 by Michael Peter Christen; [email protected], Frankfurt a. M., Germany
// first published 26.03.2008 on http://yacy.net
//
@@ -38,7 +38,7 @@ import de.anomic.kelondro.order.Bitfield;
import de.anomic.kelondro.order.Digest;
import de.anomic.yacy.yacySeedDB;
-public class indexWord {
+public class Word {
private static final ConcurrentHashMap<String, String> hashCache = new ConcurrentHashMap<String, String>(1000);
@@ -50,7 +50,7 @@ public class indexWord {
HashSet<Integer> phrases; // a set of handles to all phrases where this word appears
public Bitfield flags; // the flag bits for each word
- public indexWord(final int handle, final int pip, final int nop) {
+ public Word(final int handle, final int pip, final int nop) {
this.count = 1;
this.posInText = handle;
this.posInPhrase = pip;
diff --git a/source/de/anomic/index/indexCollectionRI.java b/source/de/anomic/index/indexCollectionRI.java
index e4653144a..92d07a73a 100644
--- a/source/de/anomic/index/indexCollectionRI.java
+++ b/source/de/anomic/index/indexCollectionRI.java
@@ -60,7 +60,7 @@ import de.anomic.kelondro.util.kelondroOutOfLimitsException;
import de.anomic.kelondro.util.Log;
import de.anomic.yacy.yacyURL;
-public class indexCollectionRI implements indexRI {
+public class indexCollectionRI implements ReverseIndex {
private static final int loadfactor = 4;
private static final int serialNumber = 0;
@@ -154,11 +154,11 @@ public class indexCollectionRI implements indexRI {
}
}
- public synchronized CloneableIterator<indexContainer> wordContainerIterator(final String startWordHash, final boolean rot, final boolean ram) {
+ public synchronized CloneableIterator<ReferenceContainer> referenceIterator(final String startWordHash, final boolean rot, final boolean ram) {
return new wordContainersIterator(startWordHash, rot);
}
- public class wordContainersIterator implements CloneableIterator<indexContainer> {
+ public class wordContainersIterator implements CloneableIterator<ReferenceContainer> {
private final Iterator<Object[]> wci;
private final boolean rot;
@@ -176,13 +176,13 @@ public class indexCollectionRI implements indexRI {
return wci.hasNext();
}
- public indexContainer next() {
+ public ReferenceContainer next() {
final Object[] oo = wci.next();
if (oo == null) return null;
final byte[] key = (byte[]) oo[0];
final RowSet collection = (RowSet) oo[1];
if (collection == null) return null;
- return new indexContainer(new String(key), collection);
+ return new ReferenceContainer(new String(key), collection);
}
public void remove() {
@@ -191,38 +191,38 @@ public class indexCollectionRI implements indexRI {
}
- public boolean hasContainer(final String wordHash) {
+ public boolean hasReferences(final String wordHash) {
return this.has(wordHash.getBytes());
}
- public indexContainer getContainer(final String wordHash, final Set<String> urlselection) {
+ public ReferenceContainer getReferences(final String wordHash, final Set<String> urlselection) {
try {
final RowSet collection = this.get(wordHash.getBytes());
if (collection != null) collection.select(urlselection);
if ((collection == null) || (collection.size() == 0)) return null;
- return new indexContainer(wordHash, collection);
+ return new ReferenceContainer(wordHash, collection);
} catch (final IOException e) {
return null;
}
}
- public indexContainer deleteContainer(final String wordHash) {
+ public ReferenceContainer deleteAllReferences(final String wordHash) {
try {
final RowSet collection = this.delete(wordHash.getBytes());
if (collection == null) return null;
- return new indexContainer(wordHash, collection);
+ return new ReferenceContainer(wordHash, collection);
} catch (final IOException e) {
return null;
}
}
- public boolean removeEntry(final String wordHash, final String urlHash) {
+ public boolean removeReference(final String wordHash, final String urlHash) {
final HashSet<String> hs = new HashSet<String>();
hs.add(urlHash);
- return removeEntries(wordHash, hs) == 1;
+ return removeReferences(wordHash, hs) == 1;
}
- public int removeEntries(final String wordHash, final Set<String> urlHashes) {
+ public int removeReferences(final String wordHash, final Set<String> urlHashes) {
try {
return this.remove(wordHash.getBytes(), urlHashes);
} catch (final kelondroOutOfLimitsException e) {
@@ -234,7 +234,7 @@ public class indexCollectionRI implements indexRI {
}
}
- public void addEntries(final indexContainer newEntries) {
+ public void addReferences(final ReferenceContainer newEntries) {
if (newEntries == null) return;
try {
this.merge(newEntries);
@@ -245,7 +245,7 @@ public class indexCollectionRI implements indexRI {
}
}
- public int sizeEntry(String key) {
+ public int countReferences(String key) {
try {
final RowSet collection = this.get(key.getBytes());
if (collection == null) return 0;
@@ -620,7 +620,7 @@ public class indexCollectionRI implements indexRI {
index.put(indexrow); // write modified indexrow
}
- private synchronized void merge(final indexContainer container) throws IOException, kelondroOutOfLimitsException {
+ private synchronized void merge(final ReferenceContainer container) throws IOException, kelondroOutOfLimitsException {
if ((container == null) || (container.size() == 0)) return;
final byte[] key = container.getWordHash().getBytes();
@@ -997,7 +997,7 @@ public class indexCollectionRI implements indexRI {
for (int j = 0; j < i; j++) {
collection.addUnique(rowdef.newEntry(new byte[][]{("def" + j).getBytes(), "xxx".getBytes()}));
}
- collectionIndex.merge(new indexContainer("key-" + i, collection));
+ collectionIndex.merge(new ReferenceContainer("key-" + i, collection));
}
// printout of index
diff --git a/source/de/anomic/index/indexContainerBLOBArray.java b/source/de/anomic/index/indexContainerBLOBArray.java
index 5023e9ed0..b0b7940a2 100644
--- a/source/de/anomic/index/indexContainerBLOBArray.java
+++ b/source/de/anomic/index/indexContainerBLOBArray.java
@@ -95,7 +95,7 @@ public final class indexContainerBLOBArray {
* objects in the cache.
* @throws IOException
*/
- public synchronized CloneableIterator<indexContainer> wordContainerIterator(final String startWordHash, final boolean rot, final boolean ram) throws IOException {
+ public synchronized CloneableIterator<ReferenceContainer> wordContainerIterator(final String startWordHash, final boolean rot, final boolean ram) throws IOException {
return new heapCacheIterator(startWordHash, rot);
}
@@ -103,7 +103,7 @@ public final class indexContainerBLOBArray {
* cache iterator: iterates objects within the heap cache. This can only be used
* for write-enabled heaps, read-only heaps do not have a heap cache
*/
- public class heapCacheIterator implements CloneableIterator<indexContainer>, Iterable<indexContainer> {
+ public class heapCacheIterator implements CloneableIterator<ReferenceContainer>, Iterable<ReferenceContainer> {
// this class exists, because the wCache cannot be iterated with rotation
// and because every indexContainer Object that is iterated must be returned as top-level-clone
@@ -133,7 +133,7 @@ public final class indexContainerBLOBArray {
return iterator.hasNext();
}
- public indexContainer next() {
+ public ReferenceContainer next() {
try {
if (iterator.hasNext()) {
return get(new String(iterator.next()));
@@ -154,7 +154,7 @@ public final class indexContainerBLOBArray {
iterator.remove();
}
- public Iterator<indexContainer> iterator() {
+ public Iterator<ReferenceContainer> iterator() {
return this;
}
@@ -177,13 +177,13 @@ public final class indexContainerBLOBArray {
* @return the indexContainer if one exist, null otherwise
* @throws IOException
*/
- public synchronized indexContainer get(final String key) throws IOException {
+ public synchronized ReferenceContainer get(final String key) throws IOException {
List<byte[]> entries = this.array.getAll(key.getBytes());
if (entries == null || entries.size() == 0) return null;
byte[] a = entries.remove(0);
- indexContainer c = new indexContainer(key, RowSet.importRowSet(a, payloadrow));
+ ReferenceContainer c = new ReferenceContainer(key, RowSet.importRowSet(a, payloadrow));
while (entries.size() > 0) {
- c = c.merge(new indexContainer(key, RowSet.importRowSet(entries.remove(0), payloadrow)));
+ c = c.merge(new ReferenceContainer(key, RowSet.importRowSet(entries.remove(0), payloadrow)));
}
return c;
}
@@ -215,7 +215,7 @@ public final class indexContainerBLOBArray {
public byte[] rewrite(byte[] b) {
if (b == null) return null;
- indexContainer c = rewriter.rewrite(new indexContainer(this.wordHash, RowSet.importRowSet(b, payloadrow)));
+ ReferenceContainer c = rewriter.rewrite(new ReferenceContainer(this.wordHash, RowSet.importRowSet(b, payloadrow)));
if (c == null) return null;
return c.exportCollection();
}
@@ -253,7 +253,7 @@ public final class indexContainerBLOBArray {
public interface ContainerRewriter {
- public indexContainer rewrite(indexContainer container);
+ public ReferenceContainer rewrite(ReferenceContainer container);
}
diff --git a/source/de/anomic/index/indexContainerCache.java b/source/de/anomic/index/indexContainerCache.java
index a73b293c8..fab19465b 100755
--- a/source/de/anomic/index/indexContainerCache.java
+++ b/source/de/anomic/index/indexContainerCache.java
@@ -48,10 +48,10 @@ import de.anomic.kelondro.util.Log;
import de.anomic.kelondro.index.Row;
import de.anomic.kelondro.index.RowSet;
-public final class indexContainerCache implements Iterable<indexContainer>, indexRI {
+public final class indexContainerCache implements Iterable<ReferenceContainer>, ReverseIndex {
private final Row payloadrow;
- private SortedMap<String, indexContainer> cache;
+ private SortedMap<String, ReferenceContainer> cache;
/**
* opens an existing heap file in undefined mode
@@ -83,7 +83,7 @@ public final class indexContainerCache implements Iterable<indexContainer>, inde
* another dump reading afterwards is not possible
*/
public void initWriteMode() {
- this.cache = Collections.synchronizedSortedMap(new TreeMap<String, indexContainer>(new ByteOrder.StringOrder(payloadrow.getOrdering())));
+ this.cache = Collections.synchronizedSortedMap(new TreeMap<String, ReferenceContainer>(new ByteOrder.StringOrder(payloadrow.getOrdering())));
}
/**
@@ -96,10 +96,10 @@ public final class indexContainerCache implements Iterable<indexContainer>, inde
public void initWriteModeFromHeap(final File heapFile) throws IOException {
Log.logInfo("indexContainerRAMHeap", "restoring dump for rwi heap '" + heapFile.getName() + "'");
final long start = System.currentTimeMillis();
- this.cache = Collections.synchronizedSortedMap(new TreeMap<String, indexContainer>(new ByteOrder.StringOrder(payloadrow.getOrdering())));
+ this.cache = Collections.synchronizedSortedMap(new TreeMap<String, ReferenceContainer>(new ByteOrder.StringOrder(payloadrow.getOrdering())));
int urlCount = 0;
synchronized (cache) {
- for (final indexContainer container : new heapFileEntries(heapFile, this.payloadrow)) {
+ for (final ReferenceContainer container : new heapFileEntries(heapFile, this.payloadrow)) {
// TODO: in this loop a lot of memory may be allocated. A check if the memory gets low is necessary. But what do when the memory is low?
if (container == null) break;
cache.put(container.getWordHash(), container);
@@ -117,10 +117,10 @@ public final class indexContainerCache implements Iterable<indexContainer>, inde
public void initWriteModeFromBLOB(final File blobFile) throws IOException {
Log.logInfo("indexContainerRAMHeap", "restoring rwi blob dump '" + blobFile.getName() + "'");
final long start = System.currentTimeMillis();
- this.cache = Collections.synchronizedSortedMap(new TreeMap<String, indexContainer>(new ByteOrder.StringOrder(payloadrow.getOrdering())));
+ this.cache = Collections.synchronizedSortedMap(new TreeMap<String, ReferenceContainer>(new ByteOrder.StringOrder(payloadrow.getOrdering())));
int urlCount = 0;
synchronized (cache) {
- for (final indexContainer container : new blobFileEntries(blobFile, this.payloadrow)) {
+ for (final ReferenceContainer container : new blobFileEntries(blobFile, this.payloadrow)) {
// TODO: in this loop a lot of memory may be allocated. A check if the memory gets low is necessary. But what do when the memory is low?
if (container == null) break;
//System.out.println("***DEBUG indexContainerHeap.initwriteModeFromBLOB*** container.size = " + container.size() + ", container.sorted = " + container.sorted());
@@ -141,11 +141,11 @@ public final class indexContainerCache implements Iterable<indexContainer>, inde
final long startTime = System.currentTimeMillis();
long wordcount = 0, urlcount = 0;
String wordHash;
- indexContainer container;
+ ReferenceContainer container;
// write wCache
synchronized (cache) {
- for (final Map.Entry<String, indexContainer> entry: cache.entrySet()) {
+ for (final Map.Entry<String, ReferenceContainer> entry: cache.entrySet()) {
// get entries
wordHash = entry.getKey();
container = entry.getValue();
@@ -169,11 +169,11 @@ public final class indexContainerCache implements Iterable<indexContainer>, inde
/**
* static iterator of heap files: is used to import heap dumps into a write-enabled index heap
*/
- public static class heapFileEntries implements Iterator<indexContainer>, Iterable<indexContainer> {
+ public static class heapFileEntries implements Iterator<ReferenceContainer>, Iterable<ReferenceContainer> {
DataInputStream is;
byte[] word;
Row payloadrow;
- indexContainer nextContainer;
+ ReferenceContainer nextContainer;
public heapFileEntries(final File heapFile, final Row payloadrow) throws IOException {
if (!(heapFile.exists())) throw new IOException("file " + heapFile + " does not exist");
@@ -187,10 +187,10 @@ public final class indexContainerCache implements Iterable<indexContainer>, inde
return this.nextContainer != null;
}
- private indexContainer next0() {
+ private ReferenceContainer next0() {
try {
is.readFully(word);
- return new indexContainer(new String(word), RowSet.importRowSet(is, payloadrow));
+ return new ReferenceContainer(new String(word), RowSet.importRowSet(is, payloadrow));
} catch (final IOException e) {
return null;
}
@@ -200,8 +200,8 @@ public final class indexContainerCache implements Iterable<indexContainer>, inde
* return an index container
* because they may get very large, it is wise to deallocate some memory before calling next()
*/
- public indexContainer next() {
- final indexContainer n = this.nextContainer;
+ public ReferenceContainer next() {
+ final ReferenceContainer n = this.nextContainer;
this.nextContainer = next0();
return n;
}
@@ -210,7 +210,7 @@ public final class indexContainerCache implements Iterable<indexContainer>, inde
throw new UnsupportedOperationException("heap dumps are read-only");
}
- public Iterator<indexContainer> iterator() {
+ public Iterator<ReferenceContainer> iterator() {
return this;
}
@@ -227,7 +227,7 @@ public final class indexContainerCache implements Iterable<indexContainer>, inde
/**
* static iterator of BLOBHeap files: is used to import heap dumps into a write-enabled index heap
*/
- public static class blobFileEntries implements Iterator<indexContainer>, Iterable<indexContainer> {
+ public static class blobFileEntries implements Iterator<ReferenceContainer>, Iterable<ReferenceContainer> {
Iterator<Map.Entry<String, byte[]>> blobs;
Row payloadrow;
@@ -244,17 +244,17 @@ public final class indexContainerCache implements Iterable<indexContainer>, inde
* return an index container
* because they may get very large, it is wise to deallocate some memory before calling next()
*/
- public indexContainer next() {
+ public ReferenceContainer next() {
Map.Entry<String, byte[]> entry = blobs.next();
byte[] payload = entry.getValue();
- return new indexContainer(entry.getKey(), RowSet.importRowSet(payload, payloadrow));
+ return new ReferenceContainer(entry.getKey(), RowSet.importRowSet(payload, payloadrow));
}
public void remove() {
throw new UnsupportedOperationException("heap dumps are read-only");
}
- public Iterator<indexContainer> iterator() {
+ public Iterator<ReferenceContainer> iterator() {
return this;
}
@@ -270,7 +270,7 @@ public final class indexContainerCache implements Iterable<indexContainer>, inde
public synchronized int maxReferences() {
// iterate to find the max score
int max = 0;
- for (indexContainer container : cache.values()) {
+ for (ReferenceContainer container : cache.values()) {
if (container.size() > max) max = container.size();
}
return max;
@@ -280,7 +280,7 @@ public final class indexContainerCache implements Iterable<indexContainer>, inde
// iterate to find the max score
int max = 0;
String hash = null;
- for (indexContainer container : cache.values()) {
+ for (ReferenceContainer container : cache.values()) {
if (container.size() > max) {
max = container.size();
hash = container.getWordHash();
@@ -292,7 +292,7 @@ public final class indexContainerCache implements Iterable<indexContainer>, inde
public synchronized ArrayList<String> maxReferencesHash(int bound) {
// iterate to find the max score
ArrayList<String> hashes = new ArrayList<String>();
- for (indexContainer container : cache.values()) {
+ for (ReferenceContainer container : cache.values()) {
if (container.size() >= bound) {
hashes.add(container.getWordHash());
}
@@ -300,18 +300,18 @@ public final class indexContainerCache implements Iterable<indexContainer>, inde
return hashes;
}
- public synchronized indexContainer latest() {
- indexContainer c = null;
- for (indexContainer container : cache.values()) {
+ public synchronized ReferenceContainer latest() {
+ ReferenceContainer c = null;
+ for (ReferenceContainer container : cache.values()) {
if (c == null) {c = container; continue;}
if (container.lastWrote() > c.lastWrote()) {c = container; continue;}
}
return c;
}
- public synchronized indexContainer first() {
- indexContainer c = null;
- for (indexContainer container : cache.values()) {
+ public synchronized ReferenceContainer first() {
+ ReferenceContainer c = null;
+ for (ReferenceContainer container : cache.values()) {
if (c == null) {c = container; continue;}
if (container.lastWrote() < c.lastWrote()) {c = container; continue;}
}
@@ -321,7 +321,7 @@ public final class indexContainerCache implements Iterable<indexContainer>, inde
public synchronized ArrayList<String> overAge(long maxage) {
ArrayList<String> hashes = new ArrayList<String>();
long limit = System.currentTimeMillis() - maxage;
- for (indexContainer container : cache.values()) {
+ for (ReferenceContainer container : cache.values()) {
if (container.lastWrote() < limit) hashes.add(container.getWordHash());
}
return hashes;
@@ -332,13 +332,13 @@ public final class indexContainerCache implements Iterable<indexContainer>, inde
* in the cache, so that manipulations of the iterated objects do not change
* objects in the cache.
*/
- public synchronized CloneableIterator<indexContainer> wordContainerIterator(final String startWordHash, final boolean rot, final boolean ram) {
+ public synchronized CloneableIterator<ReferenceContainer> referenceIterator(final String startWordHash, final boolean rot, final boolean ram) {
return new heapCacheIterator(startWordHash, rot);
}
- public Iterator<indexContainer> iterator() {
- return wordContainerIterator(null, false, true);
+ public Iterator<ReferenceContainer> iterator() {
+ return referenceIterator(null, false, true);
}
@@ -346,7 +346,7 @@ public final class indexContainerCache implements Iterable<indexContainer>, inde
* cache iterator: iterates objects within the heap cache. This can only be used
* for write-enabled heaps, read-only heaps do not have a heap cache
*/
- public class heapCacheIterator implements CloneableIterator<indexContainer>, Iterable<indexContainer> {
+ public class heapCacheIterator implements CloneableIterator<ReferenceContainer>, Iterable<ReferenceContainer> {
// this class exists, because the wCache cannot be iterated with rotation
// and because every indexContainer Object that is iterated must be returned as top-level-clone
@@ -354,7 +354,7 @@ public final class indexContainerCache implements Iterable<indexContainer>, inde
// plus the mentioned features
private final boolean rot;
- private Iterator<indexContainer> iterator;
+ private Iterator<ReferenceContainer> iterator;
public heapCacheIterator(final String startWordHash, final boolean rot) {
this.rot = rot;
@@ -371,7 +371,7 @@ public final class indexContainerCache implements Iterable<indexContainer>, inde
return iterator.hasNext();
}
- public indexContainer next() {
+ public ReferenceContainer next() {
if (iterator.hasNext()) {
return (iterator.next()).topLevelClone();
}
@@ -387,7 +387,7 @@ public final class indexContainerCache implements Iterable<indexContainer>, inde
iterator.remove();
}
- public Iterator<indexContainer> iterator() {
+ public Iterator<ReferenceContainer> iterator() {
return this;
}
@@ -399,7 +399,7 @@ public final class indexContainerCache implements Iterable<indexContainer>, inde
* @param key
* @return true, if the key is used in the heap; false othervise
*/
- public boolean hasContainer(final String key) {
+ public boolean hasReferences(final String key) {
return this.cache.containsKey(key);
}
@@ -408,14 +408,14 @@ public final class indexContainerCache implements Iterable<indexContainer>, inde
* @param key
* @return the indexContainer if one exist, null otherwise
*/
- public indexContainer getContainer(final String key, Set<String> urlselection) {
+ public ReferenceContainer getReferences(final String key, Set<String> urlselection) {
if (urlselection == null) return this.cache.get(key);
- indexContainer c = this.cache.get(key);
+ ReferenceContainer c = this.cache.get(key);
if (c == null) return null;
// because this is all in RAM, we must clone the entries (flat)
- indexContainer c1 = new indexContainer(c.getWordHash(), c.row(), c.size());
- Iterator<indexRWIRowEntry> e = c.entries();
- indexRWIRowEntry ee;
+ ReferenceContainer c1 = new ReferenceContainer(c.getWordHash(), c.row(), c.size());
+ Iterator<ReferenceRow> e = c.entries();
+ ReferenceRow ee;
while (e.hasNext()) {
ee = e.next();
if (urlselection.contains(ee.urlHash())) c1.add(ee);
@@ -428,8 +428,8 @@ public final class indexContainerCache implements Iterable<indexContainer>, inde
* @param key
* @return
*/
- public int sizeEntry(final String key) {
- indexContainer c = this.cache.get(key);
+ public int countReferences(final String key) {
+ ReferenceContainer c = this.cache.get(key);
if (c == null) return 0;
return c.size();
}
@@ -439,19 +439,19 @@ public final class indexContainerCache implements Iterable<indexContainer>, inde
* @param wordHash
* @return the indexContainer if the cache contained the container, null othervise
*/
- public synchronized indexContainer deleteContainer(final String wordHash) {
+ public synchronized ReferenceContainer deleteAllReferences(final String wordHash) {
// returns the index that had been deleted
assert this.cache != null;
return cache.remove(wordHash);
}
- public synchronized boolean removeEntry(final String wordHash, final String urlHash) {
+ public synchronized boolean removeReference(final String wordHash, final String urlHash) {
assert this.cache != null;
- final indexContainer c = cache.get(wordHash);
+ final ReferenceContainer c = cache.get(wordHash);
if ((c != null) && (c.remove(urlHash) != null)) {
// removal successful
if (c.size() == 0) {
- deleteContainer(wordHash);
+ deleteAllReferences(wordHash);
} else {
cache.put(wordHash, c);
}
@@ -460,15 +460,15 @@ public final class indexContainerCache implements Iterable<indexContainer>, inde
return false;
}
- public synchronized int removeEntries(final String wordHash, final Set<String> urlHashes) {
+ public synchronized int removeReferences(final String wordHash, final Set<String> urlHashes) {
assert this.cache != null;
if (urlHashes.size() == 0) return 0;
- final indexContainer c = cache.get(wordHash);
+ final ReferenceContainer c = cache.get(wordHash);
int count;
if ((c != null) && ((count = c.removeEntries(urlHashes)) > 0)) {
// removal successful
if (c.size() == 0) {
- deleteContainer(wordHash);
+ deleteAllReferences(wordHash);
} else {
cache.put(wordHash, c);
}
@@ -477,7 +477,7 @@ public final class indexContainerCache implements Iterable<indexContainer>, inde
return 0;
}
- public synchronized void addEntries(final indexContainer container) {
+ public synchronized void addReferences(final ReferenceContainer container) {
// this puts the entries into the cache
int added = 0;
if ((container == null) || (container.size() == 0)) return;
@@ -485,7 +485,7 @@ public final class indexContainerCache implements Iterable<indexContainer>, inde
// put new words into cache
final String wordHash = container.getWordHash();
- indexContainer entries = cache.get(wordHash); // null pointer exception? wordhash != null! must be cache==null
+ ReferenceContainer entries = cache.get(wordHash); // null pointer exception? wordhash != null! must be cache==null
if (entries == null) {
entries = container.topLevelClone();
added = entries.size();
@@ -499,10 +499,10 @@ public final class indexContainerCache implements Iterable<indexContainer>, inde
return;
}
- public synchronized void addEntry(final String wordHash, final indexRWIRowEntry newEntry) {
+ public synchronized void addEntry(final String wordHash, final ReferenceRow newEntry) {
assert this.cache != null;
- indexContainer container = cache.get(wordHash);
- if (container == null) container = new indexContainer(wordHash, this.payloadrow, 1);
+ ReferenceContainer container = cache.get(wordHash);
+ if (container == null) container = new ReferenceContainer(wordHash, this.payloadrow, 1);
container.put(newEntry);
cache.put(wordHash, container);
}
diff --git a/source/de/anomic/index/indexContainerOrder.java b/source/de/anomic/index/indexContainerOrder.java
index ee1a0515f..fb3c41b85 100644
--- a/source/de/anomic/index/indexContainerOrder.java
+++ b/source/de/anomic/index/indexContainerOrder.java
@@ -29,7 +29,7 @@ package de.anomic.index;
import de.anomic.kelondro.order.AbstractOrder;
import de.anomic.kelondro.order.Order;
-public class indexContainerOrder extends AbstractOrder<indexContainer> implements Order<indexContainer>, Cloneable {
+public class indexContainerOrder extends AbstractOrder<ReferenceContainer> implements Order<ReferenceContainer>, Cloneable {
private final Order<byte[]> embeddedOrder;
@@ -37,7 +37,7 @@ public class indexContainerOrder extends AbstractOrder<indexContainer> implement
this.embeddedOrder = embedOrder;
}
- public boolean wellformed(final indexContainer a) {
+ public boolean wellformed(final ReferenceContainer a) {
return embeddedOrder.wellformed(a.getWordHash().getBytes());
}
@@ -49,16 +49,16 @@ public class indexContainerOrder extends AbstractOrder<indexContainer> implement
return this.embeddedOrder.partition(key, forks);
}
- public int compare(final indexContainer a, final indexContainer b) {
+ public int compare(final ReferenceContainer a, final ReferenceContainer b) {
return this.embeddedOrder.compare(a.getWordHash().getBytes(), b.getWordHash().getBytes());
}
- public void rotate(final indexContainer zero) {
+ public void rotate(final ReferenceContainer zero) {
this.embeddedOrder.rotate(zero.getWordHash().getBytes());
- this.zero = new indexContainer(new String(this.embeddedOrder.zero()), zero);
+ this.zero = new ReferenceContainer(new String(this.embeddedOrder.zero()), zero);
}
- public Order<indexContainer> clone() {
+ public Order<ReferenceContainer> clone() {
return new indexContainerOrder(this.embeddedOrder.clone());
}
@@ -70,12 +70,12 @@ public class indexContainerOrder extends AbstractOrder<indexContainer> implement
return this.embeddedOrder.cardinal(key);
}
- public boolean equals(final Order<indexContainer> otherOrder) {
+ public boolean equals(final Order<ReferenceContainer> otherOrder) {
if (!(otherOrder instanceof indexContainerOrder)) return false;
return this.embeddedOrder.equals(((indexContainerOrder) otherOrder).embeddedOrder);
}
- public long cardinal(final indexContainer key) {
+ public long cardinal(final ReferenceContainer key) {
return this.embeddedOrder.cardinal(key.getWordHash().getBytes());
}
diff --git a/source/de/anomic/index/indexRI.java b/source/de/anomic/index/indexRI.java
deleted file mode 100644
index 896a0aeef..000000000
--- a/source/de/anomic/index/indexRI.java
+++ /dev/null
@@ -1,51 +0,0 @@
-// indexRI.java
-// -----------------------------
-// (C) 2005 by Michael Peter Christen; [email protected], Frankfurt a. M., Germany
-// first published 6.5.2005 on http://www.anomic.de
-//
-// This is a part of YaCy, a peer-to-peer based web search engine
-//
-// $LastChangedDate: 2006-04-02 22:40:07 +0200 (So, 02 Apr 2006) $
-// $LastChangedRevision: 1986 $
-// $LastChangedBy: orbiter $
-//
-// LICENSE
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
-package de.anomic.index;
-
-import java.io.IOException;
-import java.util.Set;
-
-import de.anomic.kelondro.order.CloneableIterator;
-
-public interface indexRI {
-
- public int size();
- public int minMem();
- public CloneableIterator<indexContainer> wordContainerIterator(String startWordHash, boolean rot, boolean ram) throws IOException; // method to replace wordHashes
- public boolean hasContainer(String wordHash); // should only be used if in case that true is returned the getContainer is NOT called
- public indexContainer getContainer(String wordHash, Set<String> urlselection) throws IOException; // if urlselection != null all url references which are not in urlselection are removed from the container
- public indexContainer deleteContainer(String wordHash) throws IOException;
- public boolean removeEntry(String wordHash, String urlHash) throws IOException;
- public int removeEntries(String wordHash, Set<String> urlHashes) throws IOException;
- public void addEntries(indexContainer newEntries) throws IOException;
- public int sizeEntry(final String key);
- public void clear() throws IOException;
- public void close();
-
-}
diff --git a/source/de/anomic/plasma/plasmaCondenser.java b/source/de/anomic/plasma/plasmaCondenser.java
index e0541cb6f..73e702552 100644
--- a/source/de/anomic/plasma/plasmaCondenser.java
+++ b/source/de/anomic/plasma/plasmaCondenser.java
@@ -49,8 +49,8 @@ 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.index.indexWord;
+import de.anomic.index.Reference;
+import de.anomic.index.Word;
import de.anomic.kelondro.order.Bitfield;
import de.anomic.kelondro.util.SetTools;
import de.anomic.language.identification.Identificator;
@@ -89,7 +89,7 @@ public final class plasmaCondenser {
private final static int numlength = 5;
//private Properties analysis;
- private TreeMap<String, indexWord> words; // a string (the words) to (indexWord) - relation
+ private TreeMap<String, Word> words; // a string (the words) to (indexWord) - relation
private final int wordminsize;
private final int wordcut;
@@ -106,7 +106,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, indexWord>();
+ this.words = new TreeMap<String, Word>();
this.RESULT_FLAGS = new Bitfield(4);
// construct flag set for document
@@ -133,13 +133,13 @@ public final class plasmaCondenser {
// phrase 99 is taken from the media Link url and anchor description
// phrase 100 and above are lines from the text
- insertTextToWords(document.dc_title(), 1, indexRWIEntry.flag_app_dc_title, RESULT_FLAGS, true);
- insertTextToWords(document.dc_description(), 3, indexRWIEntry.flag_app_dc_description, RESULT_FLAGS, true);
- insertTextToWords(document.dc_creator(), 4, indexRWIEntry.flag_app_dc_creator, RESULT_FLAGS, true);
+ insertTextToWords(document.dc_title(), 1, Reference.flag_app_dc_title, RESULT_FLAGS, true);
+ insertTextToWords(document.dc_description(), 3, Reference.flag_app_dc_description, RESULT_FLAGS, true);
+ insertTextToWords(document.dc_creator(), 4, Reference.flag_app_dc_creator, RESULT_FLAGS, true);
// missing: tags!
final String[] titles = document.getSectionTitles();
for (int i = 0; i < titles.length; i++) {
- insertTextToWords(titles[i], i + 10, indexRWIEntry.flag_app_emphasized, RESULT_FLAGS, true);
+ insertTextToWords(titles[i], i + 10, Reference.flag_app_emphasized, RESULT_FLAGS, true);
}
// anchors: for text indexing we add only the anchor description
@@ -164,7 +164,7 @@ public final class plasmaCondenser {
}
// add the URL components to the word list
- insertTextToWords(document.dc_source().toNormalform(false, true), 0, indexRWIEntry.flag_app_dc_identifier, RESULT_FLAGS, false);
+ insertTextToWords(document.dc_source().toNormalform(false, true), 0, Reference.flag_app_dc_identifier, RESULT_FLAGS, false);
if (indexMedia) {
// add anchor descriptions: here, we also add the url components
@@ -202,9 +202,9 @@ public final class plasmaCondenser {
}
// finally check all words for missing flag entry
- final Iterator<Map.Entry<String, indexWord>> k = words.entrySet().iterator();
- indexWord wprop;
- Map.Entry<String, indexWord> we;
+ final Iterator<Map.Entry<String, Word>> k = words.entrySet().iterator();
+ Word wprop;
+ Map.Entry<String, Word> we;
while (k.hasNext()) {
we = k.next();
wprop = we.getValue();
@@ -218,7 +218,7 @@ public final class plasmaCondenser {
private void insertTextToWords(final String text, final int phrase, final int flagpos, final Bitfield flagstemplate, boolean useForLanguageIdentification) {
String word;
- indexWord wprop;
+ Word wprop;
sievedWordsEnum wordenum;
try {
wordenum = new sievedWordsEnum(new ByteArrayInputStream(text.getBytes("UTF-8")));
@@ -231,7 +231,7 @@ public final class plasmaCondenser {
if (useForLanguageIdentification) languageIdentificator.add(word);
if (word.length() < 3) continue;
wprop = words.get(word);
- if (wprop == null) wprop = new indexWord(0, pip, phrase);
+ if (wprop == null) wprop = new Word(0, pip, phrase);
if (wprop.flags == null) wprop.flags = flagstemplate.clone();
wprop.flags.set(flagpos, true);
words.put(word, wprop);
@@ -250,7 +250,7 @@ public final class plasmaCondenser {
this.wordcut = wordcut;
this.languageIdentificator = null; // we don't need that here
// analysis = new Properties();
- words = new TreeMap<String, indexWord>();
+ words = new TreeMap<String, Word>();
createCondensement(text, charset);
}
@@ -262,7 +262,7 @@ public final class plasmaCondenser {
return oldsize - words.size();
}
- public Map<String, indexWord> words() {
+ public Map<String, Word> words() {
// returns the words as word/indexWord relation map
return words;
}
@@ -283,7 +283,7 @@ public final class plasmaCondenser {
String word = "";
String k;
int wordlen;
- indexWord wsp, wsp1;
+ Word wsp, wsp1;
indexPhrase psp;
int wordHandle;
int wordHandleCount = 0;
@@ -374,7 +374,7 @@ public final class plasmaCondenser {
} else {
// word does not yet exist, create new word entry
wordHandle = wordHandleCount++;
- wsp = new indexWord(wordHandle, wordInSentenceCounter, sentences.size() + 100);
+ wsp = new Word(wordHandle, wordInSentenceCounter, sentences.size() + 100);
wsp.flags = RESULT_FLAGS.clone();
}
words.put(word, wsp);
@@ -430,10 +430,10 @@ public final class plasmaCondenser {
}
}
- Map.Entry<String, indexWord> entry;
+ Map.Entry<String, Word> entry;
// we search for similar words and reorganize the corresponding sentences
// a word is similar, if a shortened version is equal
- final Iterator<Map.Entry<String, indexWord>> wi = words.entrySet().iterator(); // enumerates the keys in descending order
+ final Iterator<Map.Entry<String, Word>> wi = words.entrySet().iterator(); // enumerates the keys in descending order
wordsearch: while (wi.hasNext()) {
entry = wi.next();
word = entry.getKey();
@@ -705,7 +705,7 @@ public final class plasmaCondenser {
return s;
}
- public static Map<String, indexWord> getWords(final String text) {
+ public static Map<String, Word> getWords(final String text) {
// returns a word/indexWord relation map
if (text == null) return null;
ByteArrayInputStream buffer;
@@ -734,7 +734,7 @@ public final class plasmaCondenser {
final String s = p.getProperty("keywords" + i);
final String[] l = s.split(",");
for (int j = 0; j < l.length; j++) {
- sb.append(indexWord.word2hash(l[j]));
+ sb.append(Word.word2hash(l[j]));
}
if (i < 15) sb.append(",\n");
}
diff --git a/source/de/anomic/plasma/plasmaDbImporter.java b/source/de/anomic/plasma/plasmaDbImporter.java
index 6695e383d..344ebc506 100644
--- a/source/de/anomic/plasma/plasmaDbImporter.java
+++ b/source/de/anomic/plasma/plasmaDbImporter.java
@@ -6,10 +6,10 @@ import java.util.TreeSet;
import de.anomic.crawler.AbstractImporter;
import de.anomic.crawler.Importer;
-import de.anomic.index.indexContainer;
-import de.anomic.index.indexRWIEntry;
-import de.anomic.index.indexRWIRowEntry;
-import de.anomic.index.indexURLReference;
+import de.anomic.index.ReferenceContainer;
+import de.anomic.index.Reference;
+import de.anomic.index.ReferenceRow;
+import de.anomic.index.URLMetadata;
import de.anomic.kelondro.order.DateFormatter;
public class plasmaDbImporter extends AbstractImporter implements Importer {
@@ -101,11 +101,11 @@ public class plasmaDbImporter extends AbstractImporter implements Importer {
// iterate over all words from import db
//Iterator importWordHashIterator = this.importWordIndex.wordHashes(this.wordChunkStartHash, plasmaWordIndex.RL_WORDFILES, false);
- Iterator<indexContainer> indexContainerIterator = this.importWordIndex.indexContainerSet(this.wordChunkStartHash, false, false, 100).iterator();
+ Iterator<ReferenceContainer> indexContainerIterator = this.importWordIndex.indexContainerSet(this.wordChunkStartHash, false, false, 100).iterator();
while (!isAborted() && indexContainerIterator.hasNext()) {
final TreeSet<String> entityUrls = new TreeSet<String>();
- indexContainer newContainer = null;
+ ReferenceContainer newContainer = null;
try {
this.wordCounter++;
newContainer = indexContainerIterator.next();
@@ -113,8 +113,8 @@ public class plasmaDbImporter extends AbstractImporter implements Importer {
// loop throug the entities of the container and get the
// urlhash
- final Iterator<indexRWIRowEntry> importWordIdxEntries = newContainer.entries();
- indexRWIEntry importWordIdxEntry;
+ final Iterator<ReferenceRow> importWordIdxEntries = newContainer.entries();
+ Reference importWordIdxEntry;
while (importWordIdxEntries.hasNext()) {
// testing if import process was aborted
if (isAborted()) break;
@@ -141,7 +141,7 @@ public class plasmaDbImporter extends AbstractImporter implements Importer {
// we need to import the url
// getting the url entry
- final indexURLReference urlEntry = this.importWordIndex.getURL(urlHash, null, 0);
+ final URLMetadata urlEntry = this.importWordIndex.getURL(urlHash, null, 0);
if (urlEntry != null) {
/* write it into the home url db */
@@ -169,10 +169,10 @@ public class plasmaDbImporter extends AbstractImporter implements Importer {
if (isAborted()) break;
// importing entity container to home db
- if (newContainer.size() > 0) { homeWordIndex.addEntries(newContainer); }
+ if (newContainer.size() > 0) { homeWordIndex.addReferences(newContainer); }
// delete complete index entity file
- this.importWordIndex.deleteContainer(this.wordHash);
+ this.importWordIndex.deleteAllReferences(this.wordHash);
// print out some statistical information
if (this.entryCounter % 500 == 0) {
@@ -203,7 +203,7 @@ public class plasmaDbImporter extends AbstractImporter implements Importer {
if (!indexContainerIterator.hasNext()) {
// We may not be finished yet, try to get the next chunk of wordHashes
- final TreeSet<indexContainer> containers = this.importWordIndex.indexContainerSet(this.wordHash, false, false, 100);
+ final TreeSet<ReferenceContainer> containers = this.importWordIndex.indexContainerSet(this.wordHash, false, false, 100);
indexContainerIterator = containers.iterator();
// Make sure we don't get the same wordhash twice, but don't skip a word
if ((indexContainerIterator.hasNext())&&(!this.wordHash.equals((indexContainerIterator.next()).getWordHash()))) {
diff --git a/source/de/anomic/plasma/plasmaRankingCRProcess.java b/source/de/anomic/plasma/plasmaRankingCRProcess.java
index 1f1e5b89b..1d156ae5f 100644
--- a/source/de/anomic/plasma/plasmaRankingCRProcess.java
+++ b/source/de/anomic/plasma/plasmaRankingCRProcess.java
@@ -31,7 +31,7 @@ import java.io.IOException;
import java.util.Iterator;
import de.anomic.index.indexCollectionRI;
-import de.anomic.index.indexContainer;
+import de.anomic.index.ReferenceContainer;
import de.anomic.kelondro.index.Row;
import de.anomic.kelondro.index.RowSet;
import de.anomic.kelondro.index.ObjectIndex;
@@ -381,8 +381,8 @@ public class plasmaRankingCRProcess {
final int size = seq.size();
final long start = System.currentTimeMillis();
long l;
- final CloneableIterator<indexContainer> i = seq.wordContainerIterator(null, false, false);
- indexContainer keycollection;
+ final CloneableIterator<ReferenceContainer> i = seq.referenceIterator(null, false, false);
+ ReferenceContainer keycollection;
String referee, refereeDom, anchor, anchorDom;
RowSet rci_entry;
CloneableIterator<Row.Entry> cr_entry;
@@ -400,7 +400,7 @@ public class plasmaRankingCRProcess {
if (anchor.length() == 6) anchorDom = anchor; else anchorDom = anchor.substring(6);
// update domain-specific entry
- rci_entry = rci.getContainer(anchorDom, null);
+ rci_entry = rci.getReferences(anchorDom, null);
if (rci_entry == null) rci_entry = new RowSet(RCI_coli, 0);
rci_entry.add(refereeDom.getBytes());
diff --git a/source/de/anomic/plasma/plasmaSearchAPI.java b/source/de/anomic/plasma/plasmaSearchAPI.java
index 69cf1a5e0..254be1419 100644
--- a/source/de/anomic/plasma/plasmaSearchAPI.java
+++ b/source/de/anomic/plasma/plasmaSearchAPI.java
@@ -33,9 +33,9 @@ import java.util.Iterator;
import java.util.List;
import de.anomic.data.listManager;
-import de.anomic.index.indexRWIEntry;
+import de.anomic.index.Reference;
import de.anomic.index.indexReferenceBlacklist;
-import de.anomic.index.indexURLReference;
+import de.anomic.index.URLMetadata;
import de.anomic.kelondro.order.Bitfield;
import de.anomic.kelondro.order.DateFormatter;
import de.anomic.server.serverObjects;
@@ -54,12 +54,12 @@ public class plasmaSearchAPI {
if (post.get("flags","").length() == 0) return null;
return new Bitfield(4, post.get("flags"));
}
- if (post.get("description", "").equals("on")) b.set(indexRWIEntry.flag_app_dc_description, true);
- if (post.get("title", "").equals("on")) b.set(indexRWIEntry.flag_app_dc_title, true);
- if (post.get("creator", "").equals("on")) b.set(indexRWIEntry.flag_app_dc_creator, true);
- if (post.get("subject", "").equals("on")) b.set(indexRWIEntry.flag_app_dc_subject, true);
- if (post.get("url", "").equals("on")) b.set(indexRWIEntry.flag_app_dc_identifier, true);
- if (post.get("emphasized", "").equals("on")) b.set(indexRWIEntry.flag_app_emphasized, true);
+ if (post.get("description", "").equals("on")) b.set(Reference.flag_app_dc_description, true);
+ if (post.get("title", "").equals("on")) b.set(Reference.flag_app_dc_title, true);
+ if (post.get("creator", "").equals("on")) b.set(Reference.flag_app_dc_creator, true);
+ if (post.get("subject", "").equals("on")) b.set(Reference.flag_app_dc_subject, true);
+ if (post.get("url", "").equals("on")) b.set(Reference.flag_app_dc_identifier, true);
+ if (post.get("emphasized", "").equals("on")) b.set(Reference.flag_app_emphasized, true);
if (post.get("image", "").equals("on")) b.set(plasmaCondenser.flag_cat_hasimage, true);
if (post.get("audio", "").equals("on")) b.set(plasmaCondenser.flag_cat_hasaudio, true);
if (post.get("video", "").equals("on")) b.set(plasmaCondenser.flag_cat_hasvideo, true);
@@ -96,12 +96,12 @@ public class plasmaSearchAPI {
} else {
prop.put("searchresult", 3);
prop.put("searchresult_allurl", ranked.filteredCount());
- prop.put("searchresult_description", ranked.flagCount()[indexRWIEntry.flag_app_dc_description]);
- prop.put("searchresult_title", ranked.flagCount()[indexRWIEntry.flag_app_dc_title]);
- prop.put("searchresult_creator", ranked.flagCount()[indexRWIEntry.flag_app_dc_creator]);
- prop.put("searchresult_subject", ranked.flagCount()[indexRWIEntry.flag_app_dc_subject]);
- prop.put("searchresult_url", ranked.flagCount()[indexRWIEntry.flag_app_dc_identifier]);
- prop.put("searchresult_emphasized", ranked.flagCount()[indexRWIEntry.flag_app_emphasized]);
+ prop.put("searchresult_description", ranked.flagCount()[Reference.flag_app_dc_description]);
+ prop.put("searchresult_title", ranked.flagCount()[Reference.flag_app_dc_title]);
+ prop.put("searchresult_creator", ranked.flagCount()[Reference.flag_app_dc_creator]);
+ prop.put("searchresult_subject", ranked.flagCount()[Reference.flag_app_dc_subject]);
+ prop.put("searchresult_url", ranked.flagCount()[Reference.flag_app_dc_identifier]);
+ prop.put("searchresult_emphasized", ranked.flagCount()[Reference.flag_app_emphasized]);
prop.put("searchresult_image", ranked.flagCount()[plasmaCondenser.flag_cat_hasimage]);
prop.put("searchresult_audio", ranked.flagCount()[plasmaCondenser.flag_cat_hasaudio]);
prop.put("searchresult_video", ranked.flagCount()[plasmaCondenser.flag_cat_hasvideo]);
@@ -126,7 +126,7 @@ public class plasmaSearchAPI {
prop.put("genUrlList_lines", maxlines);
int i = 0;
yacyURL url;
- indexURLReference entry;
+ URLMetadata entry;
String us;
long rn = -1;
while ((ranked.size() > 0) && ((entry = ranked.bestURL(false)) != null)) {
@@ -166,12 +166,12 @@ public class plasmaSearchAPI {
((entry.word().flags().get(plasmaCondenser.flag_cat_hasaudio)) ? "contains audio, " : "") +
((entry.word().flags().get(plasmaCondenser.flag_cat_hasvideo)) ? "contains video, " : "") +
((entry.word().flags().get(plasmaCondenser.flag_cat_hasapp)) ? "contains applications, " : "") +
- ((entry.word().flags().get(indexRWIEntry.flag_app_dc_identifier)) ? "appears in url, " : "") +
- ((entry.word().flags().get(indexRWIEntry.flag_app_dc_title)) ? "appears in title, " : "") +
- ((entry.word().flags().get(indexRWIEntry.flag_app_dc_creator)) ? "appears in author, " : "") +
- ((entry.word().flags().get(indexRWIEntry.flag_app_dc_subject)) ? "appears in subject, " : "") +
- ((entry.word().flags().get(indexRWIEntry.flag_app_dc_description)) ? "appears in description, " : "") +
- ((entry.word().flags().get(indexRWIEntry.flag_app_emphasized)) ? "appears emphasized, " : "") +
+ ((entry.word().flags().get(Reference.flag_app_dc_identifier)) ? "appears in url, " : "") +
+ ((entry.word().flags().get(Reference.flag_app_dc_title)) ? "appears in title, " : "") +
+ ((entry.word().flags().get(Reference.flag_app_dc_creator)) ? "appears in author, " : "") +
+ ((entry.word().flags().get(Reference.flag_app_dc_subject)) ? "appears in subject, " : "") +
+ ((entry.word().flags().get(Reference.flag_app_dc_description)) ? "appears in description, " : "") +
+ ((entry.word().flags().get(Reference.flag_app_emphasized)) ? "appears emphasized, " : "") +
((yacyURL.probablyRootURL(entry.word().urlHash())) ? "probably root url" : "")
);
if (plasmaSwitchboard.urlBlacklist.isListed(indexReferenceBlacklist.BLACKLIST_DHT, url)) {
diff --git a/source/de/anomic/plasma/plasmaSearchEvent.java b/source/de/anomic/plasma/plasmaSearchEvent.java
index 94c33baca..0affee773 100644
--- a/source/de/anomic/plasma/plasmaSearchEvent.java
+++ b/source/de/anomic/plasma/plasmaSearchEvent.java
@@ -37,10 +37,10 @@ import java.util.TreeSet;
import java.util.concurrent.ConcurrentHashMap;
import de.anomic.crawler.ResultURLs;
-import de.anomic.index.indexContainer;
-import de.anomic.index.indexRWIEntry;
-import de.anomic.index.indexRWIVarEntry;
-import de.anomic.index.indexURLReference;
+import de.anomic.index.ReferenceContainer;
+import de.anomic.index.Reference;
+import de.anomic.index.ReferenceVars;
+import de.anomic.index.URLMetadata;
import de.anomic.kelondro.order.Bitfield;
import de.anomic.kelondro.util.MemoryControl;
import de.anomic.kelondro.util.SetTools;
@@ -174,9 +174,9 @@ public final class plasmaSearchEvent {
int maxcount = -1;
long mindhtdistance = Long.MAX_VALUE, l;
String wordhash;
- for (Map.Entry<String, indexContainer> entry : this.rankedCache.searchContainerMaps()[0].entrySet()) {
+ for (Map.Entry<String, ReferenceContainer> entry : this.rankedCache.searchContainerMaps()[0].entrySet()) {
wordhash = entry.getKey();
- final indexContainer container = entry.getValue();
+ final ReferenceContainer container = entry.getValue();
assert (container.getWordHash().equals(wordhash));
if (container.size() > maxcount) {
IAmaxcounthash = wordhash;
@@ -189,7 +189,7 @@ public final class plasmaSearchEvent {
IAneardhthash = wordhash;
}
IACount.put(wordhash, Integer.valueOf(container.size()));
- IAResults.put(wordhash, indexContainer.compressIndex(container, null, 1000).toString());
+ IAResults.put(wordhash, ReferenceContainer.compressIndex(container, null, 1000).toString());
}
serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(query.id(true), "abstract generation", this.rankedCache.searchContainerMaps()[0].size(), System.currentTimeMillis() - timer));
}
@@ -257,7 +257,7 @@ public final class plasmaSearchEvent {
}
}
- ResultEntry obtainResultEntry(final indexURLReference page, final int snippetFetchMode) {
+ ResultEntry obtainResultEntry(final URLMetadata page, final int snippetFetchMode) {
// a search result entry needs some work to produce a result Entry:
// - check if url entry exists in LURL-db
@@ -273,7 +273,7 @@ public final class plasmaSearchEvent {
// find the url entry
long startTime = System.currentTimeMillis();
- final indexURLReference.Components comp = page.comp();
+ final URLMetadata.Components comp = page.comp();
final String pagetitle = comp.dc_title().toLowerCase();
if (comp.url() == null) {
registerFailure(page.hash(), "url corrupted (null)");
@@ -300,7 +300,7 @@ public final class plasmaSearchEvent {
(query.constraint.get(plasmaCondenser.flag_cat_indexof)) &&
(!(comp.dc_title().startsWith("Index of")))) {
final Iterator<String> wi = query.queryHashes.iterator();
- while (wi.hasNext()) wordIndex.removeEntry(wi.next(), page.hash());
+ while (wi.hasNext()) wordIndex.removeReference(wi.next(), page.hash());
registerFailure(page.hash(), "index-of constraint not fullfilled");
return null;
}
@@ -500,7 +500,7 @@ public final class plasmaSearchEvent {
public void run() {
// start fetching urls and snippets
- indexURLReference page;
+ URLMetadata page;
final int fetchAhead = snippetMode == 0 ? 0 : 10;
while (System.currentTimeMillis() < this.timeout) {
this.lastLifeSign = System.currentTimeMillis();
@@ -791,8 +791,8 @@ public final class plasmaSearchEvent {
public static class ResultEntry {
// payload objects
- private final indexURLReference urlentry;
- private final indexURLReference.Components urlcomps; // buffer for components
+ private final URLMetadata urlentry;
+ private final URLMetadata.Components urlcomps; // buffer for components
private String alternative_urlstring;
private String alternative_urlname;
private final plasmaSnippetCache.TextSnippet textSnippet;
@@ -801,7 +801,7 @@ public final class plasmaSearchEvent {
// statistic objects
public long dbRetrievalTime, snippetComputationTime;
- public ResultEntry(final indexURLReference urlentry, final plasmaWordIndex wordIndex,
+ public ResultEntry(final URLMetadata urlentry, final plasmaWordIndex wordIndex,
final plasmaSnippetCache.TextSnippet textSnippet,
final ArrayList<plasmaSnippetCache.MediaSnippet> mediaSnippets,
final long dbRetrievalTime, final long snippetComputationTime) {
@@ -883,10 +883,10 @@ public final class plasmaSearchEvent {
public int lapp() {
return urlentry.lapp();
}
- public indexRWIVarEntry word() {
- final indexRWIEntry word = urlentry.word();
- assert word instanceof indexRWIVarEntry;
- return (indexRWIVarEntry) word;
+ public ReferenceVars word() {
+ final Reference word = urlentry.word();
+ assert word instanceof ReferenceVars;
+ return (ReferenceVars) word;
}
public boolean hasTextSnippet() {
return (this.textSnippet != null) && (this.textSnippet.getErrorCode() < 11);
diff --git a/source/de/anomic/plasma/plasmaSearchQuery.java b/source/de/anomic/plasma/plasmaSearchQuery.java
index 6c5b6f05a..98f6b9e20 100644
--- a/source/de/anomic/plasma/plasmaSearchQuery.java
+++ b/source/de/anomic/plasma/plasmaSearchQuery.java
@@ -28,7 +28,7 @@ import java.util.TreeSet;
import de.anomic.htmlFilter.htmlFilterAbstractScraper;
import de.anomic.htmlFilter.htmlFilterCharacterCoding;
-import de.anomic.index.indexWord;
+import de.anomic.index.Word;
import de.anomic.kelondro.order.Base64Order;
import de.anomic.kelondro.order.Bitfield;
import de.anomic.kelondro.order.NaturalOrder;
@@ -90,9 +90,9 @@ public final class plasmaSearchQuery {
} else {
this.queryString = queryString;
final TreeSet<String>[] cq = cleanQuery(queryString);
- this.queryHashes = indexWord.words2hashes(cq[0]);
- this.excludeHashes = indexWord.words2hashes(cq[1]);
- this.fullqueryHashes = indexWord.words2hashes(cq[2]);
+ this.queryHashes = Word.words2hashes(cq[0]);
+ this.excludeHashes = Word.words2hashes(cq[1]);
+ this.fullqueryHashes = Word.words2hashes(cq[2]);
}
this.ranking = ranking;
this.maxDistance = Integer.MAX_VALUE;
@@ -230,7 +230,7 @@ public final class plasmaSearchQuery {
public static final boolean matches(final String text, final 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
- final TreeSet<String> wordhashes = indexWord.words2hashes(plasmaCondenser.getWords(text).keySet());
+ final TreeSet<String> wordhashes = Word.words2hashes(plasmaCondenser.getWords(text).keySet());
return SetTools.anymatch(wordhashes, keyhashes);
}
@@ -288,7 +288,7 @@ public final class plasmaSearchQuery {
public void filterOut(final Set<String> blueList) {
// filter out words that appear in this set
// this is applied to the queryHashes
- final TreeSet<String> blues = indexWord.words2hashes(blueList);
+ final TreeSet<String> blues = Word.words2hashes(blueList);
SetTools.excludeDestructive(queryHashes, blues);
}
@@ -298,7 +298,7 @@ public final class plasmaSearchQuery {
"*" + this.domType +
"*" + this.contentdom +
"*" + this.zonecode +
- "*" + indexWord.word2hash(this.ranking.toExternalString()) +
+ "*" + Word.word2hash(this.ranking.toExternalString()) +
"*" + this.prefer +
"*" + this.urlMask +
"*" + this.targetlang +
diff --git a/source/de/anomic/plasma/plasmaSearchRankingProcess.java b/source/de/anomic/plasma/plasmaSearchRankingProcess.java
index 4ef35e0df..7a7852409 100644
--- a/source/de/anomic/plasma/plasmaSearchRankingProcess.java
+++ b/source/de/anomic/plasma/plasmaSearchRankingProcess.java
@@ -37,12 +37,12 @@ import java.util.TreeSet;
import java.util.concurrent.ConcurrentHashMap;
import de.anomic.htmlFilter.htmlFilterContentScraper;
-import de.anomic.index.indexContainer;
-import de.anomic.index.indexRWIEntry;
-import de.anomic.index.indexRWIEntryOrder;
-import de.anomic.index.indexRWIVarEntry;
-import de.anomic.index.indexURLReference;
-import de.anomic.index.indexWord;
+import de.anomic.index.ReferenceContainer;
+import de.anomic.index.Reference;
+import de.anomic.index.ReferenceOrder;
+import de.anomic.index.ReferenceVars;
+import de.anomic.index.URLMetadata;
+import de.anomic.index.Word;
import de.anomic.kelondro.index.BinSearch;
import de.anomic.kelondro.order.Digest;
import de.anomic.kelondro.util.ScoreCluster;
@@ -58,19 +58,19 @@ public final class plasmaSearchRankingProcess {
private static boolean useYBR = true;
private static final int maxDoubleDomAll = 20, maxDoubleDomSpecial = 10000;
- private final SortStack<indexRWIVarEntry> stack;
- private final HashMap<String, SortStack<indexRWIVarEntry>> doubleDomCache; // key = domhash (6 bytes); value = like stack
+ private final SortStack<ReferenceVars> stack;
+ private final HashMap<String, SortStack<ReferenceVars>> doubleDomCache; // key = domhash (6 bytes); value = like stack
private final HashMap<String, String> handover; // key = urlhash, value = urlstring; used for double-check of urls that had been handed over to search process
private final plasmaSearchQuery query;
private final int maxentries;
private int remote_peerCount, remote_indexCount, remote_resourceSize, local_resourceSize;
- private final indexRWIEntryOrder order;
+ private final ReferenceOrder order;
private final ConcurrentHashMap<String, Integer> urlhashes; // map for double-check; String/Long relation, addresses ranking number (backreference for deletion)
private final ScoreCluster<String> ref; // reference score computation for the commonSense heuristic
private final int[] flagcount; // flag counter
private final TreeSet<String> misses; // contains url-hashes that could not been found in the LURL-DB
private final plasmaWordIndex wordIndex;
- private HashMap<String, indexContainer>[] localSearchContainerMaps;
+ private HashMap<String, ReferenceContainer>[] localSearchContainerMaps;
private final int[] domZones;
public plasmaSearchRankingProcess(final plasmaWordIndex wordIndex, final plasmaSearchQuery query, final int maxentries, final int concurrency) {
@@ -78,10 +78,10 @@ public final class plasmaSearchRankingProcess {
// attention: if minEntries is too high, this method will not terminate within the maxTime
// sortorder: 0 = hash, 1 = url, 2 = ranking
this.localSearchContainerMaps = null;
- this.stack = new SortStack<indexRWIVarEntry>(maxentries);
- this.doubleDomCache = new HashMap<String, SortStack<indexRWIVarEntry>>();
+ this.stack = new SortStack<ReferenceVars>(maxentries);
+ this.doubleDomCache = new HashMap<String, SortStack<ReferenceVars>>();
this.handover = new HashMap<String, String>();
- this.order = (query == null) ? null : new indexRWIEntryOrder(query.ranking, query.targetlang);
+ this.order = (query == null) ? null : new ReferenceOrder(query.ranking, query.targetlang);
this.query = query;
this.maxentries = maxentries;
this.remote_peerCount = 0;
@@ -98,7 +98,7 @@ public final class plasmaSearchRankingProcess {
for (int i = 0; i < 8; i++) {this.domZones[i] = 0;}
}
- public long ranking(final indexRWIVarEntry word) {
+ public long ranking(final ReferenceVars word) {
return order.cardinal(word);
}
@@ -114,8 +114,8 @@ public final class plasmaSearchRankingProcess {
// join and exclude the local result
timer = System.currentTimeMillis();
- final indexContainer index =
- indexContainer.joinExcludeContainers(
+ final ReferenceContainer index =
+ ReferenceContainer.joinExcludeContainers(
this.localSearchContainerMaps[0].values(),
this.localSearchContainerMaps[1].values(),
query.maxDistance);
@@ -127,7 +127,7 @@ public final class plasmaSearchRankingProcess {
insertRanked(index, true, index.size());
}
- public void insertRanked(final indexContainer index, final boolean local, final int fullResource) {
+ public void insertRanked(final ReferenceContainer index, final boolean local, final int fullResource) {
// we collect the urlhashes and construct a list with urlEntry objects
// attention: if minEntries is too high, this method will not terminate within the maxTime
@@ -143,13 +143,13 @@ public final class plasmaSearchRankingProcess {
long timer = System.currentTimeMillis();
// normalize entries
- final ArrayList<indexRWIVarEntry> decodedEntries = this.order.normalizeWith(index);
+ final ArrayList<ReferenceVars> decodedEntries = this.order.normalizeWith(index);
serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(query.id(true), plasmaSearchEvent.NORMALIZING, index.size(), System.currentTimeMillis() - timer));
// iterate over normalized entries and select some that are better than currently stored
timer = System.currentTimeMillis();
- final Iterator<indexRWIVarEntry> i = decodedEntries.iterator();
- indexRWIVarEntry iEntry;
+ final Iterator<ReferenceVars> i = decodedEntries.iterator();
+ ReferenceVars iEntry;
Long r;
while (i.hasNext()) {
iEntry = i.next();
@@ -213,7 +213,7 @@ public final class plasmaSearchRankingProcess {
serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(query.id(true), plasmaSearchEvent.PRESORT, index.size(), System.currentTimeMillis() - timer));
}
- private boolean testFlags(final indexRWIEntry ientry) {
+ private boolean testFlags(final Reference ientry) {
if (query.constraint == null) return true;
// test if ientry matches with filter
// if all = true: let only entries pass that has all matching bits
@@ -230,7 +230,7 @@ public final class plasmaSearchRankingProcess {
return false;
}
- public Map<String, indexContainer>[] searchContainerMaps() {
+ public Map<String, ReferenceContainer>[] searchContainerMaps() {
// direct access to the result maps is needed for abstract generation
// this is only available if execQuery() was called before
return localSearchContainerMaps;
@@ -242,10 +242,10 @@ public final class plasmaSearchRankingProcess {
// - root-domain guessing to prefer the root domain over other urls if search word appears in domain name
- private SortStack<indexRWIVarEntry>.stackElement bestRWI(final boolean skipDoubleDom) {
+ private SortStack<ReferenceVars>.stackElement bestRWI(final boolean skipDoubleDom) {
// returns from the current RWI list the best entry and removes this entry from the list
- SortStack<indexRWIVarEntry> m;
- SortStack<indexRWIVarEntry>.stackElement rwi;
+ SortStack<ReferenceVars> m;
+ SortStack<ReferenceVars>.stackElement rwi;
while (stack.size() > 0) {
rwi = stack.pop();
if (rwi == null) continue; // in case that a synchronization problem occurred just go lazy over it
@@ -255,7 +255,7 @@ public final class plasmaSearchRankingProcess {
m = this.doubleDomCache.get(domhash);
if (m == null) {
// first appearance of dom
- m = new SortStack<indexRWIVarEntry>((query.specialRights) ? maxDoubleDomSpecial : maxDoubleDomAll);
+ m = new SortStack<ReferenceVars>((query.specialRights) ? maxDoubleDomSpecial : maxDoubleDomAll);
this.doubleDomCache.put(domhash, m);
return rwi;
}
@@ -264,9 +264,9 @@ public final class plasmaSearchRankingProcess {
}
// no more entries in sorted RWI entries. Now take Elements from the doubleDomCache
// find best entry from all caches
- final Iterator<SortStack<indexRWIVarEntry>> i = this.doubleDomCache.values().iterator();
- SortStack<indexRWIVarEntry>.stackElement bestEntry = null;
- SortStack<indexRWIVarEntry>.stackElement o;
+ final Iterator<SortStack<ReferenceVars>> i = this.doubleDomCache.values().iterator();
+ SortStack<ReferenceVars>.stackElement bestEntry = null;
+ SortStack<ReferenceVars>.stackElement o;
while (i.hasNext()) {
m = i.next();
if (m == null) continue;
@@ -288,15 +288,15 @@ public final class plasmaSearchRankingProcess {
return bestEntry;
}
- public indexURLReference bestURL(final boolean skipDoubleDom) {
+ public URLMetadata bestURL(final 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)) {
if (((stack.size() == 0) && (size() == 0))) break;
- final SortStack<indexRWIVarEntry>.stackElement obrwi = bestRWI(skipDoubleDom);
+ final SortStack<ReferenceVars>.stackElement obrwi = bestRWI(skipDoubleDom);
if (obrwi == null) continue; // *** ? this happened and the thread was suspended silently. cause?
- final indexURLReference u = wordIndex.getURL(obrwi.element.urlHash(), obrwi.element, obrwi.weight.longValue());
+ final URLMetadata u = wordIndex.getURL(obrwi.element.urlHash(), obrwi.element, obrwi.weight.longValue());
if (u != null) {
- final indexURLReference.Components comp = u.comp();
+ final URLMetadata.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;
}
@@ -308,7 +308,7 @@ public final class plasmaSearchRankingProcess {
public int size() {
//assert sortedRWIEntries.size() == urlhashes.size() : "sortedRWIEntries.size() = " + sortedRWIEntries.size() + ", urlhashes.size() = " + urlhashes.size();
int c = stack.size();
- final Iterator<SortStack<indexRWIVarEntry>> i = this.doubleDomCache.values().iterator();
+ final Iterator<SortStack<ReferenceVars>> i = this.doubleDomCache.values().iterator();
while (i.hasNext()) c += i.next().size();
return c;
}
@@ -344,8 +344,8 @@ public final class plasmaSearchRankingProcess {
return this.local_resourceSize;
}
- public indexRWIEntry remove(final String urlHash) {
- final SortStack<indexRWIVarEntry>.stackElement se = stack.remove(urlHash.hashCode());
+ public Reference remove(final String urlHash) {
+ final SortStack<ReferenceVars>.stackElement se = stack.remove(urlHash.hashCode());
if (se == null) return null;
urlhashes.remove(urlHash);
return se.element;
@@ -372,7 +372,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(indexWord.word2hash(word)))))
+ (!(query.queryHashes.contains(Word.word2hash(word)))))
ref.incScore(word);
}
}
@@ -388,7 +388,7 @@ public final class plasmaSearchRankingProcess {
addReferences(descrcomps);
}
- public indexRWIEntryOrder getOrder() {
+ public ReferenceOrder getOrder() {
return this.order;
}
@@ -473,8 +473,8 @@ public final class plasmaSearchRankingProcess {
}
// apply query-in-result matching
- final Set<String> urlcomph = indexWord.words2hashSet(urlcomps);
- final Set<String> descrcomph = indexWord.words2hashSet(descrcomps);
+ final Set<String> urlcomph = Word.words2hashSet(urlcomps);
+ final Set<String> descrcomph = Word.words2hashSet(descrcomps);
final 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 b5b40afb1..fd3b9ba61 100644
--- a/source/de/anomic/plasma/plasmaSnippetCache.java
+++ b/source/de/anomic/plasma/plasmaSnippetCache.java
@@ -44,8 +44,8 @@ import de.anomic.htmlFilter.htmlFilterImageEntry;
import de.anomic.http.httpClient;
import de.anomic.http.httpResponseHeader;
import de.anomic.index.indexDocumentMetadata;
-import de.anomic.index.indexURLReference;
-import de.anomic.index.indexWord;
+import de.anomic.index.URLMetadata;
+import de.anomic.index.Word;
import de.anomic.kelondro.util.ScoreCluster;
import de.anomic.kelondro.util.SetTools;
import de.anomic.kelondro.util.Log;
@@ -229,14 +229,14 @@ public class plasmaSnippetCache {
for(int k=0; k < word.length(); k++) {
//is character a special character?
if(p4.matcher(word.substring(k,k+1)).find()) {
- if (indexWord.word2hash(temp).equals(h)) temp = "<b>" + htmlFilterCharacterCoding.unicode2html(temp, false) + "</b>";
+ if (Word.word2hash(temp).equals(h)) temp = "<b>" + htmlFilterCharacterCoding.unicode2html(temp, false) + "</b>";
out = out + temp + htmlFilterCharacterCoding.unicode2html(word.substring(k,k+1), false);
temp = "";
}
//last character
else if(k == (word.length()-1)) {
temp = temp + word.substring(k,k+1);
- if (indexWord.word2hash(temp).equals(h)) temp = "<b>" + htmlFilterCharacterCoding.unicode2html(temp, false) + "</b>";
+ if (Word.word2hash(temp).equals(h)) temp = "<b>" + htmlFilterCharacterCoding.unicode2html(temp, false) + "</b>";
out = out + temp;
temp = "";
}
@@ -246,7 +246,7 @@ public class plasmaSnippetCache {
}
//end contrib [MN]
- else if (indexWord.word2hash(word).equals(h)) word = "<b>" + htmlFilterCharacterCoding.unicode2html(word, false) + "</b>";
+ else if (Word.word2hash(word).equals(h)) word = "<b>" + htmlFilterCharacterCoding.unicode2html(word, false) + "</b>";
word = htmlFilterCharacterCoding.unicode2html(prefix, false)
+ word
@@ -302,7 +302,7 @@ public class plasmaSnippetCache {
}
@SuppressWarnings("unchecked")
- public static TextSnippet retrieveTextSnippet(final indexURLReference.Components comp, final Set<String> queryhashes, final boolean fetchOnline, final boolean pre, final int snippetMaxLength, final int timeout, final int maxDocLen, final boolean reindexing) {
+ public static TextSnippet retrieveTextSnippet(final URLMetadata.Components comp, final Set<String> queryhashes, final boolean fetchOnline, final boolean pre, final int snippetMaxLength, final int timeout, final int maxDocLen, final boolean reindexing) {
// heise = "0OQUNU3JSs05"
final yacyURL url = comp.url();
if (queryhashes.size() == 0) {
@@ -802,7 +802,7 @@ public class plasmaSnippetCache {
String hash;
while (words.hasMoreElements()) {
word = words.nextElement();
- hash = indexWord.word2hash(new String(word));
+ hash = Word.word2hash(new String(word));
if (!map.containsKey(hash)) map.put(hash, Integer.valueOf(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 56aaeb998..daea12176 100644
--- a/source/de/anomic/plasma/plasmaSwitchboard.java
+++ b/source/de/anomic/plasma/plasmaSwitchboard.java
@@ -139,7 +139,7 @@ import de.anomic.http.httpd;
import de.anomic.http.httpdRobotsTxtConfig;
import de.anomic.index.indexDocumentMetadata;
import de.anomic.index.indexReferenceBlacklist;
-import de.anomic.index.indexURLReference;
+import de.anomic.index.URLMetadata;
import de.anomic.kelondro.order.DateFormatter;
import de.anomic.kelondro.order.Digest;
import de.anomic.kelondro.order.NaturalOrder;
@@ -928,7 +928,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.
if (urlhash.length() == 0) return null;
final yacyURL ne = crawlQueues.getURL(urlhash);
if (ne != null) return ne;
- final indexURLReference le = webIndex.getURL(urlhash, null, 0);
+ final URLMetadata le = webIndex.getURL(urlhash, null, 0);
if (le != null) return le.comp().url();
return null;
}
@@ -1642,7 +1642,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.
log.logInfo("Excluded " + condenser.excludeWords(stopwords) + " words in URL " + queueEntry.url());
// STORE URL TO LOADED-URL-DB
- indexURLReference newEntry = null;
+ URLMetadata newEntry = null;
try {
newEntry = webIndex.storeDocument(queueEntry, document, condenser);
} catch (final IOException e) {
@@ -1690,9 +1690,9 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.
public class receiptSending implements Runnable {
yacySeed initiatorPeer;
- indexURLReference reference;
+ URLMetadata reference;
- public receiptSending(final yacySeed initiatorPeer, final indexURLReference reference) {
+ public receiptSending(final yacySeed initiatorPeer, final URLMetadata reference) {
this.initiatorPeer = initiatorPeer;
this.reference = reference;
}
@@ -1737,9 +1737,9 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.
if (urlhash == null) return 0;
// determine the url string
- final indexURLReference entry = webIndex.getURL(urlhash, null, 0);
+ final URLMetadata entry = webIndex.getURL(urlhash, null, 0);
if (entry == null) return 0;
- final indexURLReference.Components comp = entry.comp();
+ final URLMetadata.Components comp = entry.comp();
if (comp.url() == null) return 0;
InputStream resourceContent = null;
diff --git a/source/de/anomic/plasma/plasmaWordIndex.java b/source/de/anomic/plasma/plasmaWordIndex.java
index 571137de6..642321522 100644
--- a/source/de/anomic/plasma/plasmaWordIndex.java
+++ b/source/de/anomic/plasma/plasmaWordIndex.java
@@ -42,17 +42,17 @@ import de.anomic.crawler.IndexingStack;
import de.anomic.htmlFilter.htmlFilterContentScraper;
import de.anomic.http.httpdProxyCacheEntry;
import de.anomic.index.indexCollectionRI;
-import de.anomic.index.indexContainer;
+import de.anomic.index.ReferenceContainer;
import de.anomic.index.indexContainerOrder;
-import de.anomic.index.indexRAMRI;
-import de.anomic.index.indexRI;
-import de.anomic.index.indexRWIEntry;
-import de.anomic.index.indexRWIRowEntry;
+import de.anomic.index.ReverseIndexCache;
+import de.anomic.index.ReverseIndex;
+import de.anomic.index.Reference;
+import de.anomic.index.ReferenceRow;
import de.anomic.index.indexReferenceBlacklist;
-import de.anomic.index.indexRepositoryReference;
-import de.anomic.index.indexURLReference;
-import de.anomic.index.indexWord;
-import de.anomic.index.indexRepositoryReference.Export;
+import de.anomic.index.URLMetadataRepository;
+import de.anomic.index.URLMetadata;
+import de.anomic.index.Word;
+import de.anomic.index.URLMetadataRepository.Export;
import de.anomic.kelondro.index.RowCollection;
import de.anomic.kelondro.order.Base64Order;
import de.anomic.kelondro.order.ByteOrder;
@@ -70,7 +70,7 @@ import de.anomic.xml.RSSMessage;
import de.anomic.yacy.yacySeedDB;
import de.anomic.yacy.yacyURL;
-public final class plasmaWordIndex implements indexRI {
+public final class plasmaWordIndex implements ReverseIndex {
// environment constants
public static final long wCacheMaxAge = 1000 * 60 * 30; // milliseconds; 30 minutes
@@ -96,10 +96,10 @@ public final class plasmaWordIndex implements indexRI {
public static final long CRAWL_PROFILE_SNIPPET_GLOBAL_MEDIA_RECRAWL_CYCLE = 60L * 24L * 30L;
- private final indexRAMRI indexCache;
+ private final ReverseIndexCache indexCache;
private final indexCollectionRI collections; // new database structure to replace AssortmentCluster and FileCluster
private final Log log;
- public indexRepositoryReference referenceURL;
+ public URLMetadataRepository referenceURL;
public final yacySeedDB seedDB;
private final File primaryRoot, secondaryRoot;
public IndexingStack queuePreStack;
@@ -147,15 +147,15 @@ public final class plasmaWordIndex implements indexRI {
if (!(textindexcache.exists())) textindexcache.mkdirs();
if (new File(textindexcache, "index.dhtin.blob").exists()) {
// migration of the both caches into one
- this.indexCache = new indexRAMRI(textindexcache, indexRWIRowEntry.urlEntryRow, entityCacheMaxSize, wCacheMaxChunk, wCacheMaxAge, "index.dhtout.blob", log);
- indexRAMRI dhtInCache = new indexRAMRI(textindexcache, indexRWIRowEntry.urlEntryRow, entityCacheMaxSize, wCacheMaxChunk, wCacheMaxAge, "index.dhtin.blob", log);
- for (indexContainer c: dhtInCache) {
- this.indexCache.addEntries(c);
+ this.indexCache = new ReverseIndexCache(textindexcache, ReferenceRow.urlEntryRow, entityCacheMaxSize, wCacheMaxChunk, wCacheMaxAge, "index.dhtout.blob", log);
+ ReverseIndexCache dhtInCache = new ReverseIndexCache(textindexcache, ReferenceRow.urlEntryRow, entityCacheMaxSize, wCacheMaxChunk, wCacheMaxAge, "index.dhtin.blob", log);
+ for (ReferenceContainer c: dhtInCache) {
+ this.indexCache.addReferences(c);
}
new File(textindexcache, "index.dhtin.blob").delete();
} else {
// read in new BLOB
- this.indexCache = new indexRAMRI(textindexcache, indexRWIRowEntry.urlEntryRow, entityCacheMaxSize, wCacheMaxChunk, wCacheMaxAge, "index.dhtout.blob", log);
+ this.indexCache = new ReverseIndexCache(textindexcache, ReferenceRow.urlEntryRow, entityCacheMaxSize, wCacheMaxChunk, wCacheMaxAge, "index.dhtout.blob", log);
}
// create collections storage path
@@ -167,11 +167,11 @@ public final class plasmaWordIndex implements indexRI {
12,
Base64Order.enhancedCoder,
maxCollectionPartition,
- indexRWIRowEntry.urlEntryRow,
+ ReferenceRow.urlEntryRow,
useCommons);
// create LURL-db
- referenceURL = new indexRepositoryReference(this.secondaryRoot);
+ referenceURL = new URLMetadataRepository(this.secondaryRoot);
// make crawl profiles database and default profiles
this.queuesRoot = new File(this.primaryRoot, "QUEUES");
@@ -377,11 +377,11 @@ public final class plasmaWordIndex implements indexRI {
return (primary) ? this.primaryRoot : this.secondaryRoot;
}
- public void putURL(final indexURLReference entry) throws IOException {
+ public void putURL(final URLMetadata entry) throws IOException {
this.referenceURL.store(entry);
}
- public indexURLReference getURL(final String urlHash, final indexRWIEntry searchedWord, final long ranking) {
+ public URLMetadata getURL(final String urlHash, final Reference searchedWord, final long ranking) {
return this.referenceURL.load(urlHash, searchedWord, ranking);
}
@@ -405,11 +405,11 @@ public final class plasmaWordIndex implements indexRI {
return this.referenceURL.export();
}
- public CloneableIterator<indexURLReference> entriesURL(final boolean up, final String firstHash) throws IOException {
+ public CloneableIterator<URLMetadata> entriesURL(final boolean up, final String firstHash) throws IOException {
return this.referenceURL.entries(up, firstHash);
}
- public Iterator<indexRepositoryReference.hostStat> statistics(int count) throws IOException {
+ public Iterator<URLMetadataRepository.hostStat> statistics(int count) throws IOException {
return this.referenceURL.statistics(count);
}
@@ -417,7 +417,7 @@ public final class plasmaWordIndex implements indexRI {
return this.referenceURL.deleteDomain(urlfragment);
}
- public indexRepositoryReference.BlacklistCleaner getURLCleaner(final indexReferenceBlacklist blacklist) {
+ public URLMetadataRepository.BlacklistCleaner getURLCleaner(final indexReferenceBlacklist blacklist) {
return this.referenceURL.getBlacklistCleaner(blacklist); // thread is not already started after this is called!
}
@@ -448,10 +448,10 @@ public final class plasmaWordIndex implements indexRI {
public long indexCacheSizeBytes() {
// calculate the real size in bytes of the index cache
long cacheBytes = 0;
- final long entryBytes = indexRWIRowEntry.urlEntryRow.objectsize;
- final indexRAMRI cache = (indexCache);
+ final long entryBytes = ReferenceRow.urlEntryRow.objectsize;
+ final ReverseIndexCache cache = (indexCache);
synchronized (cache) {
- final Iterator<indexContainer> it = cache.wordContainerIterator(null, false, true);
+ final Iterator<ReferenceContainer> it = cache.referenceIterator(null, false, true);
while (it.hasNext()) cacheBytes += it.next().size() * entryBytes;
}
return cacheBytes;
@@ -461,7 +461,7 @@ public final class plasmaWordIndex implements indexRI {
indexCache.setMaxWordCount(maxWords);
}
- public void cacheFlushControl(final indexRAMRI theCache) {
+ public void cacheFlushControl(final ReverseIndexCache theCache) {
// check for forced flush
int cs = cacheSize();
if (cs > 0) {
@@ -484,21 +484,21 @@ public final class plasmaWordIndex implements indexRI {
}
}
- public static indexContainer emptyContainer(final String wordHash, final int elementCount) {
- return new indexContainer(wordHash, indexRWIRowEntry.urlEntryRow, elementCount);
+ public static ReferenceContainer emptyContainer(final String wordHash, final int elementCount) {
+ return new ReferenceContainer(wordHash, ReferenceRow.urlEntryRow, elementCount);
}
- public void addEntry(final String wordHash, final indexRWIRowEntry entry, final long updateTime) {
+ public void addEntry(final String wordHash, final ReferenceRow entry, final long updateTime) {
// add the entry
indexCache.addEntry(wordHash, entry, updateTime, true);
cacheFlushControl(this.indexCache);
}
- public void addEntries(final indexContainer entries) {
- assert (entries.row().objectsize == indexRWIRowEntry.urlEntryRow.objectsize);
+ public void addReferences(final ReferenceContainer entries) {
+ assert (entries.row().objectsize == ReferenceRow.urlEntryRow.objectsize);
// add the entry
- indexCache.addEntries(entries);
+ indexCache.addReferences(entries);
cacheFlushControl(this.indexCache);
}
@@ -512,19 +512,19 @@ public final class plasmaWordIndex implements indexRI {
}
}
- private synchronized void flushCacheOne(final indexRAMRI ram) {
- if (ram.size() > 0) collections.addEntries(flushContainer(ram));
+ private synchronized void flushCacheOne(final ReverseIndexCache ram) {
+ if (ram.size() > 0) collections.addReferences(flushContainer(ram));
}
- private indexContainer flushContainer(final indexRAMRI ram) {
+ private ReferenceContainer flushContainer(final ReverseIndexCache ram) {
String wordHash;
- indexContainer c;
+ ReferenceContainer c;
wordHash = ram.maxScoreWordHash();
- c = ram.getContainer(wordHash, null);
+ c = ram.getReferences(wordHash, null);
if ((c != null) && (c.size() > wCacheMaxChunk)) {
- return ram.deleteContainer(wordHash);
+ return ram.deleteAllReferences(wordHash);
} else {
- return ram.deleteContainer(ram.bestFlushWordHash());
+ return ram.deleteAllReferences(ram.bestFlushWordHash());
}
}
@@ -549,17 +549,17 @@ public final class plasmaWordIndex implements indexRI {
final int urlComps = htmlFilterContentScraper.urlComps(url.toString()).length;
// iterate over all words of context text
- final Iterator<Map.Entry<String, indexWord>> i = condenser.words().entrySet().iterator();
- Map.Entry<String, indexWord> wentry;
+ final Iterator<Map.Entry<String, Word>> i = condenser.words().entrySet().iterator();
+ Map.Entry<String, Word> wentry;
String word;
- indexRWIRowEntry ientry;
- indexWord wprop;
+ ReferenceRow ientry;
+ Word wprop;
while (i.hasNext()) {
wentry = i.next();
word = wentry.getKey();
wprop = wentry.getValue();
assert (wprop.flags != null);
- ientry = new indexRWIRowEntry(url.hash(),
+ ientry = new ReferenceRow(url.hash(),
urlLength, urlComps, (document == null) ? urlLength : document.dc_title().length(),
wprop.count,
condenser.RESULT_NUMB_WORDS,
@@ -573,34 +573,34 @@ public final class plasmaWordIndex implements indexRI {
doctype,
outlinksSame, outlinksOther,
wprop.flags);
- addEntry(indexWord.word2hash(word), ientry, System.currentTimeMillis());
+ addEntry(Word.word2hash(word), ientry, System.currentTimeMillis());
wordCount++;
}
return wordCount;
}
- public boolean hasContainer(final String wordHash) {
- if (indexCache.hasContainer(wordHash)) return true;
- if (collections.hasContainer(wordHash)) return true;
+ public boolean hasReferences(final String wordHash) {
+ if (indexCache.hasReferences(wordHash)) return true;
+ if (collections.hasReferences(wordHash)) return true;
return false;
}
- public indexContainer getContainer(final String wordHash, final Set<String> urlselection) {
+ public ReferenceContainer getReferences(final String wordHash, final Set<String> urlselection) {
if ((wordHash == null) || (wordHash.length() != yacySeedDB.commonHashLength)) {
// wrong input
return null;
}
// get from cache
- indexContainer container;
- container = indexCache.getContainer(wordHash, urlselection);
+ ReferenceContainer container;
+ container = indexCache.getReferences(wordHash, urlselection);
// get from collection index
if (container == null) {
- container = collections.getContainer(wordHash, urlselection);
+ container = collections.getReferences(wordHash, urlselection);
} else {
- container.addAllUnique(collections.getContainer(wordHash, urlselection));
+ container.addAllUnique(collections.getReferences(wordHash, urlselection));
}
if (container == null) return null;
@@ -613,10 +613,10 @@ public final class plasmaWordIndex implements indexRI {
for (int i = 0; i < d.size(); i++) {
// for each element in the double-set, take that one that is the most recent one
set = d.get(i);
- indexRWIRowEntry e, elm = null;
+ ReferenceRow e, elm = null;
long lm = 0;
for (int j = 0; j < set.size(); j++) {
- e = new indexRWIRowEntry(set.get(j, true));
+ e = new ReferenceRow(set.get(j, true));
if ((elm == null) || (e.lastModified() > lm)) {
elm = e;
lm = e.lastModified();
@@ -640,11 +640,11 @@ public final class plasmaWordIndex implements indexRI {
* @param interruptIfEmpty
* @return
*/
- public HashMap<String, indexContainer> getContainers(final Set<String> wordHashes, final Set<String> urlselection, final boolean interruptIfEmpty) {
+ public HashMap<String, ReferenceContainer> getContainers(final Set<String> wordHashes, final Set<String> urlselection, final boolean interruptIfEmpty) {
// retrieve entities that belong to the hashes
- final HashMap<String, indexContainer> containers = new HashMap<String, indexContainer>(wordHashes.size());
+ final HashMap<String, ReferenceContainer> containers = new HashMap<String, ReferenceContainer>(wordHashes.size());
String singleHash;
- indexContainer singleContainer;
+ ReferenceContainer singleContainer;
final Iterator<String> i = wordHashes.iterator();
while (i.hasNext()) {
@@ -652,10 +652,10 @@ public final class plasmaWordIndex implements indexRI {
singleHash = i.next();
// retrieve index
- singleContainer = getContainer(singleHash, urlselection);
+ singleContainer = getReferences(singleHash, urlselection);
// check result
- if (((singleContainer == null) || (singleContainer.size() == 0)) && (interruptIfEmpty)) return new HashMap<String, indexContainer>(0);
+ if (((singleContainer == null) || (singleContainer.size() == 0)) && (interruptIfEmpty)) return new HashMap<String, ReferenceContainer>(0);
containers.put(singleHash, singleContainer);
}
@@ -663,16 +663,16 @@ public final class plasmaWordIndex implements indexRI {
}
@SuppressWarnings("unchecked")
- public HashMap<String, indexContainer>[] localSearchContainers(final plasmaSearchQuery query, final Set<String> urlselection) {
+ public HashMap<String, ReferenceContainer>[] localSearchContainers(final plasmaSearchQuery query, final Set<String> urlselection) {
// search for the set of hashes and return a map of of wordhash:indexContainer containing the seach result
// retrieve entities that belong to the hashes
- HashMap<String, indexContainer> inclusionContainers = (query.queryHashes.size() == 0) ? new HashMap<String, indexContainer>(0) : getContainers(
+ HashMap<String, ReferenceContainer> inclusionContainers = (query.queryHashes.size() == 0) ? new HashMap<String, ReferenceContainer>(0) : getContainers(
query.queryHashes,
urlselection,
true);
- if ((inclusionContainers.size() != 0) && (inclusionContainers.size() < query.queryHashes.size())) inclusionContainers = new HashMap<String, indexContainer>(0); // prevent that only a subset is returned
- final HashMap<String, indexContainer> exclusionContainers = (inclusionContainers.size() == 0) ? new HashMap<String, indexContainer>(0) : getContainers(
+ if ((inclusionContainers.size() != 0) && (inclusionContainers.size() < query.queryHashes.size())) inclusionContainers = new HashMap<String, ReferenceContainer>(0); // prevent that only a subset is returned
+ final HashMap<String, ReferenceContainer> exclusionContainers = (inclusionContainers.size() == 0) ? new HashMap<String, ReferenceContainer>(0) : getContainers(
query.excludeHashes,
urlselection,
true);
@@ -700,20 +700,20 @@ public final class plasmaWordIndex implements indexRI {
queuePreStack.close();
}
- public indexContainer deleteContainer(final String wordHash) {
- final indexContainer c = new indexContainer(
+ public ReferenceContainer deleteAllReferences(final String wordHash) {
+ final ReferenceContainer c = new ReferenceContainer(
wordHash,
- indexRWIRowEntry.urlEntryRow,
- indexCache.sizeContainer(wordHash));
- c.addAllUnique(indexCache.deleteContainer(wordHash));
- c.addAllUnique(collections.deleteContainer(wordHash));
+ ReferenceRow.urlEntryRow,
+ indexCache.countReferences(wordHash));
+ c.addAllUnique(indexCache.deleteAllReferences(wordHash));
+ c.addAllUnique(collections.deleteAllReferences(wordHash));
return c;
}
- public boolean removeEntry(final String wordHash, final String urlHash) {
+ public boolean removeReference(final String wordHash, final String urlHash) {
boolean removed = false;
- removed = removed | (indexCache.removeEntry(wordHash, urlHash));
- removed = removed | (collections.removeEntry(wordHash, urlHash));
+ removed = removed | (indexCache.removeReference(wordHash, urlHash));
+ removed = removed | (collections.removeReference(wordHash, urlHash));
return removed;
}
@@ -723,22 +723,22 @@ public final class plasmaWordIndex implements indexRI {
final Iterator<String> i = wordHashes.iterator();
int count = 0;
while (i.hasNext()) {
- if (removeEntry(i.next(), urlHash)) count++;
+ if (removeReference(i.next(), urlHash)) count++;
}
return count;
}
- public int removeEntries(final String wordHash, final Set<String> urlHashes) {
+ public int removeReferences(final String wordHash, final Set<String> urlHashes) {
int removed = 0;
- removed += indexCache.removeEntries(wordHash, urlHashes);
- removed += collections.removeEntries(wordHash, urlHashes);
+ removed += indexCache.removeReferences(wordHash, urlHashes);
+ removed += collections.removeReferences(wordHash, urlHashes);
return removed;
}
public String removeEntriesExpl(final String wordHash, final Set<String> urlHashes) {
String removed = "";
- removed += indexCache.removeEntries(wordHash, urlHashes) + ", ";
- removed += collections.removeEntries(wordHash, urlHashes);
+ removed += indexCache.removeReferences(wordHash, urlHashes) + ", ";
+ removed += collections.removeReferences(wordHash, urlHashes);
return removed;
}
@@ -747,7 +747,7 @@ public final class plasmaWordIndex implements indexRI {
// this is mainly used when correcting a index after a search
final Iterator<String> i = wordHashes.iterator();
while (i.hasNext()) {
- removeEntries(i.next(), urlHashes);
+ removeReferences(i.next(), urlHashes);
}
}
@@ -758,20 +758,20 @@ public final class plasmaWordIndex implements indexRI {
int count = 0;
while (iter.hasNext()) {
// delete the URL reference in this word index
- if (removeEntry(indexWord.word2hash(iter.next()), urlhash)) count++;
+ if (removeReference(Word.word2hash(iter.next()), urlhash)) count++;
}
return count;
}
- public synchronized TreeSet<indexContainer> indexContainerSet(final String startHash, final boolean ram, final boolean rot, int count) {
+ public synchronized TreeSet<ReferenceContainer> indexContainerSet(final String startHash, final boolean ram, final boolean rot, int count) {
// creates a set of indexContainers
// this does not use the cache
- final Order<indexContainer> containerOrder = new indexContainerOrder(indexOrder.clone());
+ final Order<ReferenceContainer> containerOrder = new indexContainerOrder(indexOrder.clone());
containerOrder.rotate(emptyContainer(startHash, 0));
- final TreeSet<indexContainer> containers = new TreeSet<indexContainer>(containerOrder);
- final Iterator<indexContainer> i = wordContainerIterator(startHash, rot, ram);
+ final TreeSet<ReferenceContainer> containers = new TreeSet<ReferenceContainer>(containerOrder);
+ final Iterator<ReferenceContainer> i = referenceIterator(startHash, rot, ram);
if (ram) count = Math.min(indexCache.size(), count);
- indexContainer container;
+ ReferenceContainer container;
// this loop does not terminate using the i.hasNex() predicate when rot == true
// because then the underlying iterator is a rotating iterator without termination
// in this case a termination must be ensured with a counter
@@ -786,7 +786,7 @@ public final class plasmaWordIndex implements indexRI {
return containers; // this may return less containers as demanded
}
- public indexURLReference storeDocument(final IndexingStack.QueueEntry entry, final plasmaParserDocument document, final plasmaCondenser condenser) throws IOException {
+ public URLMetadata storeDocument(final IndexingStack.QueueEntry entry, final plasmaParserDocument document, final plasmaCondenser condenser) throws IOException {
final long startTime = System.currentTimeMillis();
// CREATE INDEX
@@ -839,7 +839,7 @@ public final class plasmaWordIndex implements indexRI {
// create a new loaded URL db entry
final long ldate = System.currentTimeMillis();
- final indexURLReference newEntry = new indexURLReference(
+ final URLMetadata newEntry = new URLMetadata(
entry.url(), // URL
dc_title, // document description
document.dc_creator(), // author
@@ -900,25 +900,25 @@ public final class plasmaWordIndex implements indexRI {
return newEntry;
}
- public synchronized CloneableIterator<indexContainer> wordContainerIterator(final String startHash, final boolean rot, final boolean ram) {
- final CloneableIterator<indexContainer> i = wordContainers(startHash, ram);
+ public synchronized CloneableIterator<ReferenceContainer> referenceIterator(final String startHash, final boolean rot, final boolean ram) {
+ final CloneableIterator<ReferenceContainer> i = wordContainers(startHash, ram);
if (rot) {
- return new RotateIterator<indexContainer>(i, new String(Base64Order.zero(startHash.length())), indexCache.size() + ((ram) ? 0 : collections.size()));
+ return new RotateIterator<ReferenceContainer>(i, new String(Base64Order.zero(startHash.length())), indexCache.size() + ((ram) ? 0 : collections.size()));
}
return i;
}
- private synchronized CloneableIterator<indexContainer> wordContainers(final String startWordHash, final boolean ram) {
- final Order<indexContainer> containerOrder = new indexContainerOrder(indexOrder.clone());
+ private synchronized CloneableIterator<ReferenceContainer> wordContainers(final String startWordHash, final boolean ram) {
+ final Order<ReferenceContainer> containerOrder = new indexContainerOrder(indexOrder.clone());
containerOrder.rotate(emptyContainer(startWordHash, 0));
if (ram) {
- return indexCache.wordContainerIterator(startWordHash, false, true);
+ return indexCache.referenceIterator(startWordHash, false, true);
}
- return new MergeIterator<indexContainer>(
- indexCache.wordContainerIterator(startWordHash, false, true),
- collections.wordContainerIterator(startWordHash, false, false),
+ return new MergeIterator<ReferenceContainer>(
+ indexCache.referenceIterator(startWordHash, false, true),
+ collections.referenceIterator(startWordHash, false, false),
containerOrder,
- indexContainer.containerMergeMethod,
+ ReferenceContainer.containerMergeMethod,
true);
}
@@ -945,22 +945,22 @@ public final class plasmaWordIndex implements indexRI {
public void run() {
Log.logInfo("INDEXCLEANER", "IndexCleaner-Thread started");
- indexContainer container = null;
- indexRWIRowEntry entry = null;
+ ReferenceContainer container = null;
+ ReferenceRow entry = null;
yacyURL url = null;
final HashSet<String> urlHashs = new HashSet<String>();
- Iterator<indexContainer> indexContainerIterator = indexContainerSet(startHash, false, false, 100).iterator();
+ Iterator<ReferenceContainer> indexContainerIterator = indexContainerSet(startHash, false, false, 100).iterator();
while (indexContainerIterator.hasNext() && run) {
waiter();
container = indexContainerIterator.next();
- final Iterator<indexRWIRowEntry> containerIterator = container.entries();
+ final Iterator<ReferenceRow> containerIterator = container.entries();
wordHashNow = container.getWordHash();
while (containerIterator.hasNext() && run) {
waiter();
entry = containerIterator.next();
// System.out.println("Wordhash: "+wordHash+" UrlHash:
// "+entry.getUrlHash());
- final indexURLReference ue = referenceURL.load(entry.urlHash(), entry, 0);
+ final URLMetadata ue = referenceURL.load(entry.urlHash(), entry, 0);
if (ue == null) {
urlHashs.add(entry.urlHash());
} else {
@@ -971,7 +971,7 @@ public final class plasmaWordIndex implements indexRI {
}
}
if (urlHashs.size() > 0) {
- final int removed = removeEntries(container.getWordHash(), urlHashs);
+ final int removed = removeReferences(container.getWordHash(), urlHashs);
Log.logFine("INDEXCLEANER", container.getWordHash() + ": " + removed + " of " + container.size() + " URL-entries deleted");
lastWordHash = container.getWordHash();
lastDeletionCounter = urlHashs.size();
@@ -979,7 +979,7 @@ public final class plasmaWordIndex implements indexRI {
}
if (!containerIterator.hasNext()) {
// We may not be finished yet, try to get the next chunk of wordHashes
- final TreeSet<indexContainer> containers = indexContainerSet(container.getWordHash(), false, false, 100);
+ final TreeSet<ReferenceContainer> containers = indexContainerSet(container.getWordHash(), false, false, 100);
indexContainerIterator = containers.iterator();
// Make sure we don't get the same wordhash twice, but don't skip a word
if ((indexContainerIterator.hasNext()) && (!container.getWordHash().equals(indexContainerIterator.next().getWordHash()))) {
@@ -1030,8 +1030,8 @@ public final class plasmaWordIndex implements indexRI {
}
}
- public int sizeEntry(String key) {
- return indexCache.sizeEntry(key) + collections.sizeEntry(key);
+ public int countReferences(String key) {
+ return indexCache.countReferences(key) + collections.countReferences(key);
}
}
diff --git a/source/de/anomic/yacy/dht/Dispatcher.java b/source/de/anomic/yacy/dht/Dispatcher.java
index e7a607b75..8f89ebaf0 100755
--- a/source/de/anomic/yacy/dht/Dispatcher.java
+++ b/source/de/anomic/yacy/dht/Dispatcher.java
@@ -31,10 +31,10 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
-import de.anomic.index.indexContainer;
-import de.anomic.index.indexRI;
-import de.anomic.index.indexRWIRowEntry;
-import de.anomic.index.indexRepositoryReference;
+import de.anomic.index.ReferenceContainer;
+import de.anomic.index.ReverseIndex;
+import de.anomic.index.ReferenceRow;
+import de.anomic.index.URLMetadataRepository;
import de.anomic.kelondro.order.Base64Order;
import de.anomic.kelondro.util.Log;
import de.anomic.server.serverProcessor;
@@ -80,7 +80,7 @@ public class Dispatcher {
private HashMap<String, Transmission.Chunk> transmissionCloud;
// the backend is used to store the remaining indexContainers in case that the object is closed
- private indexRI backend;
+ private ReverseIndex backend;
// the seed database
private yacySeedDB seeds;
@@ -95,8 +95,8 @@ public class Dispatcher {
private Transmission transmission;
public Dispatcher(
- final indexRI backend,
- final indexRepositoryReference repository,
+ final ReverseIndex backend,
+ final URLMetadataRepository repository,
final yacySeedDB seeds,
final boolean gzipBody,
final int timeout
@@ -142,7 +142,7 @@ public class Dispatcher {
* @return
* @throws IOException
*/
- private ArrayList<indexContainer> selectContainers(
+ private ArrayList<ReferenceContainer> selectContainers(
final String hash,
final String limitHash,
final int maxContainerCount,
@@ -150,14 +150,14 @@ public class Dispatcher {
final int maxtime) throws IOException {
// prefer file
- ArrayList<indexContainer> containers = selectContainers(hash, limitHash, maxContainerCount, maxReferenceCount, maxtime, false);
+ ArrayList<ReferenceContainer> containers = selectContainers(hash, limitHash, maxContainerCount, maxReferenceCount, maxtime, false);
// if ram does not provide any result, take from file
//if (containers.size() == 0) containers = selectContainers(hash, limitHash, maxContainerCount, maxtime, false);
return containers;
}
- private ArrayList<indexContainer> selectContainers(
+ private ArrayList<ReferenceContainer> selectContainers(
final String hash,
final String limitHash,
final int maxContainerCount,
@@ -165,10 +165,10 @@ public class Dispatcher {
final int maxtime,
final boolean ram) throws IOException {
- final ArrayList<indexContainer> containers = new ArrayList<indexContainer>(maxContainerCount);
+ final ArrayList<ReferenceContainer> containers = new ArrayList<ReferenceContainer>(maxContainerCount);
- final Iterator<indexContainer> indexContainerIterator = this.backend.wordContainerIterator(hash, true, ram);
- indexContainer container;
+ final Iterator<ReferenceContainer> indexContainerIterator = this.backend.referenceIterator(hash, true, ram);
+ ReferenceContainer container;
int refcount = 0;
// first select the container
@@ -188,7 +188,7 @@ public class Dispatcher {
containers.add(container);
}
// then remove the container from the backend
- for (indexContainer c: containers) this.backend.deleteContainer(c.getWordHash());
+ for (ReferenceContainer c: containers) this.backend.deleteAllReferences(c.getWordHash());
// finished. The caller must take care of the containers and must put them back if not needed
return containers;
@@ -202,24 +202,24 @@ public class Dispatcher {
* @return
*/
@SuppressWarnings("unchecked")
- private ArrayList<indexContainer>[] splitContainers(ArrayList<indexContainer> containers) {
+ private ArrayList<ReferenceContainer>[] splitContainers(ArrayList<ReferenceContainer> containers) {
// init the result vector
int partitionCount = this.seeds.scheme.verticalPartitions();
- ArrayList<indexContainer>[] partitions = (ArrayList<indexContainer>[]) new ArrayList[partitionCount];
- for (int i = 0; i < partitions.length; i++) partitions[i] = new ArrayList<indexContainer>();
+ ArrayList<ReferenceContainer>[] partitions = (ArrayList<ReferenceContainer>[]) new ArrayList[partitionCount];
+ for (int i = 0; i < partitions.length; i++) partitions[i] = new ArrayList<ReferenceContainer>();
// check all entries and split them to the partitions
- indexContainer[] partitionBuffer = new indexContainer[partitionCount];
- indexRWIRowEntry re;
- for (indexContainer container: containers) {
+ ReferenceContainer[] partitionBuffer = new ReferenceContainer[partitionCount];
+ ReferenceRow re;
+ for (ReferenceContainer container: containers) {
// init the new partitions
for (int j = 0; j < partitionBuffer.length; j++) {
- partitionBuffer[j] = new indexContainer(container.getWordHash(), container.row(), container.size() / partitionCount);
+ partitionBuffer[j] = new ReferenceContainer(container.getWordHash(), container.row(), container.size() / partitionCount);
}
// split the container
- Iterator<indexRWIRowEntry> i = container.entries();
+ Iterator<ReferenceRow> i = container.entries();
while (i.hasNext()) {
re = i.next();
if (re == null) continue;
@@ -244,8 +244,8 @@ public class Dispatcher {
* stored in a cache of the Entry for later transmission to the targets, which means that
* then no additional IO is necessary.
*/
- private void enqueueContainersToCloud(final ArrayList<indexContainer>[] containers) {
- indexContainer lastContainer;
+ private void enqueueContainersToCloud(final ArrayList<ReferenceContainer>[] containers) {
+ ReferenceContainer lastContainer;
String primaryTarget;
Transmission.Chunk entry;
for (int vertical = 0; vertical < containers.length; vertical++) {
@@ -264,7 +264,7 @@ public class Dispatcher {
if (entry == null) entry = transmission.newChunk(primaryTarget, targets, lastContainer.row());
// fill the entry with the containers
- for (indexContainer c: containers[vertical]) {
+ for (ReferenceContainer c: containers[vertical]) {
entry.add(c);
}
@@ -280,7 +280,7 @@ public class Dispatcher {
final int maxReferenceCount,
final int maxtime) throws IOException {
- ArrayList<indexContainer> selectedContainerCache = selectContainers(hash, limitHash, maxContainerCount, maxReferenceCount, maxtime);
+ ArrayList<ReferenceContainer> selectedContainerCache = selectContainers(hash, limitHash, maxContainerCount, maxReferenceCount, maxtime);
this.log.logInfo("selectContainersToCache: selectedContainerCache was filled with " + selectedContainerCache.size() + " entries");
if (selectedContainerCache == null || selectedContainerCache.size() == 0) {
@@ -288,7 +288,7 @@ public class Dispatcher {
return false;
}
- ArrayList<indexContainer>[] splittedContainerCache = splitContainers(selectedContainerCache);
+ ArrayList<ReferenceContainer>[] splittedContainerCache = splitContainers(selectedContainerCache);
selectedContainerCache = null;
if (splittedContainerCache == null) {
this.log.logInfo("enqueueContainersFromCache: splittedContainerCache is empty, cannot do anything here.");
@@ -364,7 +364,7 @@ public class Dispatcher {
if (indexingTransmissionProcessor != null) this.indexingTransmissionProcessor.announceShutdown();
if (this.transmissionCloud != null) {
for (Map.Entry<String, Transmission.Chunk> e : this.transmissionCloud.entrySet()) {
- for (indexContainer i : e.getValue()) try {this.backend.addEntries(i);} catch (IOException e1) {}
+ for (ReferenceContainer i : e.getValue()) try {this.backend.addReferences(i);} catch (IOException e1) {}
}
this.transmissionCloud.clear();
}
diff --git a/source/de/anomic/yacy/dht/Transmission.java b/source/de/anomic/yacy/dht/Transmission.java
index 7817057a7..92839c589 100644
--- a/source/de/anomic/yacy/dht/Transmission.java
+++ b/source/de/anomic/yacy/dht/Transmission.java
@@ -30,12 +30,12 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
-import de.anomic.index.indexContainer;
+import de.anomic.index.ReferenceContainer;
import de.anomic.index.indexContainerCache;
-import de.anomic.index.indexRI;
-import de.anomic.index.indexRWIRowEntry;
-import de.anomic.index.indexRepositoryReference;
-import de.anomic.index.indexURLReference;
+import de.anomic.index.ReverseIndex;
+import de.anomic.index.ReferenceRow;
+import de.anomic.index.URLMetadataRepository;
+import de.anomic.index.URLMetadata;
import de.anomic.kelondro.index.Row;
import de.anomic.kelondro.util.Log;
import de.anomic.server.serverProcessorJob;
@@ -46,17 +46,17 @@ import de.anomic.yacy.yacySeedDB;
public class Transmission {
private Log log;
- private indexRepositoryReference repository;
+ private URLMetadataRepository repository;
private yacySeedDB seeds;
- private indexRI backend;
+ private ReverseIndex backend;
private boolean gzipBody4Transfer;
private int timeout4Transfer;
public Transmission(
Log log,
- indexRepositoryReference repository,
+ URLMetadataRepository repository,
yacySeedDB seeds,
- indexRI backend,
+ ReverseIndex backend,
boolean gzipBody4Transfer,
int timeout4Transfer) {
this.log = log;
@@ -74,7 +74,7 @@ public class Transmission {
return new Chunk(primaryTarget, targets, payloadrow);
}
- public class Chunk extends serverProcessorJob implements Iterable<indexContainer> {
+ public class Chunk extends serverProcessorJob implements Iterable<ReferenceContainer> {
/**
* a dispatcher entry contains
* - the primary target, which is a word hash, as marker for the entry
@@ -87,7 +87,7 @@ public class Transmission {
*/
private String primaryTarget;
private indexContainerCache containers;
- private HashMap<String, indexURLReference> references;
+ private HashMap<String, URLMetadata> references;
private HashSet<String> badReferences;
private ArrayList<yacySeed> targets;
private int hit, miss;
@@ -108,7 +108,7 @@ public class Transmission {
this.primaryTarget = primaryTarget;
this.containers = new indexContainerCache(payloadrow);
this.containers.initWriteMode();
- this.references = new HashMap<String, indexURLReference>();
+ this.references = new HashMap<String, URLMetadata>();
this.badReferences = new HashSet<String>();
this.targets = targets;
this.hit = 0;
@@ -120,14 +120,14 @@ public class Transmission {
* all entries in the container are checked and only such are stored which have a reference entry
* @param container
*/
- public void add(indexContainer container) {
+ public void add(ReferenceContainer container) {
// iterate through the entries in the container and check if the reference is in the repository
- Iterator<indexRWIRowEntry> i = container.entries();
+ Iterator<ReferenceRow> i = container.entries();
ArrayList<String> notFound = new ArrayList<String>();
while (i.hasNext()) {
- indexRWIRowEntry e = i.next();
+ ReferenceRow e = i.next();
if (references.containsKey(e.urlHash()) || badReferences.contains(e.urlHash())) continue;
- indexURLReference r = repository.load(e.urlHash(), null, 0);
+ URLMetadata r = repository.load(e.urlHash(), null, 0);
if (r == null) {
notFound.add(e.urlHash());
badReferences.add(e.urlHash());
@@ -138,14 +138,14 @@ public class Transmission {
// now delete all references that were not found
for (String s : notFound) container.remove(s);
// finally add the remaining container to the cache
- containers.addEntries(container);
+ containers.addReferences(container);
}
/**
* get all containers from the entry. This method may be used to flush remaining entries
* if they had been finished transmission without success (not enough peers arrived)
*/
- public Iterator<indexContainer> iterator() {
+ public Iterator<ReferenceContainer> iterator() {
return this.containers.iterator();
}
@@ -200,8 +200,8 @@ public class Transmission {
if (error == null) {
// words successfully transfered
long transferTime = System.currentTimeMillis() - start;
- Iterator<indexContainer> i = this.containers.iterator();
- indexContainer firstContainer = (i == null) ? null : i.next();
+ Iterator<ReferenceContainer> i = this.containers.iterator();
+ ReferenceContainer firstContainer = (i == null) ? null : i.next();
log.logInfo("Index transfer of " + this.containers.size() +
" words [" + ((firstContainer == null) ? null : firstContainer.getWordHash()) + " .. " + this.primaryTarget + "]" +
" and " + this.references.size() + " URLs" +
@@ -235,8 +235,8 @@ public class Transmission {
}
public void restore() {
- for (indexContainer ic : this) try {
- backend.addEntries(ic);
+ for (ReferenceContainer ic : this) try {
+ backend.addReferences(ic);
} catch (IOException e1) {
e1.printStackTrace();
}
diff --git a/source/de/anomic/yacy/yacyClient.java b/source/de/anomic/yacy/yacyClient.java
index 23cf55ee3..46051b37b 100644
--- a/source/de/anomic/yacy/yacyClient.java
+++ b/source/de/anomic/yacy/yacyClient.java
@@ -66,13 +66,13 @@ import de.anomic.http.httpClient;
import de.anomic.http.httpResponse;
import de.anomic.http.httpRemoteProxyConfig;
import de.anomic.http.httpRequestHeader;
-import de.anomic.index.indexContainer;
+import de.anomic.index.ReferenceContainer;
import de.anomic.index.indexContainerCache;
-import de.anomic.index.indexRWIEntry;
-import de.anomic.index.indexRWIRowEntry;
+import de.anomic.index.Reference;
+import de.anomic.index.ReferenceRow;
import de.anomic.index.indexReferenceBlacklist;
-import de.anomic.index.indexURLReference;
-import de.anomic.index.indexWord;
+import de.anomic.index.URLMetadata;
+import de.anomic.index.Word;
import de.anomic.kelondro.order.Base64Order;
import de.anomic.kelondro.order.Bitfield;
import de.anomic.kelondro.order.Digest;
@@ -526,21 +526,21 @@ public final class yacyClient {
// create containers
final int words = wordhashes.length() / yacySeedDB.commonHashLength;
- final indexContainer[] container = new indexContainer[words];
+ final ReferenceContainer[] container = new ReferenceContainer[words];
for (int i = 0; i < words; i++) {
container[i] = plasmaWordIndex.emptyContainer(wordhashes.substring(i * yacySeedDB.commonHashLength, (i + 1) * yacySeedDB.commonHashLength), count);
}
// insert results to containers
- indexURLReference urlEntry;
+ URLMetadata urlEntry;
final String[] urls = new String[results];
for (int n = 0; n < results; n++) {
// get one single search result
- urlEntry = indexURLReference.importEntry(result.get("resource" + n));
+ urlEntry = URLMetadata.importEntry(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
- final indexURLReference.Components comp = urlEntry.comp();
+ final URLMetadata.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
@@ -553,7 +553,7 @@ public final class yacyClient {
}
// save the url entry
- indexRWIEntry entry;
+ Reference entry;
if (urlEntry.word() == null) {
yacyCore.log.logWarning("remote search (client): no word attached from peer " + target.getName() + ", version " + target.getVersion());
continue; // no word attached
@@ -628,7 +628,7 @@ public final class yacyClient {
return null;
}
//System.out.println("DEBUG-ABSTRACTFETCH: for word hash " + wordhash + " received " + ci.toString());
- indexContainer.decompressIndex(singleAbstract, ci, target.hash);
+ ReferenceContainer.decompressIndex(singleAbstract, ci, target.hash);
abstractCache.put(wordhash, singleAbstract);
}
}
@@ -637,7 +637,7 @@ public final class yacyClient {
// insert the containers to the index
for (int m = 0; m < words; m++) {
- wordIndex.addEntries(container[m]);
+ wordIndex.addReferences(container[m]);
}
// generate statistics
@@ -793,7 +793,7 @@ public final class yacyClient {
return "wrong protocol: " + protocol;
}
- public static HashMap<String, String> crawlReceipt(final yacySeed mySeed, final yacySeed target, final String process, final String result, final String reason, final indexURLReference entry, final String wordhashes) {
+ public static HashMap<String, String> crawlReceipt(final yacySeed mySeed, final yacySeed target, final String process, final String result, final String reason, final URLMetadata entry, final String wordhashes) {
assert (target != null);
assert (mySeed != null);
assert (mySeed != target);
@@ -856,7 +856,7 @@ public final class yacyClient {
public static String transferIndex(
final yacySeed targetSeed,
final indexContainerCache indexes,
- final HashMap<String, indexURLReference> urlCache,
+ final HashMap<String, URLMetadata> urlCache,
final boolean gzipBody,
final int timeout) {
@@ -865,9 +865,9 @@ public final class yacyClient {
try {
// check if we got all necessary urls in the urlCache (only for debugging)
- Iterator<indexRWIRowEntry> eenum;
- indexRWIEntry entry;
- for (indexContainer ic: indexes) {
+ Iterator<ReferenceRow> eenum;
+ Reference entry;
+ for (ReferenceContainer ic: indexes) {
eenum = ic.entries();
while (eenum.hasNext()) {
entry = eenum.next();
@@ -908,7 +908,7 @@ public final class yacyClient {
if (uhs.length == 0) { return null; } // all url's known
// extract the urlCache from the result
- final indexURLReference[] urls = new indexURLReference[uhs.length];
+ final URLMetadata[] urls = new URLMetadata[uhs.length];
for (int i = 0; i < uhs.length; i++) {
urls[i] = urlCache.get(uhs[i]);
if (urls[i] == null) {
@@ -960,9 +960,9 @@ public final class yacyClient {
int indexcount = 0;
final StringBuilder entrypost = new StringBuilder(indexes.size() * 73);
- Iterator<indexRWIRowEntry> eenum;
- indexRWIEntry entry;
- for (indexContainer ic: indexes) {
+ Iterator<ReferenceRow> eenum;
+ Reference entry;
+ for (ReferenceContainer ic: indexes) {
eenum = ic.entries();
while (eenum.hasNext()) {
entry = eenum.next();
@@ -998,7 +998,7 @@ public final class yacyClient {
}
}
- private static HashMap<String, String> transferURL(final yacySeed targetSeed, final indexURLReference[] urls, boolean gzipBody, final int timeout) {
+ private static HashMap<String, String> transferURL(final yacySeed targetSeed, final URLMetadata[] urls, boolean gzipBody, final int timeout) {
// this post a message to the remote message board
final String address = targetSeed.getPublicAddress();
if (address == null) { return null; }
@@ -1074,7 +1074,7 @@ public final class yacyClient {
/*final yacyCore core =*/ new yacyCore(sb);
sb.loadSeedLists();
final yacySeed target = sb.webIndex.seedDB.getConnected(args[1]);
- final String wordhashe = indexWord.word2hash("test");
+ final String wordhashe = Word.word2hash("test");
//System.out.println("permission=" + permissionMessage(args[1]));
final httpRequestHeader reqHeader = new httpRequestHeader();
diff --git a/source/de/anomic/yacy/yacySeed.java b/source/de/anomic/yacy/yacySeed.java
index 965338993..8f0bf0c79 100644
--- a/source/de/anomic/yacy/yacySeed.java
+++ b/source/de/anomic/yacy/yacySeed.java
@@ -55,7 +55,7 @@ import java.util.Random;
import java.util.Set;
import java.util.TreeMap;
-import de.anomic.index.indexWord;
+import de.anomic.index.Word;
import de.anomic.kelondro.order.Base64Order;
import de.anomic.kelondro.order.DateFormatter;
import de.anomic.kelondro.order.Digest;
@@ -586,7 +586,7 @@ public class yacySeed implements Cloneable {
final Set<String> tags = serverCodings.string2set(peertags, "|");
final Iterator<String> i = tags.iterator();
while (i.hasNext()) {
- if (searchHashes.contains(indexWord.word2hash(i.next()))) return true;
+ if (searchHashes.contains(Word.word2hash(i.next()))) return true;
}
return false;
}
diff --git a/source/yacy.java b/source/yacy.java
index 07467b55c..bb747a67e 100644
--- a/source/yacy.java
+++ b/source/yacy.java
@@ -52,12 +52,12 @@ import de.anomic.http.httpClient;
import de.anomic.http.httpResponse;
import de.anomic.http.httpRequestHeader;
import de.anomic.http.httpd;
-import de.anomic.index.indexContainer;
-import de.anomic.index.indexRWIEntry;
-import de.anomic.index.indexRWIRowEntry;
-import de.anomic.index.indexRepositoryReference;
-import de.anomic.index.indexURLReference;
-import de.anomic.index.indexWord;
+import de.anomic.index.ReferenceContainer;
+import de.anomic.index.Reference;
+import de.anomic.index.ReferenceRow;
+import de.anomic.index.URLMetadataRepository;
+import de.anomic.index.URLMetadata;
+import de.anomic.index.Word;
import de.anomic.kelondro.blob.BLOBHeap;
import de.anomic.kelondro.blob.MapDataMining;
import de.anomic.kelondro.index.RowCollection;
@@ -667,35 +667,35 @@ public final class yacy {
log.logInfo("STARTING URL CLEANUP");
// db containing all currently loades urls
- final indexRepositoryReference currentUrlDB = new indexRepositoryReference(new File(indexSecondaryRoot, networkName));
+ final URLMetadataRepository currentUrlDB = new URLMetadataRepository(new File(indexSecondaryRoot, networkName));
// db used to hold all neede urls
- final indexRepositoryReference minimizedUrlDB = new indexRepositoryReference(new File(indexRoot2, networkName));
+ final URLMetadataRepository minimizedUrlDB = new URLMetadataRepository(new File(indexRoot2, networkName));
final int cacheMem = (int)(MemoryControl.max() - MemoryControl.total());
if (cacheMem < 2048000) throw new OutOfMemoryError("Not enough memory available to start clean up.");
final plasmaWordIndex wordIndex = new plasmaWordIndex(networkName, log, indexPrimaryRoot, indexSecondaryRoot, 10000, false, 1, 0);
- final Iterator<indexContainer> indexContainerIterator = wordIndex.wordContainerIterator("AAAAAAAAAAAA", false, false);
+ final Iterator<ReferenceContainer> indexContainerIterator = wordIndex.referenceIterator("AAAAAAAAAAAA", false, false);
long urlCounter = 0, wordCounter = 0;
long wordChunkStart = System.currentTimeMillis(), wordChunkEnd = 0;
String wordChunkStartHash = "AAAAAAAAAAAA", wordChunkEndHash;
while (indexContainerIterator.hasNext()) {
- indexContainer wordIdxContainer = null;
+ ReferenceContainer wordIdxContainer = null;
try {
wordCounter++;
wordIdxContainer = indexContainerIterator.next();
// the combined container will fit, read the container
- final Iterator<indexRWIRowEntry> wordIdxEntries = wordIdxContainer.entries();
- indexRWIEntry iEntry;
+ final Iterator<ReferenceRow> wordIdxEntries = wordIdxContainer.entries();
+ Reference iEntry;
while (wordIdxEntries.hasNext()) {
iEntry = wordIdxEntries.next();
final String urlHash = iEntry.urlHash();
if ((currentUrlDB.exists(urlHash)) && (!minimizedUrlDB.exists(urlHash))) try {
- final indexURLReference urlEntry = currentUrlDB.load(urlHash, null, 0);
+ final URLMetadata urlEntry = currentUrlDB.load(urlHash, null, 0);
urlCounter++;
minimizedUrlDB.store(urlEntry);
if (urlCounter % 500 == 0) {
@@ -759,7 +759,7 @@ public final class yacy {
try {
String word;
final BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(wordlist)));
- while ((word = br.readLine()) != null) wordmap.put(indexWord.word2hash(word), word);
+ while ((word = br.readLine()) != null) wordmap.put(Word.word2hash(word), word);
br.close();
} catch (final IOException e) {}
return wordmap;
@@ -849,7 +849,7 @@ public final class yacy {
final File root = homePath;
final File indexroot = new File(root, "DATA/INDEX");
try {Log.configureLogging(homePath, new File(homePath, "DATA/LOG/yacy.logging"));} catch (final Exception e) {}
- final indexRepositoryReference currentUrlDB = new indexRepositoryReference(new File(indexroot, networkName));
+ final URLMetadataRepository currentUrlDB = new URLMetadataRepository(new File(indexroot, networkName));
currentUrlDB.deadlinkCleaner(null);
currentUrlDB.close();
}
@@ -864,13 +864,13 @@ public final class yacy {
log.logInfo("STARTING CREATION OF RWI-HASHLIST");
final File root = homePath;
try {
- Iterator<indexContainer> indexContainerIterator = null;
+ Iterator<ReferenceContainer> indexContainerIterator = null;
if (resource.equals("all")) {
WordIndex = new plasmaWordIndex("freeworld", log, indexPrimaryRoot, indexSecondaryRoot, 10000, false, 1, 0);
- indexContainerIterator = WordIndex.wordContainerIterator(wordChunkStartHash, false, false);
+ indexContainerIterator = WordIndex.referenceIterator(wordChunkStartHash, false, false);
}
int counter = 0;
- indexContainer container = null;
+ ReferenceContainer container = null;
if (format.equals("zip")) {
log.logInfo("Writing Hashlist to ZIP-file: " + targetName + ".zip");
final ZipEntry zipEntry = new ZipEntry(targetName + ".txt");