- some bugfixes to compare search

- redesigned input boxes: smaller, more space for result page

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5158 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 16 years ago
parent 693fa2a157
commit 105be67998

@ -12,35 +12,24 @@
::
#%env/templates/embeddedheader.template%#
#(/display)#
<h2>Websearch Comparison</h2>
<p>This page lets you compare two search engines. Please select search engines
and enter your searchword(s) below.</p>
<fieldset>
<legend>Parameters</legend>
<legend>Websearch Comparison</legend>
<form action="" method="get">
<dl>
<dt>Left Search Engine</dt>
<dd>
<p>Left Search Engine
<select name="left">
#{searchengines}#
<option #(leftengine)#::selected="selected"#(/leftengine)#>#[searchengine]#</option>
#{/searchengines}#
</select>
</dd>
<dt>Right Search Engine</dt>
<dd>
&nbsp;&nbsp;Right Search Engine
<select name="right">
#{searchengines}#
<option #(rightengine)#::selected="selected"#(/rightengine)#>#[searchengine]#</option>
#{/searchengines}#
</select>
</dd>
<dt>Query</dt>
<dd>
<input type="text" name="query" value="#[search_query]#" size="60">
</dd>
</dl>
<input type="submit" />
&nbsp;&nbsp;Query
<input type="text" name="query" value="#[search_query]#" size="60"><input type="submit" />
</p>
</form>
</fieldset>
#(search)#

@ -63,35 +63,37 @@ public class compare_yacy {
String default_right = sb.getConfig("compare_yacy.right", defaultsearch);
if (post != null) {
prop.put("search", 1);
prop.putHTML("search_query", post.get("query", ""));
prop.putHTML("search_left", searchengines.get(post.get("left", default_left)));
prop.putHTML("search_right", searchengines.get(post.get("right", default_right)));
} else {
prop.put("search", 0);
prop.put("search_query", "");
if (searchengines.get(post.get("left", default_left)) != null) {
default_left = post.get("left", default_left);
sb.setConfig("compare_yacy.left", default_left);
}
if (searchengines.get(post.get("right", default_right)) != null) {
default_right = post.get("right", default_right);
sb.setConfig("compare_yacy.right", default_right);
}
}
prop.put("searchengines", order.length);
String name;
for (int i = 0; i < order.length; i++) {
name = order[i];
prop.putHTML("searchengines_" + i + "_searchengine", name);
if (post != null && post.get("left", default_left).equals(name)) {
prop.put("searchengines_" + i + "_leftengine", 1);
sb.setConfig("compare_yacy.left", name);
} else {
prop.put("searchengines_" + i + "_leftengine", 0);
}
if (post != null && post.get("right", default_right).equals(name)) {
prop.put("searchengines_" + i + "_rightengine", 1);
sb.setConfig("compare_yacy.right", name);
} else {
prop.put("searchengines_" + i + "_rightengine", 0);
}
prop.put("searchengines_" + i + "_leftengine", name.equals(default_left) ? 1 : 0);
prop.put("searchengines_" + i + "_rightengine", name.equals(default_right) ? 1 : 0);
}
prop.putHTML("search_left", searchengines.get(default_left));
prop.putHTML("search_right", searchengines.get(default_right));
if (post == null || post.get("query", "").length() == 0) {
prop.put("search", 0);
prop.put("search_query", "");
return prop;
}
prop.put("search", 1);
prop.putHTML("search_query", post.get("query", ""));
// return rewrite properties
return prop;
}

Loading…
Cancel
Save