Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
- fixes to query parameter - replaced/removed search query attribute (was old style, new is 'query' according to SRU)
orbiter9842fab6e47f
diff --git a/htroot/ViewFile.java b/htroot/ViewFile.javaindex 099b28e74..cb1108d9a 100644--- a/htroot/ViewFile.java+++ b/htroot/ViewFile.java@@ -411,9 +411,16 @@ public class ViewFile {private static final String[] wordArray(String words) {String[] w = new String[0];if (words == null || words.length() == 0) return w;+ if (words.length() > 1 && words.charAt(0) == '[' && words.charAt(words.length() - 1) == ']') {+ words = words.substring(1, words.length() - 1);+ }try {words = URLDecoder.decode(words, "UTF-8");- w = words.substring(1, words.length() - 1).split(",");+ if (words.indexOf(' ') >= 0) return words.split(" ");+ if (words.indexOf(',') >= 0) return words.split(",");+ if (words.indexOf('+') >= 0) return words.split("+");+ w = new String[1];+ w[0] = words;} catch (final UnsupportedEncodingException e) {}return w;}diff --git a/htroot/api/util/ynetSearch.java b/htroot/api/util/ynetSearch.javaindex e4c980d9b..343a465c5 100755--- a/htroot/api/util/ynetSearch.java+++ b/htroot/api/util/ynetSearch.java@@ -43,7 +43,7 @@ public class ynetSearch {k = it.next();s = s + "&" + k.getKey() + "=" + k.getValue();}- // final String s = searchaddress+"&search="+post.get("search")+"&maximumRecords="+post.get("maximumRecords")+"&startRecord="+post.get("startRecord");+ // final String s = searchaddress+"&query="+post.get("search")+"&maximumRecords="+post.get("maximumRecords")+"&startRecord="+post.get("startRecord");final URL url = new URL(s);is = url.openStream();final String httpout = new Scanner(is).useDelimiter( "\\Z" ).next();diff --git a/htroot/yacysearch.java b/htroot/yacysearch.javaindex 866f722ff..78ed31933 100644--- a/htroot/yacysearch.java+++ b/htroot/yacysearch.java@@ -96,8 +96,8 @@ public class yacysearch {final String client = header.get(HeaderFramework.CONNECTION_PROP_CLIENTIP); // the search client who initiated the search// get query- String originalquerystring = (post == null) ? "" : post.get("query", post.get("search", "")).trim(); // SRU compliance- String querystring = originalquerystring;+ String originalquerystring = (post == null) ? "" : post.get("query", "").trim();+ String querystring = originalquerystring.replace('+', ' ');boolean fetchSnippets = (post != null && post.get("verify", "false").equals("true"));final serverObjects prop = new serverObjects();@@ -535,7 +535,7 @@ public class yacysearch {prop.put("didYouMean_suggestions_"+meanCount+"_word", suggestion);prop.put("didYouMean_suggestions_"+meanCount+"_url","/yacysearch.html" + "?display=" + display +- "&search=" + suggestion ++ "&query=" + suggestion +"&maximumRecords="+ theQuery.displayResults() +"&startRecord=" + (0 * theQuery.displayResults()) +"&resource=" + ((theQuery.isLocal()) ? "local" : "global") +diff --git a/htroot/yacysearchitem.java b/htroot/yacysearchitem.javaindex 6cb81ecd4..758643f52 100644--- a/htroot/yacysearchitem.java+++ b/htroot/yacysearchitem.java@@ -24,9 +24,7 @@// along with this program; if not, write to the Free Software// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA-import java.io.UnsupportedEncodingException;import java.net.MalformedURLException;-import java.net.URLEncoder;import java.util.ArrayList;import java.util.TreeSet;@@ -116,8 +114,8 @@ public class yacysearchitem {prop.put("content_authorized", authenticated ? "1" : "0");prop.put("content_authorized_recommend", (sb.peers.newsPool.getSpecific(yacyNewsPool.OUTGOING_DB, yacyNewsPool.CATEGORY_SURFTIPP_ADD, "url", result.urlstring()) == null) ? "1" : "0");- prop.putHTML("content_authorized_recommend_deletelink", "/yacysearch.html?search=" + theQuery.queryString + "&Enter=Search&count=" + theQuery.displayResults() + "&offset=" + (theQuery.neededResults() - theQuery.displayResults()) + "&order=" + crypt.simpleEncode(theQuery.ranking.toExternalString()) + "&resource=local&time=3&deleteref=" + new String(result.hash()) + "&urlmaskfilter=.*");- prop.putHTML("content_authorized_recommend_recommendlink", "/yacysearch.html?search=" + theQuery.queryString + "&Enter=Search&count=" + theQuery.displayResults() + "&offset=" + (theQuery.neededResults() - theQuery.displayResults()) + "&order=" + crypt.simpleEncode(theQuery.ranking.toExternalString()) + "&resource=local&time=3&recommendref=" + new String(result.hash()) + "&urlmaskfilter=.*");+ prop.putHTML("content_authorized_recommend_deletelink", "/yacysearch.html?query=" + theQuery.queryString.replace(' ', '+') + "&Enter=Search&count=" + theQuery.displayResults() + "&offset=" + (theQuery.neededResults() - theQuery.displayResults()) + "&order=" + crypt.simpleEncode(theQuery.ranking.toExternalString()) + "&resource=local&time=3&deleteref=" + new String(result.hash()) + "&urlmaskfilter=.*");+ prop.putHTML("content_authorized_recommend_recommendlink", "/yacysearch.html?query=" + theQuery.queryString.replace(' ', '+') + "&Enter=Search&count=" + theQuery.displayResults() + "&offset=" + (theQuery.neededResults() - theQuery.displayResults()) + "&order=" + crypt.simpleEncode(theQuery.ranking.toExternalString()) + "&resource=local&time=3&recommendref=" + new String(result.hash()) + "&urlmaskfilter=.*");prop.put("content_authorized_urlhash", new String(result.hash()));String resulthashString = new String(result.hash());prop.putHTML("content_title", result.title());@@ -142,9 +140,9 @@ public class yacysearchitem {prop.putHTML("content_creator", result.creator());// authorprop.putHTML("content_subject", result.subject());final TreeSet<String>[] query = theQuery.queryWords();- try {- prop.putHTML("content_words", URLEncoder.encode(query[0].toString(),"UTF-8"));- } catch (final UnsupportedEncodingException e) {}+ String s = ""; for (String t: query[0]) s += "+" + t;+ if (s.length() > 0) s = s.substring(1);+ prop.putHTML("content_words", s);prop.putHTML("content_former", theQuery.queryString);final TextSnippet snippet = result.textSnippet();final String desc = (snippet == null) ? "" : snippet.getLineMarked(theQuery.fullqueryHashes);diff --git a/htroot/yacysearchtrailer.html b/htroot/yacysearchtrailer.htmlindex 8469fb9e3..ad4f04de3 100644--- a/htroot/yacysearchtrailer.html+++ b/htroot/yacysearchtrailer.html@@ -1,4 +1,13 @@<div style="float:right;width:25%;">++#(cat-location)#::+<div style="float: right; margin-top:5px; width: 220px;">+<div><a href="yacysearch_location.html?query=#[queryenc]#&display=#[display]#">+<img src="/env/grafics/earthsearch.png" width="48" heigth="34" alt="earthsearchlogo" /></a></div>+<div><a href="yacysearch_location.html?query=#[queryenc]#&display=#[display]#">Show search results for '"#[query]#"' on map!</a></div>+</div>+#(/cat-location)#+#(nav-domains)#::<div id="sidebar1" style="float: right; margin-top:5px; width: 220px;"><h3 style="padding-left:25px;">Domain Navigator</h3>@@ -44,10 +53,4 @@</div>#(/nav-about)#-#(cat-location)#::-<div id="sidebar4" style="float: right; margin-top:5px; width: 220px;">-<div><a href="yacysearch_location.html?query=#[query]#&display=#[display]#">-<img src="/env/grafics/earthsearch.png" width="48" heigth="34" alt="earthsearchlogo" /></a></div>-<div><a href="yacysearch_location.html?query=#[query]#&display=#[display]#">Show search results for "#[query]#" on map!</a></div>-</div>-#(/cat-location)#+</div>\ No newline at end of filediff --git a/htroot/yacysearchtrailer.java b/htroot/yacysearchtrailer.javaindex 9eaf862b5..8c81de2c6 100644--- a/htroot/yacysearchtrailer.java+++ b/htroot/yacysearchtrailer.java@@ -177,7 +177,8 @@ public class yacysearchtrailer {prop.put("cat-location", 0);} else {prop.put("cat-location", 1);- prop.put("cat-location_query", theQuery.queryString);+ prop.put("cat-location_query", theQuery.queryString(true));+ prop.put("cat-location_queryenc", theQuery.queryString(true).replace(' ', '+'));prop.put("cat-location_display", display);}diff --git a/source/de/anomic/search/QueryParams.java b/source/de/anomic/search/QueryParams.javaindex da7474a9d..1c1826ff3 100644--- a/source/de/anomic/search/QueryParams.java+++ b/source/de/anomic/search/QueryParams.java@@ -371,7 +371,7 @@ public final class QueryParams {public static String navurl(String ext, final int page, final int display, final QueryParams theQuery, final String originalUrlMask, String addToQuery, String nav) {return"/yacysearch." + ext + "?display=" + display +- "&search=" + theQuery.queryString(true) + ((addToQuery == null) ? "" : "+" + addToQuery) ++ "&query=" + theQuery.queryString(true).replace(' ', '+') + ((addToQuery == null) ? "" : "+" + addToQuery) +"&maximumRecords="+ theQuery.displayResults() +"&startRecord=" + (page * theQuery.displayResults()) +"&resource=" + ((theQuery.isLocal()) ? "local" : "global") +diff --git a/source/net/yacy/document/parser/xml/opensearchdescriptionReader.java b/source/net/yacy/document/parser/xml/opensearchdescriptionReader.javaindex c372200b1..c6cbade27 100644--- a/source/net/yacy/document/parser/xml/opensearchdescriptionReader.java+++ b/source/net/yacy/document/parser/xml/opensearchdescriptionReader.java@@ -77,7 +77,7 @@ public class opensearchdescriptionReader extends DefaultHandler {<InputEncoding>UTF-8</InputEncoding><AdultContent>true</AdultContent><Description>YaCy is an open-source GPL-licensed software that can be used for stand-alone search engine installations or as a client for a multi-user P2P-based web indexing cluster. This is the access to peer '#[clientname]#'.</Description>- <Url type="application/rss+xml" method="GET" template="http://#[thisaddress]#/yacysearch.rss?search={searchTerms}&Enter=Search" />+ <Url type="application/rss+xml" method="GET" template="http://#[thisaddress]#/yacysearch.rss?query={searchTerms}&Enter=Search" /><Developer>See http://developer.berlios.de/projects/yacy/</Developer><Query role="example" searchTerms="yacy" /><Tags>YaCy P2P Web Search</Tags>