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
pull/1/head
orbiter 19 years ago
parent c9e16bfd48
commit 47b541b2d1

@ -117,6 +117,8 @@ public class index {
prop.put("results", ""); prop.put("results", "");
prop.put("urlmaskoptions", 0); prop.put("urlmaskoptions", 0);
prop.put("urlmaskoptions_urlmaskfilter", ".*"); prop.put("urlmaskoptions_urlmaskfilter", ".*");
prop.put("type", "href");
prop.put("depth", "0");
return prop; return prop;
} }

@ -50,6 +50,8 @@ picPlus.src = "/env/grafics/plus.gif";
<input type="hidden" name="resource" value="#[resource]#"> <input type="hidden" name="resource" value="#[resource]#">
<input type="hidden" name="time" value="#[time]#"> <input type="hidden" name="time" value="#[time]#">
<input type="hidden" name="urlmaskfilter" value="#[urlmaskfilter]#"> <input type="hidden" name="urlmaskfilter" value="#[urlmaskfilter]#">
<input type="hidden" name="depth" value="#[depth]#">
<input type="hidden" name="type" value="#[type]#">
</form> </form>
</p><hr> </p><hr>

@ -108,6 +108,8 @@ public class yacysearch {
prop.put("resource", "global"); prop.put("resource", "global");
prop.put("time", 6); prop.put("time", 6);
prop.put("urlmaskfilter", ".*"); prop.put("urlmaskfilter", ".*");
prop.put("type", "href");
prop.put("depth", "0");
prop.put("type", 0); prop.put("type", 0);
prop.put("type_excluded", 0); prop.put("type_excluded", 0);
prop.put("type_num-results", 0); prop.put("type_num-results", 0);
@ -297,6 +299,8 @@ public class yacysearch {
prop.put("resource", (global) ? "global" : "local"); prop.put("resource", (global) ? "global" : "local");
prop.put("time", searchtime / 1000); prop.put("time", searchtime / 1000);
prop.put("urlmaskfilter", urlmask); prop.put("urlmaskfilter", urlmask);
prop.put("type", "href");
prop.put("depth", "0");
// adding some additional properties needed for the rss feed // adding some additional properties needed for the rss feed
String hostName = (String) header.get("Host", "localhost"); String hostName = (String) header.get("Host", "localhost");
@ -308,9 +312,11 @@ public class yacysearch {
if (post.get("type", "href").equals("image")) { if (post.get("type", "href").equals("image")) {
prop.put("type", 1); // set type of result: image list prop.put("type", 1); // set type of result: image list
int depth = post.getInt("depth", 0);
if (querystring.startsWith("http://")) { if (querystring.startsWith("http://")) {
try { 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(); Iterator i = si.entries();
htmlFilterImageEntry ie; htmlFilterImageEntry ie;
int c = 0; int c = 0;
@ -322,6 +328,10 @@ public class yacysearch {
prop.put("type_results", c); prop.put("type_results", c);
} catch (MalformedURLException e) {} } catch (MalformedURLException e) {}
} }
prop.put("former", post.get("search", ""));
prop.put("type", "image");
prop.put("depth", depth);
} }
// return rewrite properties // return rewrite properties
return prop; return prop;

@ -899,6 +899,7 @@ final class plasmaParserFactory implements KeyedPoolableObjectFactory {
theParser.reset(); theParser.reset();
} }
} }
} }
final class plasmaParserPool extends GenericKeyedObjectPool { final class plasmaParserPool extends GenericKeyedObjectPool {

@ -61,7 +61,7 @@ public final class plasmaSearchImages {
if (maxTime > 10) { if (maxTime > 10) {
byte[] res = sc.getResource(url, true, (int) maxTime); byte[] res = sc.getResource(url, true, (int) maxTime);
if (res != null) { 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 // add the image links
this.addAll(document.getImages()); this.addAll(document.getImages());

Loading…
Cancel
Save