Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
enhanced image search result display: concurrent loading of images before they are displayed
orbiterae07e11bc56c
diff --git a/htroot/yacysearchitem.java b/htroot/yacysearchitem.javaindex db1fef978..44063827c 100644--- a/htroot/yacysearchitem.java+++ b/htroot/yacysearchitem.java@@ -173,6 +173,7 @@ public class yacysearchitem {if (ms == null) {prop.put("content_item", "0");} else {+ sb.loader.loadIfNotExistBackground(ms.href.toNormalform(true, false), 1024 * 1024 * 10);prop.putHTML("content_item_hrefCache", (auth) ? "/ViewImage.png?url=" + ms.href.toNormalform(true, false) : ms.href.toNormalform(true, false));prop.putHTML("content_item_href", ms.href.toNormalform(true, false));prop.put("content_item_code", sb.licensedURLs.aquireLicense(ms.href));@@ -240,5 +241,4 @@ public class yacysearchitem {size = size / 1024;return size + " gbyte";}-}diff --git a/source/net/yacy/cora/protocol/http/HTTPClient.java b/source/net/yacy/cora/protocol/http/HTTPClient.javaindex 0b7b8c0ca..8ef074ef6 100644--- a/source/net/yacy/cora/protocol/http/HTTPClient.java+++ b/source/net/yacy/cora/protocol/http/HTTPClient.java@@ -512,6 +512,7 @@ public class HTTPClient {private void storeConnectionInfo(final HttpUriRequest httpUriRequest) {final int port = httpUriRequest.getURI().getPort();final String thost = httpUriRequest.getURI().getHost();+ assert thost != null : "uri = " + httpUriRequest.getURI().toString();ConnectionInfo.addConnection(new ConnectionInfo(httpUriRequest.getURI().getScheme(),port == 80 ? thost : thost + ":" + port,diff --git a/source/net/yacy/repository/LoaderDispatcher.java b/source/net/yacy/repository/LoaderDispatcher.javaindex a16b6c0bb..d1a280d4d 100644--- a/source/net/yacy/repository/LoaderDispatcher.java+++ b/source/net/yacy/repository/LoaderDispatcher.java@@ -347,7 +347,11 @@ public final class LoaderDispatcher {}public void loadIfNotExistBackground(String url, File cache, long maxFileSize) {- new Loader(url, cache, maxFileSize).start();+ new Loader(url, cache, maxFileSize, CrawlProfile.CacheStrategy.IFEXIST).start();+ }++ public void loadIfNotExistBackground(String url, long maxFileSize) {+ new Loader(url, null, maxFileSize, CrawlProfile.CacheStrategy.IFEXIST).start();}private class Loader extends Thread {@@ -355,20 +359,22 @@ public final class LoaderDispatcher {private String url;private File cache;private long maxFileSize;+ private CrawlProfile.CacheStrategy cacheStrategy;- public Loader(String url, File cache, long maxFileSize) {+ public Loader(String url, File cache, long maxFileSize, CrawlProfile.CacheStrategy cacheStrategy) {this.url = url;this.cache = cache;this.maxFileSize = maxFileSize;+ this.cacheStrategy = cacheStrategy;}public void run() {- if (this.cache.exists()) return;+ if (this.cache != null && this.cache.exists()) return;try {// load from the net- Response response = load(request(new DigestURI(this.url), false, true), CrawlProfile.CacheStrategy.NOCACHE, this.maxFileSize);+ Response response = load(request(new DigestURI(this.url), false, true), this.cacheStrategy, this.maxFileSize);byte[] b = response.getContent();- FileUtils.copy(b, this.cache);+ if (this.cache != null) FileUtils.copy(b, this.cache);} catch (MalformedURLException e) {} catch (IOException e) {}}}