Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
- re-implemented image search - generalized search result status bar, is now also visible during text search
orbiter6c3bcadc1ce3
diff --git a/htroot/ViewFile.soap b/htroot/ViewFile.soapdeleted file mode 100644index 56789fc57..000000000--- a/htroot/ViewFile.soap+++ /dev/null@@ -1,36 +0,0 @@-<?xml version="1.0" encoding="UTF-8"?>-<yacyUrlInfo>- <!-- Resource metadata -->- <meta>- <url>#(error)##[url]#::#(/error)#</url>- <hash>#(error)##[hash]#::#(/error)#</hash>- <wordCount>#(error)##[wordCount]#::#(/error)#</wordCount>- <desc>#(error)##[desc]#::#(/error)#</desc>- <size>#(error)##[size]#::#(/error)#</size>- <mimeType>#(error)##[mimeType]#::#(/error)#</mimeType>- <statusCode>#(error)#0::1::2::3::4::5::6#(/error)#</statusCode>- <statusText>- #(error)#OK- ::No URL hash submitted- ::Unable to find URL Entry in DB- ::Invalid URL- ::Unable to download resource content: #[errorText]#- ::Unable to parse resource content: #[errorText]#- ::Unsupported protocol- #(/error)#- </statusText>- </meta>- <!-- resource body -->- <body mode="#(viewMode)#::1::2::3#(/viewMode)#">- #(viewMode)#- :: <!-- 1 -->- <![CDATA[#[plainText]#]]>- :: <!-- 2 -->- <![CDATA[#[parsedText]#]]>- :: <!-- 3 -->- #{sentences}#- <sentence nr="#[nr]#"><![CDATA[#[text]#]]></sentence>- #{/sentences}#- #(/viewMode)#- </body>-</yacyUrlInfo>\ No newline at end of filediff --git a/htroot/js/yacysearch.js b/htroot/js/yacysearch.jsindex b55c951a2..ce23eb5d4 100644--- a/htroot/js/yacysearch.js+++ b/htroot/js/yacysearch.js@@ -51,165 +51,6 @@ function Progressbar(length, parent) {parent.appendChild(this.element);}-function handleTextState(req) {- if(req.readyState != 4){- return;- }-- var response = req.responseXML;-- var snippetText = response.getElementsByTagName("text")[0].firstChild.data;- var urlHash = response.getElementsByTagName("urlHash")[0].firstChild.data;- var status = response.getElementsByTagName("status")[0].firstChild.data;--- var span = document.getElementById("h" + urlHash);- removeAllChildren(span);- //span.removeChild(span.firstChild);-- if (status < 11) {- span.className = "snippetLoaded";- } else {- span.className = "snippetError";- span.parentNode.parentNode.className = "searchresults hidden";- document.getElementById("hidden_results").innerHTML='Some results were hidden, because they do not contain your searchwords anymore, or because they are not accessible. Click here to <a href="javascript:show_hidden_results()">show them</a>';- }-- // set URL to favicon (if a link-tag was found in the document)- if (response.getElementsByTagName("favicon")[0].firstChild != null) {- var img = document.getElementById("f" + urlHash);- img.src = "ViewImage.png?width=16&height=16&url=" + response.getElementsByTagName("favicon")[0].firstChild.data;- }-- // replace "<b>" text by <strong> node- var pos1=snippetText.indexOf("<b>");- var pos2=snippetText.indexOf("</b>");- while (pos1 >= 0 && pos2 > pos1) {- leftString = document.createTextNode(snippetText.substring(0, pos1)); //other text- if (leftString != "") span.appendChild(leftString);-- //add the bold text- strongNode=document.createElement("strong");- middleString=document.createTextNode(snippetText.substring(pos1 + 3, pos2));- strongNode.appendChild(middleString);- span.appendChild(strongNode);-- // cut out left and middle and go on with remaining text- snippetText=snippetText.substring(pos2 + 4);- pos1=snippetText.indexOf("<b>");- pos2=snippetText.indexOf("</b>");- }-- // add remaining string- if (snippetText != "") {- span.appendChild(document.createTextNode(snippetText));- }-}--function handleMediaState(req, progressbar) {- if(req.readyState != 4){- return;- }-- var response = req.responseXML;- // On errors, the result might not contain what we look for...- if (response.getElementsByTagName("urlHash")) {- var urlHash = response.getElementsByTagName("urlHash")[0].firstChild.data;- var links = response.getElementsByTagName("links")[0].firstChild.data;- var container = document.getElementById("results");-- if (links > 0) {- for (i = 0; i < links; i++) {- var type = response.getElementsByTagName("type")[i].firstChild.data;- var href = response.getElementsByTagName("href")[i].firstChild.data;- var name = response.getElementsByTagName("name")[i].firstChild.data;- var attr = response.getElementsByTagName("attr")[i].firstChild.data;-- var link = document.createElement("a");- link.setAttribute("href", href);- link.setAttribute("target", "_parent");- link.appendChild(document.createTextNode(name));-- var title = document.createElement("h4");- title.className = "linktitle";- title.appendChild(link);-- var urllink = document.createElement("a");- urllink.setAttribute("href", href);- urllink.setAttribute("target", "_parent");- urllink.appendChild(document.createTextNode(href));-- var url = document.createElement("p");- url.className = "url";- url.appendChild(urllink);-- var searchresultcontainer = document.createElement("div");- searchresultcontainer.className = "searchresults";- searchresultcontainer.appendChild(title);- searchresultcontainer.appendChild(url);-- container.appendChild(searchresultcontainer);-- document.getElementById("linkcount").innerHTML++;- }- }- }- progressbar.step(1);-}--function handleImageState(req, progressbar) {- if(req.readyState != 4)- return;-- var response = req.responseXML;- // on errors, the result might not contain the expected elements and would throw an error, so we check for it here- if (response.getElementsByTagName("urlHash")) {- // the urlHash is not needed anymore at the moment- //var urlHash = response.getElementsByTagName("urlHash")[0].firstChild.data;- var links = response.getElementsByTagName("links")[0].firstChild.data;- var div = document.getElementById("results")-- if (links > 0) {- for (i = 0; i < links; i++) {- var type = response.getElementsByTagName("type")[i].firstChild.data;- var href = response.getElementsByTagName("href")[i].firstChild.data;- var code = response.getElementsByTagName("code")[i].firstChild.data;- var name = response.getElementsByTagName("name")[i].firstChild.data;- var attr = response.getElementsByTagName("attr")[i].firstChild.data;-- var img = document.createElement("img");- img.setAttribute("src", "/ViewImage.png?maxwidth=96&maxheight=96&code=" + code);- img.setAttribute("alt", name);-- var imganchor = document.createElement("a");- imganchor.setAttribute("href", href);- imganchor.className = "thumblink";- imganchor.appendChild(img);-- var nameanchor = document.createElement("a");- nameanchor.setAttribute("href", href);- nameanchor.appendChild(document.createTextNode(name));--- var textcontainer = document.createElement("div");- textcontainer.className = "TableCellDark";- textcontainer.appendChild(nameanchor);-- var thumbcontainer = document.createElement("div");- thumbcontainer.className = "thumbcontainer";- thumbcontainer.appendChild(imganchor);- thumbcontainer.appendChild(textcontainer);- div.appendChild(thumbcontainer);- //span.appendChild(imganchor);-- document.getElementById("linkcount").innerHTML++;- }- }- }- progressbar.step(1);-}--function addHover() {if (document.all&&document.getElementById) {var divs = document.getElementsByTagName("div");diff --git a/htroot/yacysearch.html b/htroot/yacysearch.htmlindex 2ebd6fb15..cac09fb49 100644--- a/htroot/yacysearch.html+++ b/htroot/yacysearch.html@@ -103,100 +103,27 @@ document.getElementById("Enter").value = "search again - catch up more links";::<p>No Results. "<strong>#[wrong_regex]#</strong>" is no valid regular expression. Please go back to the previous page and make sure to enter a valid regular expressions for URL mask and Prefer mask.</p>::- <p><strong id="offset">#[offset]#</strong>-<strong id="itemscount">#[linkcount]#</strong> results from a total number of <strong id="totalcount">#[totalcount]#</strong> known#(globalresults)#.::, <strong id="globalcount">#[globalcount]#</strong> links from other YaCy peers.#(/globalresults)#</p>+ <p><strong id="offset">#[offset]#</strong>-<strong id="itemscount">#[linkcount]#</strong> results from a total number of <strong id="totalcount">#[totalcount]#</strong> known#(globalresults)#.::, <strong id="globalcount">#[globalcount]#</strong> links from other YaCy peers.#(/globalresults)#<div id="results"></div></p><p>Search Result Pages: <span id="pagenav">#[pagenav]#</span></p>::<p>Searching the web with this peer is disabled for unauthorized users. Please <a href="Status.html?login=">log in</a> as administrator to use the search function</p>#(/num-results)#-<!-- view the result list -->-#(type)#- <!-- type 0: text search -->- #(combine)#- ::- <p><strong>Refine with</strong>:</p>- <p>- #{words}#- <a href="yacysearch.html?search=#[newsearch]#&Enter=Search&count=#[count]#&offset=#[offset]#&resource=#[resource]#&time=#[time]#">#[word]#</a>- #{/words}#- </p>- #(/combine)#- <!-- linklist begin -->- <div id="hidden_results"></div>- #{results}#- <!--#include virtual="yacysearchitem.html?item=#[item]#&eventID=#[eventID]#&display=#[display]#" -->- #{/results}#-- <!-- linklist end -->+<!-- the search results -->+#(combine)#::+<p><strong>Refine with</strong>:</p>+<p>#{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>- ::<!-- type 1: media search -->- <!-- non-js variant -->- <noscript>- <p>- Sorry, at the moment you need JavaScript in order to use this search. But here are the urls where YaCy would have looked for your searchresults. Perhaps you can find them there. Sorry for the inconvenience. If you want a non-JavaScript search, beg the developers for it.- </p>- <!-- linklist begin -->- <ul>- #{results}#- <!-- link begin -->- <li><a href="#[url]#">#[urlname]#</a></li>- <!-- link end -->- #{/results}#- </ul>- <!-- linklist end -->- </noscript>- <!-- linklist start-->- <div id="results">- </div>- <!-- linklist end-->- <script type="text/javascript">- var urls = "#{results}##[urlname]# #{/results}#".split(" ");- // the last element is always empty because the split gets a space at the end of the string- urls.length--;- if(urls.length > 0) {- AllMediaSnippets(urls, "#[former]#", "#[mediatype]#");- }- </script>-- ::<!-- type 2: image search: presents image thumbnails -->- <noscript>- <p>- Sorry, but in order to use the image search, you need JavaScript. But here are the urls where YaCy would have looked for the images you want. Perhaps you can find them there. Sorry for the inconvenience. If you want a non-JavaScript image search, beg the developers for it.- </p>- <ul>- #{results}#- <li><a href="#[url]#">#[urlname]#</a></li>- #{/results}#- </ul>- </noscript>- <!-- linklist start -->- <div id="results">- </div>- <!-- linklist end -->- <script type="text/javascript">- var urls = "#{results}##[urlname]# #{/results}#".split(" ");- // the last element is always empty because the split gets a space at the end of the string- urls.length--;- if(urls.length > 0) {- AllImageSnippets(urls, "#[former]#");- }- </script>- <br style="clear:left;" />-- ::<!-- type 3: image thumbnail list for one single url -->- <table border="0" cellspacing="16" cellpadding="0">- #{results}#- <tr valign="bottom">- #{line}#- <td>- <a href="#[url]#"><img src="/ViewImage.png?maxwidth=96&maxheight=96&url=#[url]#" /></a><br /><a href="#[url]#">#[name]#</a>- </td>- #{/line}#- </tr>- #{/results}#- </table>--#(/type)#+<!-- linklist begin -->+<div id="hidden_results"></div>+#{results}#+<!--#include virtual="yacysearchitem.html?item=#[item]#&eventID=#[eventID]#" -->+#{/results}#+<!-- linklist end --></body></html>diff --git a/htroot/yacysearch.java b/htroot/yacysearch.javaindex af4b8858f..18d314fb8 100644--- a/htroot/yacysearch.java+++ b/htroot/yacysearch.java@@ -52,7 +52,6 @@ import java.util.HashMap;import java.util.Iterator;import java.util.TreeSet;-import de.anomic.htmlFilter.htmlFilterImageEntry;import de.anomic.http.httpHeader;import de.anomic.index.indexURLEntry;import de.anomic.kelondro.kelondroBitfield;@@ -61,7 +60,6 @@ import de.anomic.kelondro.kelondroNaturalOrder;import de.anomic.plasma.plasmaCondenser;import de.anomic.plasma.plasmaParserDocument;import de.anomic.plasma.plasmaSearchEvent;-import de.anomic.plasma.plasmaSearchImages;import de.anomic.plasma.plasmaSearchQuery;import de.anomic.plasma.plasmaSearchRankingProfile;import de.anomic.plasma.plasmaSearchProcessing;@@ -141,10 +139,9 @@ public class yacysearch {prop.put("input_contentdomCheckVideo", 0);prop.put("input_contentdomCheckImage", 0);prop.put("input_contentdomCheckApp", 0);- prop.put("type", 0);- prop.put("type_excluded", 0);- prop.put("type_combine", 0);- prop.put("type_results", "");+ prop.put("excluded", 0);+ prop.put("combine", 0);+ prop.put("results", "");prop.put("num-results", (searchAllowed) ? 0 : 6);return prop;@@ -193,70 +190,70 @@ public class yacysearch {int contentdomCode = plasmaSearchQuery.contentdomParser(post.get("contentdom", "text"));// patch until better search profiles are available- if ((contentdomCode != plasmaSearchQuery.CONTENTDOM_TEXT) && (count <= 10)) count = 30;+ if ((contentdomCode != plasmaSearchQuery.CONTENTDOM_TEXT) && (count <= 30)) count = 30;serverObjects prop = new serverObjects();if (post.get("cat", "href").equals("href")) {- final TreeSet[] query = plasmaSearchQuery.cleanQuery(querystring); // converts also umlaute- // filter out stopwords- final TreeSet filtered = kelondroMSetTools.joinConstructive(query[0], plasmaSwitchboard.stopwords);- if (filtered.size() > 0) {- kelondroMSetTools.excludeDestructive(query[0], plasmaSwitchboard.stopwords);- }-- // if a minus-button was hit, remove a special reference first- if (post.containsKey("deleteref")) {- if (!sb.verifyAuthentication(header, true)) {- prop.put("AUTHENTICATE", "admin log-in"); // force log-in- return prop;+ final TreeSet[] query = plasmaSearchQuery.cleanQuery(querystring); // converts also umlaute+ // filter out stopwords+ final TreeSet filtered = kelondroMSetTools.joinConstructive(query[0], plasmaSwitchboard.stopwords);+ if (filtered.size() > 0) {+ kelondroMSetTools.excludeDestructive(query[0], plasmaSwitchboard.stopwords);}-- // delete the index entry locally- final String delHash = post.get("deleteref", ""); // urlhash- sb.wordIndex.removeWordReferences(query[0], delHash);- // make new news message with negative voting- HashMap map = new HashMap();- map.put("urlhash", delHash);- map.put("vote", "negative");- map.put("refid", "");- yacyCore.newsPool.publishMyNews(yacyNewsRecord.newRecord(yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, map));- }-- // if a plus-button was hit, create new voting message- if (post.containsKey("recommendref")) {- if (!sb.verifyAuthentication(header, true)) {- prop.put("AUTHENTICATE", "admin log-in"); // force log-in- return prop;+ // if a minus-button was hit, remove a special reference first+ if (post.containsKey("deleteref")) {+ if (!sb.verifyAuthentication(header, true)) {+ prop.put("AUTHENTICATE", "admin log-in"); // force log-in+ return prop;+ }++ // delete the index entry locally+ final String delHash = post.get("deleteref", ""); // urlhash+ sb.wordIndex.removeWordReferences(query[0], delHash);++ // make new news message with negative voting+ HashMap map = new HashMap();+ map.put("urlhash", delHash);+ map.put("vote", "negative");+ map.put("refid", "");+ yacyCore.newsPool.publishMyNews(yacyNewsRecord.newRecord(yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, map));}- final String recommendHash = post.get("recommendref", ""); // urlhash- indexURLEntry urlentry = sb.wordIndex.loadedURL.load(recommendHash, null);- if (urlentry != null) {- indexURLEntry.Components comp = urlentry.comp();- plasmaParserDocument document;- document = plasmaSnippetCache.retrieveDocument(comp.url(), true, 5000, true);- if (document != null) {- // create a news message- HashMap map = new HashMap();- map.put("url", comp.url().toNormalform(false, true).replace(',', '|'));- map.put("title", comp.title().replace(',', ' '));- map.put("description", ((document == null) ? comp.title() : document.getTitle()).replace(',', ' '));- map.put("author", ((document == null) ? "" : document.getAuthor()));- map.put("tags", ((document == null) ? "" : document.getKeywords(' ')));- yacyCore.newsPool.publishMyNews(yacyNewsRecord.newRecord(yacyNewsPool.CATEGORY_SURFTIPP_ADD, map));- document.close();++ // if a plus-button was hit, create new voting message+ if (post.containsKey("recommendref")) {+ if (!sb.verifyAuthentication(header, true)) {+ prop.put("AUTHENTICATE", "admin log-in"); // force log-in+ return prop;+ }+ final String recommendHash = post.get("recommendref", ""); // urlhash+ indexURLEntry urlentry = sb.wordIndex.loadedURL.load(recommendHash, null);+ if (urlentry != null) {+ indexURLEntry.Components comp = urlentry.comp();+ plasmaParserDocument document;+ document = plasmaSnippetCache.retrieveDocument(comp.url(), true, 5000, true);+ if (document != null) {+ // create a news message+ HashMap map = new HashMap();+ map.put("url", comp.url().toNormalform(false, true).replace(',', '|'));+ map.put("title", comp.title().replace(',', ' '));+ map.put("description", ((document == null) ? comp.title() : document.getTitle()).replace(',', ' '));+ map.put("author", ((document == null) ? "" : document.getAuthor()));+ map.put("tags", ((document == null) ? "" : document.getKeywords(' ')));+ yacyCore.newsPool.publishMyNews(yacyNewsRecord.newRecord(yacyNewsPool.CATEGORY_SURFTIPP_ADD, map));+ document.close();+ }}}- }- // prepare search properties- final boolean yacyonline = ((yacyCore.seedDB != null) && (yacyCore.seedDB.mySeed != null) && (yacyCore.seedDB.mySeed.getPublicAddress() != null));- final boolean globalsearch = (global) && (yacyonline);+ // prepare search properties+ final boolean yacyonline = ((yacyCore.seedDB != null) && (yacyCore.seedDB.mySeed != null) && (yacyCore.seedDB.mySeed.getPublicAddress() != null));+ final boolean globalsearch = (global) && (yacyonline);- // do the search- TreeSet queryHashes = plasmaCondenser.words2hashes(query[0]);- plasmaSearchQuery theQuery = new plasmaSearchQuery(+ // do the search+ TreeSet queryHashes = plasmaCondenser.words2hashes(query[0]);+ plasmaSearchQuery theQuery = new plasmaSearchQuery(querystring,queryHashes,plasmaCondenser.words2hashes(query[1]),@@ -273,95 +270,94 @@ public class yacysearch {"",20,constraint);- plasmaSearchRankingProfile ranking = (sb.getConfig("rankingProfile", "").length() == 0) ? new plasmaSearchRankingProfile(contentdomCode) : new plasmaSearchRankingProfile("", crypt.simpleDecode(sb.getConfig("rankingProfile", ""), null));- plasmaSearchProcessing localTiming = new plasmaSearchProcessing(4 * theQuery.maximumTime / 10, theQuery.displayResults());+ plasmaSearchRankingProfile ranking = (sb.getConfig("rankingProfile", "").length() == 0) ? new plasmaSearchRankingProfile(contentdomCode) : new plasmaSearchRankingProfile("", crypt.simpleDecode(sb.getConfig("rankingProfile", ""), null));+ plasmaSearchProcessing localTiming = new plasmaSearchProcessing(4 * theQuery.maximumTime / 10, theQuery.displayResults());- String client = (String) header.get("CLIENTIP"); // the search client who initiated the search+ String client = (String) header.get("CLIENTIP"); // the search client who initiated the search- // tell all threads to do nothing for a specific time- sb.intermissionAllThreads(2 * theQuery.maximumTime);+ // tell all threads to do nothing for a specific time+ sb.intermissionAllThreads(2 * theQuery.maximumTime);- // filter out words that appear in bluelist- theQuery.filterOut(plasmaSwitchboard.blueList);+ // filter out words that appear in bluelist+ theQuery.filterOut(plasmaSwitchboard.blueList);- // log- serverLog.logInfo("LOCAL_SEARCH", "INIT WORD SEARCH: " + theQuery.queryString + ":" + theQuery.queryHashes + " - " + theQuery.neededResults() + " links to be computed, " + theQuery.displayResults() + " lines to be displayed, " + (theQuery.maximumTime / 1000) + " seconds");- long timestamp = System.currentTimeMillis();-- // create a new search event- String wrongregex = null;- if (plasmaSearchEvent.getEvent(theQuery.id()) == null) {- theQuery.setOffset(0); // in case that this is a new search, always start without a offset- offset = 0;- }- plasmaSearchEvent theSearch = plasmaSearchEvent.getEvent(theQuery, ranking, localTiming, sb.wordIndex, (sb.isRobinsonMode()) ? sb.clusterhashes : null, false, null);+ // log+ serverLog.logInfo("LOCAL_SEARCH", "INIT WORD SEARCH: " + theQuery.queryString + ":" + theQuery.queryHashes + " - " + theQuery.neededResults() + " links to be computed, " + theQuery.displayResults() + " lines to be displayed, " + (theQuery.maximumTime / 1000) + " seconds");+ long timestamp = System.currentTimeMillis();++ // create a new search event+ String wrongregex = null;+ if (plasmaSearchEvent.getEvent(theQuery.id()) == null) {+ theQuery.setOffset(0); // in case that this is a new search, always start without a offset+ offset = 0;+ }+ plasmaSearchEvent theSearch = plasmaSearchEvent.getEvent(theQuery, ranking, localTiming, sb.wordIndex, (sb.isRobinsonMode()) ? sb.clusterhashes : null, false, null);- // generate result object- serverLog.logFine("LOCAL_SEARCH", "SEARCH TIME AFTER ORDERING OF SEARCH RESULTS: " + ((System.currentTimeMillis() - timestamp) / 1000) + " seconds");- serverLog.logFine("LOCAL_SEARCH", "SEARCH TIME AFTER RESULT PREPARATION: " + ((System.currentTimeMillis() - timestamp) / 1000) + " seconds");+ // generate result object+ serverLog.logFine("LOCAL_SEARCH", "SEARCH TIME AFTER ORDERING OF SEARCH RESULTS: " + ((System.currentTimeMillis() - timestamp) / 1000) + " seconds");+ serverLog.logFine("LOCAL_SEARCH", "SEARCH TIME AFTER RESULT PREPARATION: " + ((System.currentTimeMillis() - timestamp) / 1000) + " seconds");- // calc some more cross-reference- long remainingTime = theQuery.maximumTime - (System.currentTimeMillis() - timestamp);- if (remainingTime < 0) remainingTime = 1000;- serverLog.logFine("LOCAL_SEARCH", "SEARCH TIME AFTER XREF PREPARATION: " + ((System.currentTimeMillis() - timestamp) / 1000) + " seconds");+ // calc some more cross-reference+ long remainingTime = theQuery.maximumTime - (System.currentTimeMillis() - timestamp);+ if (remainingTime < 0) remainingTime = 1000;+ serverLog.logFine("LOCAL_SEARCH", "SEARCH TIME AFTER XREF PREPARATION: " + ((System.currentTimeMillis() - timestamp) / 1000) + " seconds");- // log- serverLog.logInfo("LOCAL_SEARCH", "EXIT WORD SEARCH: " + theQuery.queryString + " - " ++ // log+ serverLog.logInfo("LOCAL_SEARCH", "EXIT WORD SEARCH: " + theQuery.queryString + " - " +(theSearch.getLocalCount() + theSearch.getGlobalCount()) + " links found, " +((System.currentTimeMillis() - timestamp) / 1000) + " seconds");- // prepare search statistics- Long trackerHandle = new Long(System.currentTimeMillis());- HashMap searchProfile = theQuery.resultProfile(theSearch.getLocalCount() + theSearch.getGlobalCount(), System.currentTimeMillis() - timestamp);- searchProfile.put("querystring", theQuery.queryString);- searchProfile.put("time", trackerHandle);- searchProfile.put("host", client);- searchProfile.put("offset", new Integer(0));- sb.localSearches.add(searchProfile);- TreeSet handles = (TreeSet) sb.localSearchTracker.get(client);- if (handles == null) handles = new TreeSet();- handles.add(trackerHandle);- sb.localSearchTracker.put(client, handles);+ // prepare search statistics+ Long trackerHandle = new Long(System.currentTimeMillis());+ HashMap searchProfile = theQuery.resultProfile(theSearch.getLocalCount() + theSearch.getGlobalCount(), System.currentTimeMillis() - timestamp);+ searchProfile.put("querystring", theQuery.queryString);+ searchProfile.put("time", trackerHandle);+ searchProfile.put("host", client);+ searchProfile.put("offset", new Integer(0));+ sb.localSearches.add(searchProfile);+ TreeSet handles = (TreeSet) sb.localSearchTracker.get(client);+ if (handles == null) handles = new TreeSet();+ handles.add(trackerHandle);+ sb.localSearchTracker.put(client, handles);- prop = new serverObjects();- prop.put("num-results_totalcount", theSearch.getLocalCount() + theSearch.getGlobalCount());- prop.put("num-results_globalresults", 1);- prop.put("num-results_globalresults_globalcount", theSearch.getGlobalCount());- prop.put("num-results_offset", 0);- prop.put("num-results_linkcount", 0);-- // compose page navigation- StringBuffer pagenav = new StringBuffer();- int thispage = offset / theQuery.displayResults();- if (thispage == 0) pagenav.append("< "); else {- pagenav.append(navurla(thispage - 1, display, theQuery));- pagenav.append("<strong><</strong></a> ");- }- int numberofpages = Math.min(10, Math.min(thispage + 2, (theSearch.getGlobalCount() + theSearch.getLocalCount()) / theQuery.displayResults()));- for (int i = 0; i < numberofpages; i++) {- if (i == thispage) {- pagenav.append("<strong>");- pagenav.append(i + 1);- pagenav.append("</strong> ");- } else {- pagenav.append(navurla(i, display, theQuery));- pagenav.append(i + 1);- pagenav.append("</a> ");+ prop = new serverObjects();+ prop.put("num-results_totalcount", theSearch.getLocalCount() + theSearch.getGlobalCount());+ prop.put("num-results_globalresults", 1);+ prop.put("num-results_globalresults_globalcount", theSearch.getGlobalCount());+ prop.put("num-results_offset", 0);+ prop.put("num-results_linkcount", 0);++ // compose page navigation+ StringBuffer pagenav = new StringBuffer();+ int thispage = offset / theQuery.displayResults();+ if (thispage == 0) pagenav.append("< "); else {+ pagenav.append(navurla(thispage - 1, display, theQuery));+ pagenav.append("<strong><</strong></a> ");}- }- if (thispage >= numberofpages) pagenav.append(">"); else {- pagenav.append(navurla(thispage + 1, display, theQuery));- pagenav.append("<strong>></strong></a>");- }- prop.putASIS("num-results_pagenav", pagenav.toString());+ int numberofpages = Math.min(10, Math.min(thispage + 2, (theSearch.getGlobalCount() + theSearch.getLocalCount()) / theQuery.displayResults()));+ for (int i = 0; i < numberofpages; i++) {+ if (i == thispage) {+ pagenav.append("<strong>");+ pagenav.append(i + 1);+ pagenav.append("</strong> ");+ } else {+ pagenav.append(navurla(i, display, theQuery));+ pagenav.append(i + 1);+ pagenav.append("</a> ");+ }+ }+ if (thispage >= numberofpages) pagenav.append(">"); else {+ pagenav.append(navurla(thispage + 1, display, theQuery));+ pagenav.append("<strong>></strong></a>");+ }+ prop.putASIS("num-results_pagenav", pagenav.toString());- // generate the search result lines; they will be produced by another servlet- for (int i = 0; i < theQuery.displayResults(); i++) {- prop.put("type_results_" + i + "_item", offset + i);- prop.put("type_results_" + i + "_eventID", theQuery.id());- prop.put("type_results_" + i + "_display", display);- }- prop.put("type_results", theQuery.displayResults());+ // generate the search result lines; they will be produced by another servlet+ for (int i = 0; i < theQuery.displayResults(); i++) {+ prop.put("results_" + i + "_item", offset + i);+ prop.put("results_" + i + "_eventID", theQuery.id());+ }+ prop.put("results", theQuery.displayResults());// process result of searchif (filtered.size() > 0) {@@ -384,7 +380,7 @@ public class yacysearch {prop.put("num-results", 5);int hintcount = references.length;if (hintcount > 0) {- prop.put("type_combine", 1);+ prop.put("combine", 1);// get the topwordsfinal TreeSet topwords = new TreeSet(kelondroNaturalOrder.naturalOrder);String tmp = "";@@ -414,14 +410,14 @@ public class yacysearch {while (iter.hasNext()) {word = (String) iter.next();if (word != null) {- prop.put("type_combine_words_" + hintcount + "_word", word);- prop.put("type_combine_words_" + hintcount + "_newsearch", post.get("search", "").replace(' ', '+') + "+" + word);- prop.put("type_combine_words_" + hintcount + "_count", count);- prop.put("type_combine_words_" + hintcount + "_offset", offset);- prop.put("type_combine_words_" + hintcount + "_resource", ((global) ? "global" : "local"));- prop.put("type_combine_words_" + hintcount + "_time", (searchtime / 1000));+ prop.put("combine_words_" + hintcount + "_word", word);+ prop.put("combine_words_" + hintcount + "_newsearch", post.get("search", "").replace(' ', '+') + "+" + word);+ prop.put("combine_words_" + hintcount + "_count", count);+ prop.put("combine_words_" + hintcount + "_offset", offset);+ prop.put("combine_words_" + hintcount + "_resource", ((global) ? "global" : "local"));+ prop.put("combine_words_" + hintcount + "_time", (searchtime / 1000));}- prop.put("type_combine_words", hintcount);+ prop.put("combine_words", hintcount);if (hintcount++ > MAX_TOPWORDS) {break;}@@ -437,55 +433,14 @@ public class yacysearch {}}- prop.put("type", (theQuery.contentdom == plasmaSearchQuery.CONTENTDOM_TEXT) ? 0 : ((theQuery.contentdom == plasmaSearchQuery.CONTENTDOM_IMAGE) ? 2 : 1));- if (prop.getInt("type", 0) == 1) prop.put("type_mediatype", post.get("contentdom", "text"));prop.put("input_cat", "href");prop.put("input_depth", "0");- prop.put("type_eventID", theQuery.id());// adding some additional properties needed for the rss feedString hostName = (String) header.get("Host", "localhost");if (hostName.indexOf(":") == -1) hostName += ":" + serverCore.getPortNr(env.getConfig("port", "8080"));prop.put("rssYacyImageURL", "http://" + hostName + "/env/grafics/yacy.gif");}-- if (post.get("cat", "href").equals("image")) {-- int depth = post.getInt("depth", 0);- int columns = post.getInt("columns", 6);- yacyURL url = null;- try {url = new yacyURL(post.get("url", ""), null);} catch (MalformedURLException e) {}- plasmaSearchImages si = new plasmaSearchImages(6000, url, depth);- Iterator i = si.entries();- htmlFilterImageEntry ie;- int line = 0;- while (i.hasNext()) {- int col = 0;- for (col = 0; col < columns; col++) {- if (!i.hasNext()) break;- ie = (htmlFilterImageEntry) i.next();- String urls = ie.url().toString();- String name = "";- int p = urls.lastIndexOf('/');- if (p > 0) name = urls.substring(p + 1);- prop.put("type_results_" + line + "_line_" + col + "_url", urls);- prop.put("type_results_" + line + "_line_" + col + "_name", name);- }- prop.put("type_results_" + line + "_line", col);- line++;- }- prop.put("type_results", line);-- prop.put("type", 3); // set type of result: image list- prop.put("input_cat", "href");- prop.put("input_depth", depth);- }-- // if user is not authenticated, he may not vote for URLs- int linkcount = Integer.parseInt(prop.get("num-results_linkcount", "0"));- for (int i=0; i<linkcount; i++) {- prop.put("type_results_" + i + "_authorized", (authenticated) ? 1 : 0);- }prop.put("searchagain", (global) ? 1 : 0);prop.put("input", input);@@ -509,7 +464,6 @@ public class yacysearch {prop.put("input_contentdomCheckVideo", (contentdomCode == plasmaSearchQuery.CONTENTDOM_VIDEO) ? 1 : 0);prop.put("input_contentdomCheckImage", (contentdomCode == plasmaSearchQuery.CONTENTDOM_IMAGE) ? 1 : 0);prop.put("input_contentdomCheckApp", (contentdomCode == plasmaSearchQuery.CONTENTDOM_APP) ? 1 : 0);- prop.put("type_former", post.get("search", "")); //the query-string used to get the snippets// return rewrite propertiesreturn prop;diff --git a/htroot/yacysearch.soap b/htroot/yacysearch.soapdeleted file mode 100644index b01c98ef6..000000000--- a/htroot/yacysearch.soap+++ /dev/null@@ -1,37 +0,0 @@-<?xml version="1.0" encoding="UTF-8"?>-<yacySearch>- <yacySearchResult>- <title>Search for #[former]#</title>- <description>Search for #[former]#</description>-- #(type)#- <totalResultCount>#(num-results)#::::::::#[totalcount]##(/num-results)#</totalResultCount>- <currentResultCount>#(num-results)#::::::::#[linkcount]##(/num-results)#</currentResultCount>-- <!-- StopWords -->- <stopWords>#(excluded)#::#[stopwords]##(/excluded)#</stopWords>-- <!-- YaCy Top-Worts -->- <topWords>- #(combine)#::- #{words}#<word query="#[newsearch]#">#[word]#</word>#{/words}#- #(/combine)#- </topWords>-- <!-- Search Results -->- #{results}#- <yacySearchResultItem>- <description>#[description]#</description>- <link>#[url]#</link>- <hash>#[urlhash]#</hash>- <linkName>#[urlname]#</linkName>- <pubDate>#[date]#</pubDate>- <size>#[size]#</size>- <ranking>YBR-#[ybr]#</ranking>- <snippet>#(snippet)#::<![CDATA[#[text]#]]>#(/snippet)#</snippet>- </yacySearchResultItem>- #{/results}#- ::- #(/type)#- </yacySearchResult>-</yacySearch>diff --git a/htroot/yacysearchitem.html b/htroot/yacysearchitem.htmlindex d67474229..ad30d188a 100644--- a/htroot/yacysearchitem.html+++ b/htroot/yacysearchitem.html@@ -15,12 +15,19 @@#(/recommend)#</div>#(/authorized)#-<p class="snippet"><span class="snippetLoaded" id="h#[urlhash]#">#[snippet]#</span></p><p class="url"><a href="#[url]#" id="url#[urlhash]#" target="_parent">#[urlname]#</a></p><p class="urlinfo">#[date]# | YBR-#[ybr]# | <a href="ViewFile.html?urlHash=#[urlhash]#&words=#[words]#">Info</a> | <a href="yacysearch.html?cat=image&url=#[url]#&search=#[former]#">Pictures</a></p></div>+ ::+ #{images}#+ <div class="thumbcontainer">+ <a href="#[href]#" class="thumblink"><img src="/ViewImage.png?maxwidth=96&maxheight=96&code=#[code]#" alt="#[name]#"></a>+ <div class="TableCellDark"><a href="#[href]#">#[name]#</a></div>+ </div>+ #{/images}##(/content)#<script type="text/javascript">statistics("#[offset]#", "#[items]#", "#[global]#", "#[total]#");+progressbar.step(1);</script>diff --git a/htroot/yacysearchitem.java b/htroot/yacysearchitem.javaindex ac9447dc8..93c702075 100644--- a/htroot/yacysearchitem.java+++ b/htroot/yacysearchitem.java@@ -27,6 +27,7 @@import java.io.UnsupportedEncodingException;import java.net.MalformedURLException;import java.net.URLEncoder;+import java.util.ArrayList;import java.util.TreeSet;import de.anomic.http.httpHeader;@@ -34,6 +35,7 @@ import de.anomic.plasma.plasmaSearchEvent;import de.anomic.plasma.plasmaSearchPreOrder;import de.anomic.plasma.plasmaSearchQuery;import de.anomic.plasma.plasmaSearchRankingProfile;+import de.anomic.plasma.plasmaSnippetCache;import de.anomic.plasma.plasmaSwitchboard;import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;@@ -53,7 +55,6 @@ public class yacysearchitem {String eventID = post.get("eventID", "");int item = post.getInt("item", -1);- //int display = post.getInt("display", 0);boolean authenticated = sb.adminAuthenticated(header) >= 2;// find search event@@ -75,42 +76,69 @@ public class yacysearchitem {return prop;}- prop.put("content", 1); // switch on content- prop.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=.*");- prop.put("content_authorized_recommend_recommendlink", "/yacysearch.html?search=" + theQuery.queryString + "&Enter=Search&count=" + theQuery.displayResults() + "&offset=" + (theQuery.neededResults() - theQuery.displayResults()) + "&order=" + crypt.simpleEncode(ranking.toExternalString()) + "&resource=local&time=3&recommendref=" + result.hash() + "&urlmaskfilter=.*");- prop.put("content_authorized_urlhash", result.hash());- prop.put("content_description", result.title());- prop.put("content_url", result.urlstring());+ prop.put("content", theQuery.contentdom + 1); // switch on specific content- int port=result.url().getPort();- yacyURL faviconURL;- try {- faviconURL = new yacyURL(result.url().getProtocol() + "://" + result.url().getHost() + ((port != -1) ? (":" + String.valueOf(port)) : "") + "/favicon.ico", null);- } catch (MalformedURLException e1) {- faviconURL = null;- }+ if (theQuery.contentdom == plasmaSearchQuery.CONTENTDOM_TEXT) {+ // text search+ prop.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=.*");+ prop.put("content_authorized_recommend_recommendlink", "/yacysearch.html?search=" + theQuery.queryString + "&Enter=Search&count=" + theQuery.displayResults() + "&offset=" + (theQuery.neededResults() - theQuery.displayResults()) + "&order=" + crypt.simpleEncode(ranking.toExternalString()) + "&resource=local&time=3&recommendref=" + result.hash() + "&urlmaskfilter=.*");+ prop.put("content_authorized_urlhash", result.hash());+ prop.put("content_description", result.title());+ prop.put("content_url", result.urlstring());++ int port=result.url().getPort();+ yacyURL faviconURL;+ try {+ faviconURL = new yacyURL(result.url().getProtocol() + "://" + result.url().getHost() + ((port != -1) ? (":" + String.valueOf(port)) : "") + "/favicon.ico", null);+ } catch (MalformedURLException e1) {+ faviconURL = null;+ }- prop.put("content_faviconCode", sb.licensedURLs.aquireLicense(faviconURL)); // aquire license for favicon url loading- prop.put("content_urlhash", result.hash());- prop.put("content_urlhexhash", yacySeed.b64Hash2hexHash(result.hash()));- prop.put("content_urlname", nxTools.shortenURLString(result.urlname(), 120));- prop.put("content_date", plasmaSwitchboard.dateString(result.modified()));- prop.put("content_ybr", plasmaSearchPreOrder.ybr(result.hash()));- prop.put("content_size", Long.toString(result.filesize()));+ prop.put("content_faviconCode", sb.licensedURLs.aquireLicense(faviconURL)); // aquire license for favicon url loading+ prop.put("content_urlhash", result.hash());+ prop.put("content_urlhexhash", yacySeed.b64Hash2hexHash(result.hash()));+ prop.put("content_urlname", nxTools.shortenURLString(result.urlname(), 120));+ prop.put("content_date", plasmaSwitchboard.dateString(result.modified()));+ prop.put("content_ybr", plasmaSearchPreOrder.ybr(result.hash()));+ prop.put("content_size", Long.toString(result.filesize()));- TreeSet[] query = theQuery.queryWords();- yacyURL wordURL = null;- try {- prop.put("content_words", URLEncoder.encode(query[0].toString(),"UTF-8"));- } catch (UnsupportedEncodingException e) {}- prop.put("content_former", theQuery.queryString);- prop.put("content_rankingprops", result.word().toPropertyForm() + ", domLengthEstimated=" + yacyURL.domLengthEstimation(result.hash()) ++ TreeSet[] query = theQuery.queryWords();+ yacyURL wordURL = null;+ try {+ prop.put("content_words", URLEncoder.encode(query[0].toString(),"UTF-8"));+ } catch (UnsupportedEncodingException e) {}+ prop.put("content_former", theQuery.queryString);+ prop.put("content_rankingprops", result.word().toPropertyForm() + ", domLengthEstimated=" + yacyURL.domLengthEstimation(result.hash()) +((yacyURL.probablyRootURL(result.hash())) ? ", probablyRootURL" : "") +(((wordURL = yacyURL.probablyWordURL(result.hash(), query[0])) != null) ? ", probablyWordURL=" + wordURL.toNormalform(false, true) : ""));- prop.putASIS("content_snippet", result.textSnippet().getLineMarked(theQuery.queryHashes));+ prop.putASIS("content_snippet", result.textSnippet().getLineMarked(theQuery.queryHashes));+ }++ if (theQuery.contentdom == plasmaSearchQuery.CONTENTDOM_IMAGE) {+ // image search; shows thumbnails+ // iterate over all images in the result+ ArrayList /* of plasmaSnippetCache.MediaSnippet */ images = result.mediaSnippets();+ if (images != null) {+ plasmaSnippetCache.MediaSnippet ms;+ yacyURL url;+ int c = 0;+ for (int i = 0; i < images.size(); i++) {+ ms = (plasmaSnippetCache.MediaSnippet) images.get(i);+ try {url = new yacyURL(ms.href, null);} catch (MalformedURLException e) {continue;}+ prop.put("content_images_" + i + "_href", ms.href);+ prop.put("content_images_" + i + "_code", sb.licensedURLs.aquireLicense(url));+ prop.put("content_images_" + i + "_name", ms.name);+ prop.put("content_images_" + i + "_attr", ms.attr); // attributes, here: original size of image+ c++;+ }+ prop.put("content_images", c);+ } else {+ prop.put("content_images", 0);+ }+ }return prop;}