Skip to content

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

- changed snippet fetch strategy logic: do not check if entry is in cache. This should reduce IO load on the HTCACHE which is a showstopper during large number of search requests - forced a possible short memory status when a search is started to flush caches that may cause search-heaps with resource contention effects

orbiterdbea40d5362d
diff --git a/source/de/anomic/search/SearchEventCache.java b/source/de/anomic/search/SearchEventCache.java
index 67a242853..bcac962f4 100644
--- a/source/de/anomic/search/SearchEventCache.java
+++ b/source/de/anomic/search/SearchEventCache.java
@@ -133,6 +133,7 @@ public class SearchEventCache {
// start a new event
boolean delete = Switchboard.getSwitchboard() == null | Switchboard.getSwitchboard().getConfigBool("search.verify.delete", true);
event = new SearchEvent(query, peers, workTables, preselectedPeerHashes, generateAbstracts, loader, remote_maxcount, remote_maxtime, burstRobinsonPercent, burstMultiwordPercent, delete);
+ MemoryControl.request(100 * 1024 * 1024, false); // this may trigger a short memory status which causes a reducing of cache space of other threads
}
return event;
diff --git a/source/de/anomic/search/TextSnippet.java b/source/de/anomic/search/TextSnippet.java
index f1c3f91c6..a179bdbfc 100644
--- a/source/de/anomic/search/TextSnippet.java
+++ b/source/de/anomic/search/TextSnippet.java
@@ -179,21 +179,19 @@ public class TextSnippet implements Comparable<TextSnippet>, Comparator<TextSnip
// first try to get the snippet from metadata
String loc;
boolean noCacheUsage = url.isFile() || url.isSMB() || cacheStrategy == null;
- boolean objectWasInCache = (noCacheUsage) ? false : de.anomic.http.client.Cache.has(url);
- boolean useMetadata = !objectWasInCache && (cacheStrategy == null || !cacheStrategy.mustBeOffline());
- if (useMetadata && containsAllHashes(loc = comp.dc_title(), queryhashes)) {
+ if (containsAllHashes(loc = comp.dc_title(), queryhashes)) {
// try to create the snippet from information given in the url itself
init(url.hash(), loc, ResultClass.SOURCE_METADATA, null);
return;
- } else if (useMetadata && containsAllHashes(loc = comp.dc_creator(), queryhashes)) {
+ } else if (containsAllHashes(loc = comp.dc_creator(), queryhashes)) {
// try to create the snippet from information given in the creator metadata
init(url.hash(), loc, ResultClass.SOURCE_METADATA, null);
return;
- } else if (useMetadata && containsAllHashes(loc = comp.dc_subject(), queryhashes)) {
+ } else if (containsAllHashes(loc = comp.dc_subject(), queryhashes)) {
// try to create the snippet from information given in the subject metadata
init(url.hash(), loc, ResultClass.SOURCE_METADATA, null);
return;
- } else if (useMetadata && containsAllHashes(loc = comp.url().toNormalform(true, true).replace('-', ' '), queryhashes)) {
+ } else if (containsAllHashes(loc = comp.url().toNormalform(true, true).replace('-', ' '), queryhashes)) {
// try to create the snippet from information given in the url
init(url.hash(), loc, ResultClass.SOURCE_METADATA, null);
return;
@@ -210,8 +208,7 @@ public class TextSnippet implements Comparable<TextSnippet>, Comparator<TextSnip
// if it is still not available, report an error
init(url.hash(), null, ResultClass.ERROR_RESOURCE_LOADING, "error loading resource from net, no cache entry");
return;
- }
- if (!objectWasInCache) {
+ } else {
// place entry on indexing queue
Switchboard.getSwitchboard().toIndexer(response);
source = ResultClass.SOURCE_WEB;
diff --git a/source/net/yacy/kelondro/util/MemoryControl.java b/source/net/yacy/kelondro/util/MemoryControl.java
index 916749376..9f8d6284e 100644
--- a/source/net/yacy/kelondro/util/MemoryControl.java
+++ b/source/net/yacy/kelondro/util/MemoryControl.java
@@ -170,7 +170,7 @@ public class MemoryControl {
}
public static boolean shortStatus() {
- if (shortStatus) System.out.println("**** SHORT MEMORY ****");
+ //if (shortStatus) System.out.println("**** SHORT MEMORY ****");
return shortStatus;
}