Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
fixed size computation of index elements from the collection index
orbiter95160d7f2ccd
diff --git a/source/de/anomic/index/indexCollectionRI.java b/source/de/anomic/index/indexCollectionRI.javaindex e28b6ff9f..96951f073 100644--- a/source/de/anomic/index/indexCollectionRI.java+++ b/source/de/anomic/index/indexCollectionRI.java@@ -70,6 +70,14 @@ public class indexCollectionRI extends indexAbstractRI implements indexRI {}}+ public int indexSize(String wordHash) {+ try {+ return collectionIndex.indexSize(wordHash.getBytes());+ } catch (IOException e) {+ return 0;+ }+ }+public Iterator wordContainers(String startWordHash, boolean rot) {return new wordContainersIterator(startWordHash, rot);}diff --git a/source/de/anomic/kelondro/kelondroCollectionIndex.java b/source/de/anomic/kelondro/kelondroCollectionIndex.javaindex 71d1a7595..7aa6185bf 100644--- a/source/de/anomic/kelondro/kelondroCollectionIndex.java+++ b/source/de/anomic/kelondro/kelondroCollectionIndex.java@@ -305,6 +305,14 @@ public class kelondroCollectionIndex {index.put(indexEntry);}+ public int indexSize(byte[] key) throws IOException {+ synchronized (index) {+ kelondroRow.Entry indexrow = index.get(key);+ if (indexrow == null) return 0;+ return (int) indexrow.getColLong(idx_col_chunkcount);+ }+ }+public kelondroRowSet get(byte[] key, boolean deleteIfEmpty) throws IOException {// find an entry, if one existssynchronized (index) {diff --git a/source/de/anomic/plasma/plasmaDHTChunk.java b/source/de/anomic/plasma/plasmaDHTChunk.javaindex d32357d5f..50c900b79 100644--- a/source/de/anomic/plasma/plasmaDHTChunk.java+++ b/source/de/anomic/plasma/plasmaDHTChunk.java@@ -288,8 +288,9 @@ public class plasmaDHTChunk {iEntry = (indexEntry) urlIter.next();urlHashes.add(iEntry.urlHash());}+ String wordHash = indexContainers[i].getWordHash();count += wordIndex.removeEntries(this.indexContainers[i].getWordHash(), urlHashes, true);- log.logFine("Deleted partial index (" + c + " URLs) for word " + this.indexContainers[i].getWordHash() + "; " + this.wordIndex.indexSize(indexContainers[i].getWordHash()) + " entries left");+ log.logFine("Deleted partial index (" + c + " URLs) for word " + wordHash + "; " + this.wordIndex.indexSize(wordHash) + " entries left");this.indexContainers[i] = null;}return count;diff --git a/source/de/anomic/plasma/plasmaWordIndex.java b/source/de/anomic/plasma/plasmaWordIndex.javaindex 197ac0670..e7dddc7ad 100644--- a/source/de/anomic/plasma/plasmaWordIndex.java+++ b/source/de/anomic/plasma/plasmaWordIndex.java@@ -398,7 +398,7 @@ public final class plasmaWordIndex extends indexAbstractRI implements indexRI {entity.close();}} catch (IOException e) {}- if (useCollectionIndex) size += collections.size();+ if (useCollectionIndex) size += collections.indexSize(wordHash);size += assortmentCluster.indexSize(wordHash);size += ramCache.indexSize(wordHash);return size;