Skip to content

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

*) Remove entries from AssortmentCluster before reinserting the rest into the ramCache

hermens0b60b9bf51f6
diff --git a/source/de/anomic/plasma/plasmaWordIndex.java b/source/de/anomic/plasma/plasmaWordIndex.java
index 6b3b26d6e..fd2795e54 100644
--- a/source/de/anomic/plasma/plasmaWordIndex.java
+++ b/source/de/anomic/plasma/plasmaWordIndex.java
@@ -335,8 +335,11 @@ public final class plasmaWordIndex {
int removed = 0;
removed += ramCache.removeEntries(wordHash, urlHashes, deleteComplete);
plasmaWordIndexEntryContainer container = assortmentCluster.removeFromAll(wordHash, -1);
- if (container != null) this.addEntries(container, System.currentTimeMillis(), false);
- removed = backend.removeEntries(wordHash, urlHashes, deleteComplete);
+ if (container != null) {
+ removed += container.removeEntries(wordHash, urlHashes, deleteComplete);
+ if (container.size() != 0) this.addEntries(container, System.currentTimeMillis(), false);
+ }
+ removed += backend.removeEntries(wordHash, urlHashes, deleteComplete);
return removed;
}
diff --git a/source/de/anomic/plasma/plasmaWordIndexCache.java b/source/de/anomic/plasma/plasmaWordIndexCache.java
index 6fa44b4c4..36a09a475 100644
--- a/source/de/anomic/plasma/plasmaWordIndexCache.java
+++ b/source/de/anomic/plasma/plasmaWordIndexCache.java
@@ -309,7 +309,7 @@ public final class plasmaWordIndexCache implements plasmaWordIndexInterface {
synchronized (cache) {
plasmaWordIndexEntryContainer c = (plasmaWordIndexEntryContainer) deleteContainer(wordHash);
if (c != null) {
- for (int i = 0; i < urlHashes.length; i++) count += (c.remove(urlHashes[i]) == null) ? 0 : 1;
+ count = c.removeEntries(wordHash, urlHashes, deleteComplete);
if (c.size() != 0) this.addEntries(c, System.currentTimeMillis(), false);
}
}
diff --git a/source/de/anomic/plasma/plasmaWordIndexEntryContainer.java b/source/de/anomic/plasma/plasmaWordIndexEntryContainer.java
index 28a05e7a1..831e22d68 100644
--- a/source/de/anomic/plasma/plasmaWordIndexEntryContainer.java
+++ b/source/de/anomic/plasma/plasmaWordIndexEntryContainer.java
@@ -144,7 +144,14 @@ public final class plasmaWordIndexEntryContainer implements Comparable {
public plasmaWordIndexEntry remove(String urlHash) {
return (plasmaWordIndexEntry) container.remove(urlHash);
}
-
+
+ public int removeEntries(String wordHash, String[] urlHashes, boolean deleteComplete) {
+ if (!wordHash.equals(this.wordHash)) return 0;
+ int count = 0;
+ for (int i = 0; i < urlHashes.length; i++) count += (remove(urlHashes[i]) == null) ? 0 : 1;
+ return count;
+ }
+
public Iterator entries() {
// returns an iterator of plasmaWordIndexEntry objects
return container.values().iterator();