diff --git a/defaults/yacy.init b/defaults/yacy.init
index 66c78683e..0cccf84cb 100644
--- a/defaults/yacy.init
+++ b/defaults/yacy.init
@@ -860,6 +860,8 @@ search.result.noreferrer=false
# search result lines may show additional information for each search hit
# these information pieces may be switched on or off
search.result.show.keywords = false
+# Maximum number of keywords initially displayed. The eventual remaining ones can then be expanded.
+search.result.keywords.firstMaxCount = 100
search.result.show.date = true
search.result.show.size = false
search.result.show.metadata = false
diff --git a/htroot/ConfigSearchPage_p.html b/htroot/ConfigSearchPage_p.html
index 541e8deab..2d8d54693 100644
--- a/htroot/ConfigSearchPage_p.html
+++ b/htroot/ConfigSearchPage_p.html
@@ -237,7 +237,13 @@ var solr= $.getJSON("solr/collection1/select?q=*:*&defType=edismax&start=0&rows=
http://url-of-the-search-result.net
#(showDate)#::#[date]##(/showDate)#
#(showEvent)#::on #[date]##(/showEvent)#
diff --git a/htroot/yacysearchitem.java b/htroot/yacysearchitem.java
index 090be47c7..fb04ef4a8 100644
--- a/htroot/yacysearchitem.java
+++ b/htroot/yacysearchitem.java
@@ -250,7 +250,8 @@ public class yacysearchitem {
prop.put("content_showEvent", showEvent ? 1 : 0);
Collection snapshotPaths = sb.getConfigBool("search.result.show.snapshots", true) ? Transactions.findPaths(result.url(), null, State.ANY) : null;
if (fileType == FileType.HTML) { // html template specific settings
- boolean showKeywords = (sb.getConfigBool("search.result.show.keywords", false) && !result.dc_subject().isEmpty());
+ boolean showKeywords = (sb.getConfigBool(SwitchboardConstants.SEARCH_RESULT_SHOW_KEYWORDS,
+ SwitchboardConstants.SEARCH_RESULT_SHOW_KEYWORDS_DEFAULT) && !result.dc_subject().isEmpty());
prop.put("content_showKeywords", showKeywords);
prop.put("content_showDate", sb.getConfigBool("search.result.show.date", true) && !showEvent ? 1 : 0);
prop.put("content_showSize", sb.getConfigBool("search.result.show.size", true) ? 1 : 0);
@@ -267,13 +268,16 @@ public class yacysearchitem {
if (showEvent) prop.put("content_showEvent_date", GenericFormatter.RFC1123_SHORT_FORMATTER.format(events[0]));
if (showKeywords) { // tokenize keywords
- StringTokenizer stoc = new StringTokenizer(result.dc_subject()," ");
+ final StringTokenizer stoc = new StringTokenizer(result.dc_subject()," ");
String rawNavQueryModifier;
Navigator navi = theSearch.navigatorPlugins.get("keywords");
boolean naviAvail = navi != null;
+ final int firstMaxKeywords = sb.getConfigInt(SwitchboardConstants.SEARCH_RESULT_KEYWORDS_FISRT_MAX_COUNT,
+ SwitchboardConstants.SEARCH_RESULT_KEYWORDS_FISRT_MAX_COUNT_DEFAULT);
int i = 0;
- while (stoc.hasMoreTokens()) {
- String word = stoc.nextToken();
+ while (stoc.hasMoreTokens()
+ && i < firstMaxKeywords) {
+ final String word = stoc.nextToken();
prop.putHTML("content_showKeywords_keywords_" + i + "_tagword", word);
if (naviAvail) { // use query modifier if navigator available
rawNavQueryModifier = navi.getQueryModifier(word);
@@ -285,6 +289,24 @@ public class yacysearchitem {
i++;
}
prop.put("content_showKeywords_keywords", i);
+ if(stoc.hasMoreTokens()) {
+ prop.put("content_showKeywords_moreKeywords", "1");
+ prop.put("content_showKeywords_moreKeywords_urlhash", urlhash);
+ i = 0;
+ while (stoc.hasMoreTokens()) {
+ final String word = stoc.nextToken();
+ prop.putHTML("content_showKeywords_moreKeywords_keywords_" + i + "_tagword", word);
+ if (naviAvail) { // use query modifier if navigator available
+ rawNavQueryModifier = navi.getQueryModifier(word);
+ } else { // otherwise just use the keyword as additional query word
+ rawNavQueryModifier = word;
+ }
+ prop.put("content_showKeywords_moreKeywords_keywords_" + i + "_tagurl", QueryParams.navurl(fileType, 0,
+ theSearch.query, rawNavQueryModifier, naviAvail, authenticated).toString());
+ i++;
+ }
+ prop.put("content_showKeywords_moreKeywords_keywords", i);
+ }
}
prop.put("content_showDate_date", GenericFormatter.RFC1123_SHORT_FORMATTER.format(result.moddate()));
prop.putHTML("content_showSize_sizename", RSSMessage.sizename(result.filesize()));
diff --git a/source/net/yacy/search/SwitchboardConstants.java b/source/net/yacy/search/SwitchboardConstants.java
index 03b94c8b2..8ce6a8d04 100644
--- a/source/net/yacy/search/SwitchboardConstants.java
+++ b/source/net/yacy/search/SwitchboardConstants.java
@@ -570,6 +570,18 @@ public final class SwitchboardConstants {
/** Default setting value controlling whether the ranking score value should be displayed for each search result in the HTML results page */
public static final boolean SEARCH_RESULT_SHOW_RANKING_DEFAULT = false;
+
+ /** Key of the setting controlling whether a tags/keywords list should be displayed for each search result in the HTML results page */
+ public static final String SEARCH_RESULT_SHOW_KEYWORDS = "search.result.show.keywords";
+
+ /** Default setting value controlling whether the ranking score value should be displayed for each search result in the HTML results page */
+ public static final boolean SEARCH_RESULT_SHOW_KEYWORDS_DEFAULT = false;
+
+ /** Key of the setting controlling the maximum number of tags/keywords initially displayed for each search result in the HTML results page (the eventual remaining ones can then be expanded) */
+ public static final String SEARCH_RESULT_KEYWORDS_FISRT_MAX_COUNT = "search.result.keywords.firstMaxCount";
+
+ /** Default setting value controlling the maximum number of tags/keywords initially displayed for each search result in the HTML results page (the eventual remaining ones can then be expanded) */
+ public static final int SEARCH_RESULT_KEYWORDS_FISRT_MAX_COUNT_DEFAULT = 100;
/**
* ranking+evaluation