Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
another fix for navigation results, the json result format and searches with yacyinteractive
orbiterb21e9149f50c
diff --git a/htroot/yacyinteractive.html b/htroot/yacyinteractive.htmlindex f73469bbe..09649f164 100644--- a/htroot/yacyinteractive.html+++ b/htroot/yacyinteractive.html@@ -19,7 +19,7 @@ function search(query) {else if (window.ActiveXObject) { // IEself.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");}- self.xmlHttpReq.open('GET', "yacysearch.json?verify=false&resource=local&maximumRecords=100&query=" + query, true);+ self.xmlHttpReq.open('GET', "yacysearch.json?verify=false&resource=local&maximumRecords=100&nav=topics&query=" + query, true);self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');self.xmlHttpReq.onreadystatechange = function() {if (self.xmlHttpReq.readyState == 4) {diff --git a/htroot/yacysearchtrailer.java b/htroot/yacysearchtrailer.javaindex d13cb07a8..87e0fd903 100644--- a/htroot/yacysearchtrailer.java+++ b/htroot/yacysearchtrailer.java@@ -39,7 +39,7 @@ import de.anomic.server.serverSwitch;public class yacysearchtrailer {- private static final int MAX_TOPWORDS = 24;+ private static final int MAX_TOPWORDS = 10;public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch<?> env) {final serverObjects prop = new serverObjects();@@ -59,7 +59,7 @@ public class yacysearchtrailer {// host navigatorsArrayList<NavigatorEntry> hostNavigator = theSearch.getHostNavigator(10);- if (hostNavigator == null) {+ if (hostNavigator == null || hostNavigator.size() == 0) {prop.put("nav-domains", 0);} else {prop.put("nav-domains", 1);@@ -79,37 +79,9 @@ public class yacysearchtrailer {prop.put("nav-domains_element", hostNavigator.size());}- // attach the bottom line with search references (topwords)- final ArrayList<NavigatorEntry> references = theSearch.getTopicNavigator(10);- // default settings for no topics- prop.put("nav-topics", "0");-- if (references.size() > 0) {- int i = 0;- NavigatorEntry e;- Iterator<NavigatorEntry> iter = references.iterator();- while (iter.hasNext()) {- e = iter.next();- if (/*(theQuery == null) ||*/ (theQuery.queryString == null)) break;- if (e != null && e.name != null) {- prop.putHTML("nav-topics_element_" + i + "_name", e.name);- prop.put("nav-topics_element_" + i + "_url", "<a href=\"" + plasmaSearchQuery.navurl("html", 0, display, theQuery, theQuery.urlMask, e.name, theQuery.navigators) + "\">" + e.name + " (" + e.count + ")</a>");- prop.putJSON("nav-topics_element_" + i + "_url-json", plasmaSearchQuery.navurl("json", 0, display, theQuery, theQuery.urlMask, e.name, theQuery.navigators));- prop.put("nav-topics_element_" + i + "_count", e.count);- prop.put("nav-topics_element_" + i + "_modifier", e.name);- prop.put("nav-topics_element_" + i + "_nl", (iter.hasNext() && i < MAX_TOPWORDS) ? 1 : 0);- }- if (i++ > MAX_TOPWORDS) {- break;- }- }- prop.put("nav-topics_element", i);- prop.put("nav-topics", "1");- }-// author navigatorsArrayList<NavigatorEntry> authorNavigator = theSearch.getAuthorNavigator(10);- if (authorNavigator == null) {+ if (authorNavigator == null || authorNavigator.size() == 0) {prop.put("nav-authors", 0);} else {prop.put("nav-authors", 1);@@ -131,6 +103,30 @@ public class yacysearchtrailer {prop.put("nav-authors_element", authorNavigator.size());}+ // attach always the topics+ ArrayList<NavigatorEntry> topicNavigator = theSearch.getTopicNavigator(10);+ if (topicNavigator == null) topicNavigator = new ArrayList<NavigatorEntry>();+ int i = 0;+ NavigatorEntry e;+ Iterator<NavigatorEntry> iter = topicNavigator.iterator();+ while (iter.hasNext()) {+ e = iter.next();+ if (/*(theQuery == null) ||*/ (theQuery.queryString == null)) break;+ if (e != null && e.name != null) {+ prop.putHTML("nav-topics_element_" + i + "_name", e.name);+ prop.put("nav-topics_element_" + i + "_url", "<a href=\"" + plasmaSearchQuery.navurl("html", 0, display, theQuery, theQuery.urlMask, e.name, theQuery.navigators) + "\">" + e.name + " (" + e.count + ")</a>");+ prop.putJSON("nav-topics_element_" + i + "_url-json", plasmaSearchQuery.navurl("json", 0, display, theQuery, theQuery.urlMask, e.name, theQuery.navigators));+ prop.put("nav-topics_element_" + i + "_count", e.count);+ prop.put("nav-topics_element_" + i + "_modifier", e.name);+ prop.put("nav-topics_element_" + i + "_nl", (iter.hasNext() && i < MAX_TOPWORDS) ? 1 : 0);+ }+ if (i++ > MAX_TOPWORDS) {+ break;+ }+ }+ prop.put("nav-topics_element", i);+ prop.put("nav-topics", "1");+serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(theQuery.id(true), plasmaSearchEvent.FINALIZATION + "-" + "bottomline", 0, 0), false);return prop;diff --git a/htroot/yacysearchtrailer.json b/htroot/yacysearchtrailer.jsonindex 618792a88..65f394d9f 100644--- a/htroot/yacysearchtrailer.json+++ b/htroot/yacysearchtrailer.json@@ -24,7 +24,7 @@{"name": "#[name]#", "count": "#[count]#", "modifier": "#[modifier]#", "url": "#[url-json]#"}#(nl)#::,#(/nl)##{/element}#]- }#(/nav-authors)##(nav-topics)#::+ },#(/nav-authors)##(nav-topics)#::{"facetname": "topics","displayname": "Topics",