Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
*) added page to compare results of 2 search engines
low012dc56c352896c
diff --git a/htroot/Comparison_p.html b/htroot/Comparison_p.htmlnew file mode 100644index 000000000..cfa03563b--- /dev/null+++ b/htroot/Comparison_p.html@@ -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>diff --git a/htroot/Comparison_p.java b/htroot/Comparison_p.javanew file mode 100644index 000000000..4039a65d2--- /dev/null+++ b/htroot/Comparison_p.java@@ -0,0 +1,69 @@+//Comparison_p.java+//-----------------------+//part of the AnomicHTTPD caching proxy+//(C) by Michael Peter Christen; [email protected]+//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;+ }+}