Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
add filter to citation page and a on/off button to display only sentences with citations, while maintaining the sentence number. Make the filtered list the default in search result citation link
regerf5967dfedfb0
diff --git a/htroot/api/citation.html b/htroot/api/citation.htmlindex 268ba99f8..e459e62a8 100644--- a/htroot/api/citation.html+++ b/htroot/api/citation.html@@ -13,9 +13,18 @@<li><a href="#[url]#">#[url]#</a></li>#{/links}#</ul>#(/similar)#- <form action="#" name="" method="post" enctype="multipart/form-data" accept-charset="UTF-8">+ <form action="citation.html?url=#[url]#" name="" method="post" enctype="multipart/form-data" accept-charset="UTF-8"><fieldset>- <legend><label>List of Sentences in #[url]#</label></legend>+ <table width="100%">+ <tr>+ <td>+ <legend><label>List of #(filter)#::Cited#(/filter)# Sentences in #[url]#</label></legend>+ </td>+ <td align="right">+ <button type="submit" name="filter" class="btn btn-default btn-sm" value="#(filter)#true::false#(/filter)#">#(filter)#filter cited sentences::filter off#(/filter)#</button>+ </td>+ </tr>+ </table><dl>#{sentences}#<dt>#[dt]#</dt><dd>#[dd]#</dd>#{/sentences}#</dl>diff --git a/htroot/api/citation.java b/htroot/api/citation.javaindex 0af3d5a26..c5fa7aa61 100644--- a/htroot/api/citation.java+++ b/htroot/api/citation.java@@ -61,6 +61,7 @@ public class citation {String url = "";String hash = "";int ch = 10;+ boolean filter = false; // show cited sentences onlyif (post != null) {if (post.containsKey("url")) {url = post.get("url");@@ -78,8 +79,9 @@ public class citation {if (post.containsKey("ch")) {ch = post.getInt("ch", ch);}+ filter = post.getBoolean("filter");}-+ prop.put("filter", filter);if (url.length() > 0) {try {uri = new DigestURL(url, null);@@ -152,20 +154,37 @@ public class citation {// iterate the sentencesint i = 0;+ int sentenceNr = 0;for (Map.Entry<String, Set<DigestURL>> se: sentenceOcc.entrySet()) {- prop.put("sentences_" + i + "_dt", i);- StringBuilder dd = new StringBuilder(se.getKey());Set<DigestURL> app = se.getValue();- if (app != null && app.size() > 0) {- dd.append("<br/>appears in:");- for (DigestURL u: app) {- if (u != null) {- dd.append(" <a href=\"").append(u.toNormalform(false)).append("\">").append(u.getHost()).append("</a>");+ if (filter) { // prepare list, only include sentence with citation+ if (app != null && app.size() > 0) {+ StringBuilder dd = new StringBuilder(se.getKey());+ prop.put("sentences_" + i + "_dt", sentenceNr);+ dd.append("<br/>appears in:");+ for (DigestURL u : app) {+ if (u != null) {+ dd.append(" <a href=\"").append(u.toNormalform(false)).append("\">").append(u.getHost()).append("</a>");+ }+ }+ prop.put("sentences_" + i + "_dd", dd.toString());+ i++;+ }+ } else { // prepare list, include all sentences+ StringBuilder dd = new StringBuilder(se.getKey());+ prop.put("sentences_" + i + "_dt", sentenceNr);+ if (app != null && app.size() > 0) {+ dd.append("<br/>appears in:");+ for (DigestURL u : app) {+ if (u != null) {+ dd.append(" <a href=\"").append(u.toNormalform(false)).append("\">").append(u.getHost()).append("</a>");+ }}}+ prop.put("sentences_" + i + "_dd", dd.toString());+ i++;}- prop.put("sentences_" + i + "_dd", dd.toString());- i++;+ sentenceNr++;}prop.put("sentences", i);diff --git a/htroot/yacysearchitem.html b/htroot/yacysearchitem.htmlindex a8e452804..02dc19718 100644--- a/htroot/yacysearchitem.html+++ b/htroot/yacysearchitem.html@@ -28,7 +28,7 @@#(showSize)#:: | #[sizename]##(/showSize)##(showMetadata)#:: | <a href="solr/select?q=id:%22#[urlhash]#%22&defType=edismax&start=0&rows=1&core=collection1&wt=html" target="_blank" onclick="return hs.htmlExpand(this, { objectType: 'ajax'} )">Metadata</a>#(/showMetadata)##(showParser)#:: | <a href="ViewFile.html?urlHash=#[urlhash]#&words=#[words]#" target="_blank">Parser</a>#(/showParser)#- #(showCitation)#:: | <a href="api/citation.html?hash=#[urlhash]#" target="_blank">Citations</a>#(/showCitation)#+ #(showCitation)#:: | <a href="api/citation.html?hash=#[urlhash]#&filter=true" target="_blank">Citations</a>#(/showCitation)##(showPictures)#:: | <a href="yacysearch.html?contentdom=image&url=#[link]#&query=#[former]# inurl:#[link]#" target="_blank">Pictures</a>#(/showPictures)##(showCache)#:: | <a href="CacheResource_p.html?url=#[link]#" target="_blank">Cache</a>#(/showCache)##(showProxy)#:: | <a href="proxy.html?url=#[link]#" target="_blank">Augmented Browsing</a>#(/showProxy)#