From 8ee3a94e82b32fbe1181c65a06db30e0684e4466 Mon Sep 17 00:00:00 2001 From: orbiter Date: Sun, 10 May 2009 11:44:17 +0000 Subject: [PATCH] fix for non-caching of sitehash, see http://forum.yacy-websuche.de/viewtopic.php?p=14440#p14440 git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5942 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- .../text/ReferenceContainerCache.java | 25 +++++++++++++++++++ .../de/anomic/plasma/plasmaSearchQuery.java | 1 + 2 files changed, 26 insertions(+) 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 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 container = cache.remove(tha); + if (container == null) container = new ReferenceContainer(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 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;