Skip to content

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

In DHT selection delete only those references that were actually selected

hermens8c60d6d11762
diff --git a/source/de/anomic/yacy/dht/Dispatcher.java b/source/de/anomic/yacy/dht/Dispatcher.java
index ea6e44ce7..5542f7429 100755
--- a/source/de/anomic/yacy/dht/Dispatcher.java
+++ b/source/de/anomic/yacy/dht/Dispatcher.java
@@ -28,6 +28,7 @@ package de.anomic.yacy.dht;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
@@ -188,7 +189,17 @@ public class Dispatcher {
containers.add(container);
}
// then remove the container from the backend
- for (ReferenceContainer c: containers) this.backend.deleteAllReferences(c.getWordHash());
+ HashSet<String> urlHashes = new HashSet<String>();
+ Iterator<ReferenceRow> it;
+ for (ReferenceContainer c: containers) {
+ urlHashes.clear();
+ it = c.entries();
+ while (it.hasNext()) {
+ urlHashes.add(it.next().urlHash());
+ }
+ if (this.log.isFine()) this.log.logFine("selected " + urlHashes.size() + " urls for word '" + c.getWordHash() + "'");
+ if (urlHashes.size() > 0) this.backend.removeReferences(c.getWordHash(), urlHashes);
+ }
// finished. The caller must take care of the containers and must put them back if not needed
return containers;