Skip to content

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

read snippets from cache in case they are not provided in RAM

orbiter630a955674d7
diff --git a/source/de/anomic/plasma/plasmaSnippetCache.java b/source/de/anomic/plasma/plasmaSnippetCache.java
index fc057ecde..d2a1f6864 100644
--- a/source/de/anomic/plasma/plasmaSnippetCache.java
+++ b/source/de/anomic/plasma/plasmaSnippetCache.java
@@ -201,11 +201,15 @@ public class plasmaSnippetCache {
// getting resource metadata (e.g. the http headers for http resources)
if (entry != null) docInfo = entry.getDocumentInfo();
- // read resource body
+ // read resource body (if it is there)
resource = entry.cacheArray();
- if (resource == null) {
- return new Snippet(null, ERROR_RESOURCE_LOADING, "error loading resource, plasmaHTCache.Entry cache is NULL");
- }
+
+ // in case that the reosurce was not in ram, read it from disk
+ if (resource == null) resource = this.cacheManager.loadResourceContent(url);
+
+ // if it is still not available, throw exception
+ if (resource == null) return new Snippet(null, ERROR_RESOURCE_LOADING, "error loading resource, plasmaHTCache.Entry cache is NULL");
+
source = SOURCE_WEB;
}
} catch (Exception e) {