fixed size computation of index elements from the collection index

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2380 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 19 years ago
parent 26116cabde
commit 95160d7f2c

@ -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);
}

@ -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 exists
synchronized (index) {

@ -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;

@ -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;

Loading…
Cancel
Save