diff --git a/htroot/yacysearch.java b/htroot/yacysearch.java index bb2b080af..33d9ae8c0 100644 --- a/htroot/yacysearch.java +++ b/htroot/yacysearch.java @@ -457,49 +457,32 @@ public class yacysearch { final StringBuilder resnav = new StringBuilder(); final int thispage = offset / theQuery.displayResults(); if (thispage == 0) { - //resnav.append("< "); resnav.append(" "); } else { - /* - resnav.append(navurla(thispage - 1, display, theQuery, originalUrlMask)); - resnav.append("< "); - */ - resnav.append(plasmaSearchQuery.navurla(thispage - 1, display, theQuery, originalUrlMask, null)); - resnav.append(" "); + resnav.append(" "); } final int numberofpages = Math.min(10, Math.max(thispage + 2, totalcount / theQuery.displayResults())); for (int i = 0; i < numberofpages; i++) { if (i == thispage) { - /* - resnav.append(""); - resnav.append(i + 1); - resnav.append(" "); - */ resnav.append(" "); } else { - /* - resnav.append(navurla(i, display, theQuery, originalUrlMask)); - resnav.append(i + 1); - resnav.append(" "); - */ - resnav.append(plasmaSearchQuery.navurla(i, display, theQuery, originalUrlMask, null)); - resnav.append(" "); } } if (thispage >= numberofpages) { - //resnav.append(">"); resnav.append(""); } else { - /* - resnav.append(navurla(thispage + 1, display, theQuery, originalUrlMask)); - resnav.append(">"); - */ - resnav.append(plasmaSearchQuery.navurla(thispage + 1, display, theQuery, originalUrlMask, null)); - resnav.append(""); + resnav.append(""); } prop.put("num-results_resnav", resnav.toString()); diff --git a/htroot/yacysearchtrailer.html b/htroot/yacysearchtrailer.html index 2780c9628..3966a65fb 100644 --- a/htroot/yacysearchtrailer.html +++ b/htroot/yacysearchtrailer.html @@ -1,17 +1,19 @@ -#(navigation)# +#(nav-domains)# ::

Domains

-
-#(/navigation)# +#(/nav-domains)# +#(nav-topics)#::

Topics

-
+
+#(/nav-topics)# +

Timeline

diff --git a/htroot/yacysearchtrailer.java b/htroot/yacysearchtrailer.java index cebddc713..782333ebc 100644 --- a/htroot/yacysearchtrailer.java +++ b/htroot/yacysearchtrailer.java @@ -47,9 +47,6 @@ public class yacysearchtrailer { final String eventID = post.get("eventID", ""); final int display = post.getInt("display", 0); - // default settings for blank item - prop.put("words", "0"); - // find search event final plasmaSearchEvent theSearch = plasmaSearchEvent.getEvent(eventID); if (theSearch == null) { @@ -62,46 +59,55 @@ public class yacysearchtrailer { // compose search navigation ArrayList hostNavigator = theSearch.getHostNavigator(10); if (hostNavigator == null) { - prop.put("navigation", 0); + prop.put("nav-domains", 0); } else { - prop.put("navigation", 1); + prop.put("nav-domains", 1); NavigatorEntry entry; int i; for (i = 0; i < hostNavigator.size(); i++) { entry = hostNavigator.get(i); - prop.put("navigation_domains_" + i + "_domain", plasmaSearchQuery.navurla(0, display, theQuery, theQuery.urlMask, "site:" + entry.name) + entry.name + " (" + entry.count + ")"); - prop.putJSON("navigation_domains_" + i + "_domain-json", plasmaSearchQuery.navurla(0, display, theQuery, theQuery.urlMask, "site:" + entry.name) + entry.name + " (" + entry.count + ")"); - prop.put("navigation_domains_" + i + "_nl", 1); + prop.put("nav-domains_element_" + i + "_url", "" + entry.name + " (" + entry.count + ")"); + prop.putJSON("nav_domains_element_" + i + "_url-json", plasmaSearchQuery.navurl("json", 0, display, theQuery, theQuery.urlMask, "site:" + entry.name)); + prop.put("nav-domains_element_" + i + "_name", entry.name); + prop.put("nav-domains_element_" + i + "_count", entry.count); + prop.put("nav-domains_element_" + i + "_modifier", "site:" + entry.name); + prop.put("nav-domains_element_" + i + "_nl", 1); } i--; - prop.put("navigation_domains_" + i + "_nl", 0); - prop.put("navigation_domains", hostNavigator.size()); + prop.put("nav_domains_element_" + i + "_nl", 0); + prop.put("nav_domains_element", hostNavigator.size()); } // attach the bottom line with search references (topwords) final ArrayList references = theSearch.getTopicNavigator(10); + // default settings for no topics + prop.put("nav-topics", "0"); + if (references.size() > 0) { - int hintcount = 0; + int i = 0; NavigatorEntry e; Iterator iter = references.iterator(); while (iter.hasNext()) { e = iter.next(); - if (/*(theQuery == null) ||*/ (theQuery.queryString == null)) break; - if (e.name != null) { - prop.putHTML("words_" + hintcount + "_word", e.name); - prop.putHTML("words_" + hintcount + "_newsearch", theQuery.queryString.replace(' ', '+') + "+" + e.name); - prop.put("words_" + hintcount + "_count", theQuery.displayResults()); - prop.put("words_" + hintcount + "_offset", "0"); - prop.put("words_" + hintcount + "_display", display); - prop.put("words_" + hintcount + "_contentdom", theQuery.contentdom()); - prop.put("words_" + hintcount + "_resource", ((theQuery.isLocal()) ? "local" : "global")); - prop.put("words_" + hintcount + "_nl", (iter.hasNext() && hintcount < MAX_TOPWORDS) ? 1 : 0); + 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", "" + e.name + " (" + e.count + ")"); + prop.putJSON("nav-topics_element_" + i + "_url-json", plasmaSearchQuery.navurl("json", 0, display, theQuery, theQuery.urlMask, e.name)); + prop.put("nav-topics_element_" + i + "_count", e.count); + prop.put("nav-topics_element_" + i + "_offset", "0"); + prop.put("nav-topics_element_" + i + "_display", display); + prop.put("nav-topics_element_" + i + "_modifier", e.name); + prop.put("nav-topics_element_" + i + "_contentdom", theQuery.contentdom()); + prop.put("nav-topics_element_" + i + "_resource", ((theQuery.isLocal()) ? "local" : "global")); + prop.put("nav-topics_element_" + i + "_nl", (iter.hasNext() && i < MAX_TOPWORDS) ? 1 : 0); } - if (hintcount++ > MAX_TOPWORDS) { + if (i++ > MAX_TOPWORDS) { break; } } - prop.put("words", hintcount); + 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); diff --git a/htroot/yacysearchtrailer.json b/htroot/yacysearchtrailer.json index 7a03b0d46..a621522ad 100644 --- a/htroot/yacysearchtrailer.json +++ b/htroot/yacysearchtrailer.json @@ -1,13 +1,28 @@ -"topwords": [ -#{words}# -{ "word": "#[word]#" }#(nl)#::,#(/nl)# -#{/words}# -], -#(navigation)# -:: -"domains": [ -#{domains}# -{ "domain": "#[domain-json]#" }#(nl)#::,#(/nl)# -#{/domains}# -] -#(/navigation)# \ No newline at end of file + "navigation": [#(nav-domains)#:: + { + "facetname": "domains", + "displayname": "Domains", + "type": "String", + "min": "0", + "max": "0", + "mean": "0", + "elements": [ +#{element}# + {"name": "#[name]#", "count": "#[count]#", "modifier": "#[modifier]#", "url": "#[url-json]#"}#(nl)#::,#(/nl)# +#{/element}# + ] + },#(/nav-domains)##(nav-topics)#:: + { + "facetname": "topwords", + "displayname": "Topics", + "type": "String", + "min": "0", + "max": "0", + "mean": "0", + "elements": [ +#{element}# + {"name": "#[name]#", "count": "#[count]#", "modifier": "#[modifier]#", "url": "#[url-json]#"}#(nl)#::,#(/nl)# +#{/element}# + ] + }#(/nav-topics)# + ] \ No newline at end of file diff --git a/htroot/yacysearchtrailer.xml b/htroot/yacysearchtrailer.xml index 0a1187108..f9c10cc94 100644 --- a/htroot/yacysearchtrailer.xml +++ b/htroot/yacysearchtrailer.xml @@ -1,5 +1,17 @@ - -#{words}# -#[word]# -#{/words}# - \ No newline at end of file + +#(nav-domains)#:: + +#{element}# + +#{/element}# + +#(/nav-domains)# +#(nav-topics)#:: + +#{element}# + +#{/element}# + +#(/nav-topics)# + + diff --git a/source/de/anomic/plasma/plasmaSearchQuery.java b/source/de/anomic/plasma/plasmaSearchQuery.java index 6919d9369..55343d2e4 100644 --- a/source/de/anomic/plasma/plasmaSearchQuery.java +++ b/source/de/anomic/plasma/plasmaSearchQuery.java @@ -339,18 +339,18 @@ public final class plasmaSearchQuery { * @param addToQuery * @return */ - public static String navurla(final int page, final int display, final plasmaSearchQuery theQuery, final String originalUrlMask, String addToQuery) { + public static String navurl(String ext, final int page, final int display, final plasmaSearchQuery theQuery, final String originalUrlMask, String addToQuery) { return - ""; + "/yacysearch." + ext + "?display=" + display + + "&search=" + theQuery.queryString(true) + ((addToQuery == null) ? "" : "+" + addToQuery) + + "&maximumRecords="+ theQuery.displayResults() + + "&startRecord=" + (page * theQuery.displayResults()) + + "&resource=" + ((theQuery.isLocal()) ? "local" : "global") + + "&verify=" + ((theQuery.onlineSnippetFetch) ? "true" : "false") + + "&urlmaskfilter=" + originalUrlMask + + "&prefermaskfilter=" + theQuery.prefer + + "&cat=href&constraint=" + ((theQuery.constraint == null) ? "" : theQuery.constraint.exportB64()) + + "&contentdom=" + theQuery.contentdom() + + "&former=" + theQuery.queryString(true); } } diff --git a/source/de/anomic/server/serverObjects.java b/source/de/anomic/server/serverObjects.java index eb02a0653..826a1ec77 100644 --- a/source/de/anomic/server/serverObjects.java +++ b/source/de/anomic/server/serverObjects.java @@ -153,7 +153,7 @@ public class serverObjects extends HashMap implements Cloneable * @return the modified String that was added to the map. */ public String putJSON(final String key, String value) { - value = value.replaceAll("\"", ""); // temporary fix until right quotation is known + value = value.replaceAll("\"", "\\\""); value = value.replaceAll("/", "\\/"); // value = value.replaceAll("\\", "\\\\"); value = value.replaceAll("\b", "\\b");