Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

Add links to the optional keyword tags of search result If swichted on link (click) to the tag adds the keyword to the search query. If a keyword navigator is active the selected keyword adds or replaces a query keyword: modifier (currently replace was choosen as multiple keywords are not fully supported yet)

regerdd82f8595347
diff --git a/htroot/yacysearchitem.html b/htroot/yacysearchitem.html
index 668e23c18..1b5107df3 100644
--- a/htroot/yacysearchitem.html
+++ b/htroot/yacysearchitem.html
@@ -25,7 +25,7 @@
</div>
<p class="snippet"><span class="snippetLoaded" id="h#[urlhash]#">#[description]#</span></p>
<p class="url"><a href="#[link]#" id="url#[urlhash]#" target="#[target]#" #(noreferrer)#::rel="noreferrer"#(/noreferrer)#>#[urlname]#</a></p>
- #(showKeywords)#::<p class="tags">Tags: #{keywords}#<span class="tag label label-default">#[tagword]#</span> #{/keywords}#</p>#(/showKeywords)#
+ #(showKeywords)#::<p class="tags">Tags: #{keywords}#<span class="tag label label-default"><a href="#[tagurl]#" style="color: inherit; text-decoration: inherit;">#[tagword]#</a></span> #{/keywords}#</p>#(/showKeywords)#
<p class="urlinfo">
#(showDate)#::#[date]##(/showDate)#
#(showEvent)#::on #[date]##(/showEvent)#
diff --git a/htroot/yacysearchitem.java b/htroot/yacysearchitem.java
index bdbd9fc51..722169944 100644
--- a/htroot/yacysearchitem.java
+++ b/htroot/yacysearchitem.java
@@ -62,6 +62,7 @@ import net.yacy.peers.graphics.ProfilingGraph;
import net.yacy.search.EventTracker;
import net.yacy.search.Switchboard;
import net.yacy.search.SwitchboardConstants;
+import net.yacy.search.navigator.Navigator;
import net.yacy.search.query.HeuristicResult;
import net.yacy.search.query.QueryParams;
import net.yacy.search.query.SearchEvent;
@@ -242,10 +243,19 @@ 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()," ");
+ String rawNavQueryModifier;
+ Navigator navi = theSearch.navigatorPlugins.get("keywords");
+ boolean naviAvail = navi != null;
int i = 0;
while (stoc.hasMoreTokens()) {
String word = stoc.nextToken();
prop.putHTML("content_showKeywords_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_keywords_" + i + "_tagurl", QueryParams.navurl(fileType, 0, theSearch.query, rawNavQueryModifier, naviAvail).toString());
i++;
}
prop.put("content_showKeywords_keywords", i);