Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
bugfixes for wrong database access that do not consider deleted entries
orbiter29a1318ef9a4
diff --git a/source/de/anomic/index/indexRAMCacheRI.java b/source/de/anomic/index/indexRAMCacheRI.javaindex 19f9236fd..579bdfa36 100644--- a/source/de/anomic/index/indexRAMCacheRI.java+++ b/source/de/anomic/index/indexRAMCacheRI.java@@ -153,15 +153,15 @@ public final class indexRAMCacheRI extends indexAbstractRI implements indexRI {long urlCount = 0, urlsPerSecond = 0;try {synchronized (cache) {- int i = dumpArray.size();+ Iterator i = dumpArray.contentRows(-1);String wordHash;//long creationTime;indexEntry wordEntry;kelondroRow.Entry row;//Runtime rt = Runtime.getRuntime();- while (i-- > 0) {+ while (i.hasNext()) {// get out one entry- row = dumpArray.get(i);+ row = (kelondroRow.Entry) i.next();if ((row == null) || (row.empty(0)) || (row.empty(3)) || (row.empty(4))) continue;wordHash = row.getColString(0, "UTF-8");//creationTime = kelondroRecords.bytes2long(row[2]);@@ -175,7 +175,7 @@ public final class indexRAMCacheRI extends indexAbstractRI implements indexRI {if (System.currentTimeMillis() > messageTime) {System.gc(); // for better statisticurlsPerSecond = 1 + urlCount * 1000 / (1 + System.currentTimeMillis() - startTime);- log.logInfo("restoring status: " + urlCount + " urls done, " + (i / urlsPerSecond) + " seconds remaining, free mem = " + (Runtime.getRuntime().freeMemory() / 1024 / 1024) + "MB");+ log.logInfo("restoring status: " + urlCount + " urls done, " + ((dumpArray.size() - urlCount) / urlsPerSecond) + " seconds remaining, free mem = " + (Runtime.getRuntime().freeMemory() / 1024 / 1024) + "MB");messageTime = System.currentTimeMillis() + 5000;}}diff --git a/source/de/anomic/kelondro/kelondroCollectionIndex.java b/source/de/anomic/kelondro/kelondroCollectionIndex.javaindex 0d49a49fd..fbeb1f7cd 100644--- a/source/de/anomic/kelondro/kelondroCollectionIndex.java+++ b/source/de/anomic/kelondro/kelondroCollectionIndex.java@@ -143,7 +143,7 @@ public class kelondroCollectionIndex {byte[] key;long start = System.currentTimeMillis();long lastlog = start;- for (int j = 0; j < array.size(); j++) {+ for (int j = 0; j < array.USAGE.allCount(); j++) {aentry = array.get(j);key = aentry.getColBytes(0);if (key == null) continue; // skip deleted entries@@ -161,7 +161,7 @@ public class kelondroCollectionIndex {// write a logif (System.currentTimeMillis() - lastlog > 30000) {- serverLog.logFine("STARTUP", "created " + j + " RWI index entries. " + (((System.currentTimeMillis() - start) * (array.size() - j) / j) / 60000) + " minutes remaining for this array");+ serverLog.logFine("STARTUP", "created " + j + " RWI index entries. " + (((System.currentTimeMillis() - start) * (array.USAGE.allCount() - j) / j) / 60000) + " minutes remaining for this array");lastlog = System.currentTimeMillis();}}@@ -552,8 +552,8 @@ public class kelondroCollectionIndex {}// printout of index- kelondroFlexTable index = new kelondroFlexTable(path, filenameStub + ".index", buffersize, preloadTime, collectionIndex.indexRow(), kelondroNaturalOrder.naturalOrder);collectionIndex.close();+ kelondroFlexTable index = new kelondroFlexTable(path, filenameStub + ".index", buffersize, preloadTime, collectionIndex.indexRow(), kelondroNaturalOrder.naturalOrder);index.print();index.close();} catch (IOException e) {diff --git a/source/de/anomic/kelondro/kelondroFixedWidthArray.java b/source/de/anomic/kelondro/kelondroFixedWidthArray.javaindex a44f63c66..ee6ef7ba9 100644--- a/source/de/anomic/kelondro/kelondroFixedWidthArray.java+++ b/source/de/anomic/kelondro/kelondroFixedWidthArray.java@@ -89,7 +89,7 @@ public class kelondroFixedWidthArray extends kelondroRecords implements kelondro// make room for elementNode n;- while (size() <= index) {+ while (super.USAGE.allCount() <= index) {n = newNode();n.commit(CP_NONE);}