- fixes to query parameter

- replaced/removed search query attribute (was old style, new is 'query' according to SRU)

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6892 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 15 years ago
parent 6ec9ced4cd
commit 9842fab6e4

@ -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;
}

@ -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();

@ -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") +

@ -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());// author
prop.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);

@ -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>

@ -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);
}

@ -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") +

@ -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}&amp;Enter=Search" />
<Url type="application/rss+xml" method="GET" template="http://#[thisaddress]#/yacysearch.rss?query={searchTerms}&amp;Enter=Search" />
<Developer>See http://developer.berlios.de/projects/yacy/</Developer>
<Query role="example" searchTerms="yacy" />
<Tags>YaCy P2P Web Search</Tags>

Loading…
Cancel
Save