From 47b541b2d155a383ae99586bd5f68f68364902b0 Mon Sep 17 00:00:00 2001 From: orbiter Date: Wed, 5 Apr 2006 10:34:24 +0000 Subject: [PATCH] added better option handling in yacysearch added depth option for image presentation git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2001 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/index.java | 2 ++ htroot/yacysearch.html | 2 ++ htroot/yacysearch.java | 12 +++++++++++- source/de/anomic/plasma/plasmaParser.java | 1 + source/de/anomic/plasma/plasmaSearchImages.java | 2 +- 5 files changed, 17 insertions(+), 2 deletions(-) diff --git a/htroot/index.java b/htroot/index.java index 8c4e36fb2..1697ed6b4 100644 --- a/htroot/index.java +++ b/htroot/index.java @@ -117,6 +117,8 @@ public class index { prop.put("results", ""); prop.put("urlmaskoptions", 0); prop.put("urlmaskoptions_urlmaskfilter", ".*"); + prop.put("type", "href"); + prop.put("depth", "0"); return prop; } diff --git a/htroot/yacysearch.html b/htroot/yacysearch.html index 1ba4fafd2..374b9f953 100644 --- a/htroot/yacysearch.html +++ b/htroot/yacysearch.html @@ -50,6 +50,8 @@ picPlus.src = "/env/grafics/plus.gif"; + +


diff --git a/htroot/yacysearch.java b/htroot/yacysearch.java index 47c018573..bf5138abf 100644 --- a/htroot/yacysearch.java +++ b/htroot/yacysearch.java @@ -108,6 +108,8 @@ public class yacysearch { prop.put("resource", "global"); prop.put("time", 6); prop.put("urlmaskfilter", ".*"); + prop.put("type", "href"); + prop.put("depth", "0"); prop.put("type", 0); prop.put("type_excluded", 0); prop.put("type_num-results", 0); @@ -297,6 +299,8 @@ public class yacysearch { prop.put("resource", (global) ? "global" : "local"); prop.put("time", searchtime / 1000); prop.put("urlmaskfilter", urlmask); + prop.put("type", "href"); + prop.put("depth", "0"); // adding some additional properties needed for the rss feed String hostName = (String) header.get("Host", "localhost"); @@ -308,9 +312,11 @@ public class yacysearch { if (post.get("type", "href").equals("image")) { prop.put("type", 1); // set type of result: image list + int depth = post.getInt("depth", 0); + if (querystring.startsWith("http://")) { try { - plasmaSearchImages si = new plasmaSearchImages(sb.snippetCache, 6000, new URL(querystring), 0); + plasmaSearchImages si = new plasmaSearchImages(sb.snippetCache, 6000, new URL(querystring), depth); Iterator i = si.entries(); htmlFilterImageEntry ie; int c = 0; @@ -322,6 +328,10 @@ public class yacysearch { prop.put("type_results", c); } catch (MalformedURLException e) {} } + + prop.put("former", post.get("search", "")); + prop.put("type", "image"); + prop.put("depth", depth); } // return rewrite properties return prop; diff --git a/source/de/anomic/plasma/plasmaParser.java b/source/de/anomic/plasma/plasmaParser.java index d6c0224fc..154c8721b 100644 --- a/source/de/anomic/plasma/plasmaParser.java +++ b/source/de/anomic/plasma/plasmaParser.java @@ -899,6 +899,7 @@ final class plasmaParserFactory implements KeyedPoolableObjectFactory { theParser.reset(); } } + } final class plasmaParserPool extends GenericKeyedObjectPool { diff --git a/source/de/anomic/plasma/plasmaSearchImages.java b/source/de/anomic/plasma/plasmaSearchImages.java index 6311173f5..a5023f5fa 100644 --- a/source/de/anomic/plasma/plasmaSearchImages.java +++ b/source/de/anomic/plasma/plasmaSearchImages.java @@ -61,7 +61,7 @@ public final class plasmaSearchImages { if (maxTime > 10) { byte[] res = sc.getResource(url, true, (int) maxTime); if (res != null) { - plasmaParserDocument document = sc.parseDocument(url, res); // #### THIS RETURNS ONLY ANCHOR TAGS! BUG! ### + plasmaParserDocument document = sc.parseDocument(url, res); // add the image links this.addAll(document.getImages());