Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
fixed/re-implemented rss-version of search result page
orbiter229ca2ba4856
diff --git a/htroot/yacysearch.html b/htroot/yacysearch.htmlindex 0db64aa7f..f4564f943 100644--- a/htroot/yacysearch.html+++ b/htroot/yacysearch.html@@ -106,11 +106,6 @@ document.getElementById("Enter").value = "search again - catch up more links";#(/num-results)#<!-- the search results -->-#(combine)#::-<p><strong>Topwords</strong>:-#{words}# <a href="yacysearch.html?search=#[newsearch]#&Enter=Search&count=#[count]#&offset=#[offset]#&resource=#[resource]#&time=#[time]#">#[word]#</a>#{/words}#-</p>-#(/combine)#<script type="text/javascript">var progressbar = new Progressbar(#[results]#, document.getElementById("results"));</script>@@ -118,7 +113,7 @@ var progressbar = new Progressbar(#[results]#, document.getElementById("results"<!-- linklist begin -->#(resultTable)#::<table width="100%"><tr class="TableHeader"><td width="30%">Media</td><td width="70%">URL</tr>#(/resultTable)##{results}#-<!--#include virtual="yacysearchitem.html?item=#[item]#&eventID=#[eventID]#" -->+<!--#include virtual="yacysearchitem.html?rss=false&item=#[item]#&eventID=#[eventID]#" -->#{/results}##(resultTable)#::</table>#(/resultTable)#<!-- linklist end -->diff --git a/htroot/yacysearch.java b/htroot/yacysearch.javaindex 291d827d3..108562b9a 100644--- a/htroot/yacysearch.java+++ b/htroot/yacysearch.java@@ -136,7 +136,6 @@ public class yacysearch {prop.put("input_contentdomCheckImage", 0);prop.put("input_contentdomCheckApp", 0);prop.put("excluded", 0);- prop.put("combine", 0);prop.put("results", "");prop.put("resultTable", 0);prop.put("num-results", (searchAllowed) ? 0 : 4);diff --git a/htroot/yacysearch.rss b/htroot/yacysearch.rssindex 87bb1eea3..990a800c6 100644--- a/htroot/yacysearch.rss+++ b/htroot/yacysearch.rss@@ -3,10 +3,7 @@<rss version="2.0"xmlns:yacyTopwords="http://www.yacy.net/yacy/topwords"xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/">- <!--- YACY P2P WEB SEARCH - Results- Hint: append the query-parameter "fetchSnippet=" to embed snippets- -->+ <!-- YaCy P2P Web Search - Results; http://yacy.net --><channel><title>YaCy P2P-Search for #[former]#</title><description>Search for #[former]#</description>@@ -20,26 +17,10 @@<opensearch:link rel="search" href="opensearchdescription.xml" type="application/opensearchdescription+xml"/><opensearch:Query role="request" searchTerms="#[former]#" />- #(type)#- #{results}#<item>- <title><![CDATA[#[description]#]]></title>- <link>#[url]#</link>- #(snippet)#::<description><![CDATA[#[text]#]]></description>#(/snippet)#- <pubDate>#[date]#</pubDate>- <guid>#[urlhash]#</guid>- </item>+ #{results}#+<!--#include virtual="yacysearchitem.html?rss=true&item=#[item]#&eventID=#[eventID]#" -->+ #{/results}#- #{/results}#<yacyTopwords:topwords>- #(combine)#- ::- #{words}#- <yacyTopwords:item>- <yacyTopwords:word>#[word]#</yacyTopwords:word>- </yacyTopwords:item>- #{/words}#- #(/combine)#- </yacyTopwords:topwords>- ::- #(/type)#+<!--#include virtual="yacysearchitem.html?rss=true&bottomline=true&eventID=#[eventID]#" --></channel></rss>\ No newline at end of filediff --git a/htroot/yacysearchitem.html b/htroot/yacysearchitem.htmlindex 53dfac709..2d2ed0781 100644--- a/htroot/yacysearchitem.html+++ b/htroot/yacysearchitem.html@@ -39,12 +39,31 @@<tr class="#(col)#TableCellLight::TableCellDark#(/col)#"><td>#[name]#</td><td><a href="#[href]#">#[hrefshort]#</a></tr>#{/items}##(/content)#+#(rss)#::+<item>+<title><![CDATA[#[title]#]]></title>+<link>#[link]#</link>+<description><![CDATA[#[description]#]]></description>+<pubDate>#[date]#</pubDate>+<guid>#[urlhash]#</guid>+</item>+#(/rss)##(references)#::<p><strong>Topwords</strong>:#{words}# <a href="yacysearch.html?search=#[newsearch]#&Enter=Search&count=#[count]#&offset=#[offset]#&resource=#[resource]#&time=#[time]#">#[word]#</a>#{/words}#</p>#(/references)#+#(rssreferences)#::+<yacyTopwords:topwords>+#{words}#+<yacyTopwords:item><yacyTopwords:word>#[word]#</yacyTopwords:word></yacyTopwords:item>+#{/words}#+</yacyTopwords:topwords>+#(/rssreferences)#+#(dynamic)#::<script type="text/javascript">statistics("#[offset]#", "#[items]#", "#[global]#", "#[total]#");progressbar.step(1);</script>+#(/dynamic)#+diff --git a/htroot/yacysearchitem.java b/htroot/yacysearchitem.javaindex e106c4513..9aa735462 100644--- a/htroot/yacysearchitem.java+++ b/htroot/yacysearchitem.java@@ -64,25 +64,39 @@ public class yacysearchitem {String eventID = post.get("eventID", "");boolean bottomline = post.get("bottomline", "false").equals("true");+ boolean rss = post.get("rss", "false").equals("true");boolean authenticated = sb.adminAuthenticated(header) >= 2;int item = post.getInt("item", -1);+ // default settings for blank item+ prop.put("content", 0);+ prop.put("rss", 0);+ prop.put("references", 0);+ prop.put("rssreferences", 0);+ prop.put("dynamic", 0);+// find search eventplasmaSearchEvent theSearch = plasmaSearchEvent.getEvent(eventID);+ if (theSearch == null) {+ // the event does not exist, show empty page+ return prop;+ }plasmaSearchQuery theQuery = theSearch.getQuery();plasmaSearchRankingProfile ranking = theSearch.getRanking();// dynamically update count values- prop.put("offset", theQuery.neededResults() - theQuery.displayResults() + 1);- prop.put("global", theSearch.getGlobalCount());- prop.put("total", theSearch.getGlobalCount() + theSearch.getLocalCount());- prop.put("items", (item < 0) ? theQuery.neededResults() : item + 1);+ if (!rss) {+ prop.put("dynamic_offset", theQuery.neededResults() - theQuery.displayResults() + 1);+ prop.put("dynamic_global", theSearch.getGlobalCount());+ prop.put("dynamic_total", theSearch.getGlobalCount() + theSearch.getLocalCount());+ prop.put("dynamic_items", (item < 0) ? theQuery.neededResults() : item + 1);+ prop.put("dynamic", 1);+ }if (bottomline) {// attach the bottom line with search references (topwords)final Set references = theSearch.references(20);if (references.size() > 0) {- prop.put("references", 1);// get the topwordsfinal TreeSet topwords = new TreeSet(kelondroNaturalOrder.naturalOrder);String tmp = "";@@ -107,46 +121,71 @@ public class yacysearchitem {}}- String word;- int hintcount = 0;- final Iterator iter = topwords.iterator();- while (iter.hasNext()) {- word = (String) iter.next();- if (word != null) {- prop.put("references_words_" + hintcount + "_word", word);- prop.put("references_words_" + hintcount + "_newsearch", theQuery.queryString.replace(' ', '+') + "+" + word);- prop.put("references_words_" + hintcount + "_count", theQuery.displayResults());- prop.put("references_words_" + hintcount + "_offset", 0);- prop.put("references_words_" + hintcount + "_resource", theQuery.searchdom());- prop.put("references_words_" + hintcount + "_time", (theQuery.maximumTime / 1000));+ if (rss) {+ String word;+ int hintcount = 0;+ final Iterator iter = topwords.iterator();+ while (iter.hasNext()) {+ word = (String) iter.next();+ if (word != null) {+ prop.put("rssreferences_words_" + hintcount + "_word", word);+ }+ prop.put("rssreferences_words", hintcount);+ if (hintcount++ > MAX_TOPWORDS) {+ break;+ }}- prop.put("references_words", hintcount);- if (hintcount++ > MAX_TOPWORDS) {- break;+ prop.put("rssreferences", 1);+ } else {+ String word;+ int hintcount = 0;+ final Iterator iter = topwords.iterator();+ while (iter.hasNext()) {+ word = (String) iter.next();+ if (word != null) {+ prop.put("references_words_" + hintcount + "_word", word);+ prop.put("references_words_" + hintcount + "_newsearch", theQuery.queryString.replace(' ', '+') + "+" + word);+ prop.put("references_words_" + hintcount + "_count", theQuery.displayResults());+ prop.put("references_words_" + hintcount + "_offset", 0);+ prop.put("references_words_" + hintcount + "_resource", theQuery.searchdom());+ prop.put("references_words_" + hintcount + "_time", (theQuery.maximumTime / 1000));+ }+ prop.put("references_words", hintcount);+ if (hintcount++ > MAX_TOPWORDS) {+ break;+ }}+ prop.put("references", 1);}- } else {- prop.put("references", 0);}return prop;}- // no bottomline- prop.put("references", 0);-// generate result objectplasmaSearchEvent.ResultEntry result = theSearch.oneResult(item);if (result == null) {- prop.put("content", 0); // no content+ // no contentreturn prop;}- prop.put("content", theQuery.contentdom + 1); // switch on specific content+ if (rss) {+ // text search for rss output+ prop.put("rss", 1); // switch on specific content+ prop.put("rss_title", result.title());+ prop.put("rss_description", result.textSnippet().getLineRaw());+ prop.put("rss_link", result.urlstring());+ prop.put("rss_urlhash", result.hash());+ prop.put("rss_date", plasmaSwitchboard.dateString(result.modified()));+ return prop;+ }++ prop.put("rss", 0);if (theQuery.contentdom == plasmaSearchQuery.CONTENTDOM_TEXT) {// text search+ prop.put("content", theQuery.contentdom + 1); // switch on specific contentprop.put("content_authorized", (authenticated) ? 1 : 0);prop.put("content_authorized_recommend", (yacyCore.newsPool.getSpecific(yacyNewsPool.OUTGOING_DB, yacyNewsPool.CATEGORY_SURFTIPP_ADD, "url", result.urlstring()) == null) ? 1 : 0);prop.put("content_authorized_recommend_deletelink", "/yacysearch.html?search=" + theQuery.queryString + "&Enter=Search&count=" + theQuery.displayResults() + "&offset=" + (theQuery.neededResults() - theQuery.displayResults()) + "&order=" + crypt.simpleEncode(ranking.toExternalString()) + "&resource=local&time=3&deleteref=" + result.hash() + "&urlmaskfilter=.*");@@ -182,11 +221,13 @@ public class yacysearchitem {(((wordURL = yacyURL.probablyWordURL(result.hash(), query[0])) != null) ? ", probablyWordURL=" + wordURL.toNormalform(false, true) : ""));prop.putASIS("content_snippet", result.textSnippet().getLineMarked(theQuery.queryHashes));+ return prop;}if (theQuery.contentdom == plasmaSearchQuery.CONTENTDOM_IMAGE) {// image search; shows thumbnails// iterate over all images in the result+ prop.put("content", theQuery.contentdom + 1); // switch on specific contentArrayList /* of plasmaSnippetCache.MediaSnippet */ images = result.mediaSnippets();if (images != null) {plasmaSnippetCache.MediaSnippet ms;@@ -205,12 +246,14 @@ public class yacysearchitem {} else {prop.put("content_items", 0);}+ return prop;}if ((theQuery.contentdom == plasmaSearchQuery.CONTENTDOM_AUDIO) ||(theQuery.contentdom == plasmaSearchQuery.CONTENTDOM_VIDEO) ||(theQuery.contentdom == plasmaSearchQuery.CONTENTDOM_APP)) {// any other media content+ prop.put("content", theQuery.contentdom + 1); // switch on specific contentArrayList /* of plasmaSnippetCache.MediaSnippet */ media = result.mediaSnippets();if (item == 0) col = true;if (media != null) {@@ -229,6 +272,7 @@ public class yacysearchitem {} else {prop.put("content_items", 0);}+ return prop;}return prop;