Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
*) added page to compare results of 2 search engines
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5144 6c8d7289-2bf4-0310-a012-ef5d649a1542
- Loading branch information
low012
committed
Sep 13, 2008
1 parent
1fb1665
commit dc56c35
Showing
2 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
<head> | ||
<title>YaCy '#[clientname]#': Websearch Comparison</title> | ||
#%env/templates/metas.template%# | ||
</head> | ||
<body> | ||
#%env/templates/header.template%# | ||
<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> | ||
<form action="" method="get"> | ||
<dl> | ||
<dt>Left Search Engine</dt> | ||
<dd> | ||
<select name="left"> | ||
#{searchengines}# | ||
<option>#[searchengine]#</option> | ||
#{/searchengines}# | ||
</select> | ||
</dd> | ||
<dt>Right Search Engine</dt> | ||
<dd> | ||
<select name="right"> | ||
#{searchengines}# | ||
<option>#[searchengine]#</option> | ||
#{/searchengines}# | ||
</select> | ||
</dd> | ||
<dt>Query</dt> | ||
<dd> | ||
<input type="text" name="query" size="60"> | ||
</dd> | ||
</dl> | ||
<input type="submit" /> | ||
</form> | ||
</fieldset> | ||
#(search)# | ||
:: | ||
<fieldset> | ||
<legend>Search Result</legend> | ||
<iframe src="#[left]##[query]#" width="49%" height="300"></iframe> | ||
<iframe src="#[right]##[query]#" width="49%" height="300"></iframe> | ||
</fieldset> | ||
#(/search)# | ||
#%env/templates/footer.template%# | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
//Comparison_p.java | ||
//----------------------- | ||
//part of the AnomicHTTPD caching proxy | ||
//(C) by Michael Peter Christen; mc@yacy.net | ||
//first published on http://www.anomic.de | ||
//Frankfurt, Germany, 2004 | ||
// | ||
//This File is contributed by Marc Nause | ||
//last major change: 13.09.2008 | ||
// | ||
//This program is free software; you can redistribute it and/or modify | ||
//it under the terms of the GNU General Public License as published by | ||
//the Free Software Foundation; either version 2 of the License, or | ||
//(at your option) any later version. | ||
// | ||
//This program is distributed in the hope that it will be useful, | ||
//but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
//GNU General Public License for more details. | ||
// | ||
//You should have received a copy of the GNU General Public License | ||
//along with this program; if not, write to the Free Software | ||
//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
|
||
|
||
//You must compile this file with | ||
//javac -classpath .:../Classes Message.java | ||
//if the shell's current path is HTROOT | ||
|
||
|
||
import de.anomic.http.httpRequestHeader; | ||
import de.anomic.server.serverObjects; | ||
import de.anomic.server.serverSwitch; | ||
import de.anomic.server.servletProperties; | ||
import java.util.Hashtable; | ||
import java.util.Map; | ||
|
||
public class Comparison_p{ | ||
|
||
public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch<?> env) { | ||
final servletProperties prop = new servletProperties(); | ||
|
||
Map<String, String> searchengines = new Hashtable<String, String>(); | ||
searchengines.put("YaCy", "yacysearch.html?display=0&query="); | ||
searchengines.put("google.de", "http://www.google.de/?q="); | ||
searchengines.put("metager.de", "http://www.metager.de/meta/cgi-bin/meta.ger1?eingabe="); | ||
|
||
if (post != null) { | ||
prop.put("search", 1); | ||
prop.put("search_query", post.get("query", "")); | ||
prop.put("search_left", searchengines.get(post.get("left", searchengines.get("YaCy")))); | ||
prop.put("search_right", searchengines.get(post.get("right", searchengines.get("YaCy")))); | ||
} else { | ||
|
||
prop.put("search", 0); | ||
|
||
} | ||
|
||
prop.put("searchengines", searchengines.size()); | ||
int i = 0; | ||
for(String name : searchengines.keySet()){ | ||
prop.put("searchengines_" + i + "_searchengine", name); | ||
i++; | ||
} | ||
|
||
// return rewrite properties | ||
return prop; | ||
} | ||
} |