Skip to content

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

fix for non-caching of sitehash, see http://forum.yacy-websuche.de/viewtopic.php?p=14440#p14440

orbiter8ee3a94e82b3
diff --git a/source/de/anomic/kelondro/text/ReferenceContainerCache.java b/source/de/anomic/kelondro/text/ReferenceContainerCache.java
index 69f9f5c11..4b71e52d4 100644
--- a/source/de/anomic/kelondro/text/ReferenceContainerCache.java
+++ b/source/de/anomic/kelondro/text/ReferenceContainerCache.java
@@ -433,6 +433,31 @@ public final class ReferenceContainerCache<ReferenceType extends Reference> exte
cache.put(tha, container);
}
}
+
+ /*
+ public void add(final byte[] termHash, final ReferenceType newEntry) {
+ assert this.cache != null;
+ ByteArray tha = new ByteArray(termHash);
+
+ // first access the cache without synchronization
+ ReferenceContainer<ReferenceType> container = cache.remove(tha);
+ if (container == null) container = new ReferenceContainer<ReferenceType>(factory, termHash, this.payloadrow, 1);
+ container.put(newEntry);
+
+ // then try to replace the entry that should be empty,
+ // but it can be possible that another thread has written something in between
+ ReferenceContainer<ReferenceType> containerNew = cache.put(tha, container);
+ if (containerNew == null) return;
+ container = containerNew;
+
+ // finally use synchronization: ensure that the entry is written exclusively
+ synchronized (cache) {
+ containerNew = cache.get(tha);
+ if (containerNew != null) container.putAllRecent(containerNew);
+ cache.put(tha, container);
+ }
+ }
+ */
public int minMem() {
return 0;
diff --git a/source/de/anomic/plasma/plasmaSearchQuery.java b/source/de/anomic/plasma/plasmaSearchQuery.java
index f5b736f6f..6dc9a9309 100644
--- a/source/de/anomic/plasma/plasmaSearchQuery.java
+++ b/source/de/anomic/plasma/plasmaSearchQuery.java
@@ -316,6 +316,7 @@ public final class plasmaSearchQuery {
"*" + new String(Word.word2hash(this.ranking.toExternalString())) +
"*" + this.prefer +
"*" + this.urlMask +
+ "*" + this.sitehash +
"*" + this.targetlang +
"*" + this.constraint +
"*" + this.maxDistance;