diff --git a/defaults/yacy.init b/defaults/yacy.init index 33a4d25c2..9eab81b97 100644 --- a/defaults/yacy.init +++ b/defaults/yacy.init @@ -831,6 +831,7 @@ search.result.show.proxy = false search.result.show.hostbrowser = true search.result.show.vocabulary = false search.result.show.vocabulary.omit = +search.result.show.snapshots = false # search navigators: comma-separated list of default values for search navigation. diff --git a/htroot/ConfigSearchPage_p.html b/htroot/ConfigSearchPage_p.html index f326f7587..242ebd537 100644 --- a/htroot/ConfigSearchPage_p.html +++ b/htroot/ConfigSearchPage_p.html @@ -245,6 +245,7 @@ var solr= $.getJSON("/solr/collection1/select?q=*:*&defType=edismax&start=0&rows  | Cache  | Augmented Browsing  |  +  | Snapshots @@ -263,6 +264,7 @@ var solr= $.getJSON("/solr/collection1/select?q=*:*&defType=edismax&start=0&rows +

diff --git a/htroot/ConfigSearchPage_p.java b/htroot/ConfigSearchPage_p.java index 925764aa4..2fdf1ff1c 100644 --- a/htroot/ConfigSearchPage_p.java +++ b/htroot/ConfigSearchPage_p.java @@ -35,7 +35,6 @@ import net.yacy.cora.date.GenericFormatter; import net.yacy.cora.protocol.RequestHeader; import net.yacy.cora.util.ConcurrentLog; import net.yacy.data.WorkTables; -import net.yacy.document.LibraryProvider; import net.yacy.search.Switchboard; import net.yacy.search.SwitchboardConstants; import net.yacy.server.serverObjects; @@ -78,6 +77,7 @@ public class ConfigSearchPage_p { sb.setConfig("search.result.show.cache", post.getBoolean("search.result.show.cache")); sb.setConfig("search.result.show.proxy", post.getBoolean("search.result.show.proxy")); sb.setConfig("search.result.show.hostbrowser", post.getBoolean("search.result.show.hostbrowser")); + sb.setConfig("search.result.show.snapshots", post.getBoolean("search.result.show.snapshots")); // construct navigation String String nav = ""; @@ -134,6 +134,7 @@ public class ConfigSearchPage_p { sb.setConfig("search.result.show.cache", config.getProperty("search.result.show.cache","true")); sb.setConfig("search.result.show.proxy", config.getProperty("search.result.show.proxy","false")); sb.setConfig("search.result.show.hostbrowser", config.getProperty("search.result.show.hostbrowser","true")); + sb.setConfig("search.result.show.snapshots", config.getProperty("search.result.show.snapshots","true")); } } @@ -160,6 +161,7 @@ public class ConfigSearchPage_p { prop.put("search.result.show.cache", sb.getConfigBool("search.result.show.cache", false) ? 1 : 0); prop.put("search.result.show.proxy", sb.getConfigBool("search.result.show.proxy", false) ? 1 : 0); prop.put("search.result.show.hostbrowser", sb.getConfigBool("search.result.show.hostbrowser", false) ? 1 : 0); + prop.put("search.result.show.snapshots", sb.getConfigBool("search.result.show.snapshots", false) ? 1 : 0); prop.put("search.navigation.location", sb.getConfig("search.navigation", "").indexOf("location",0) >= 0 ? 1 : 0); prop.put("search.navigation.filetype", sb.getConfig("search.navigation", "").indexOf("filetype",0) >= 0 ? 1 : 0); diff --git a/htroot/yacysearchitem.html b/htroot/yacysearchitem.html index 2bc81b6fc..afa3f3abf 100644 --- a/htroot/yacysearchitem.html +++ b/htroot/yacysearchitem.html @@ -35,6 +35,7 @@ #(showProxy)#:: | Augmented Browsing#(/showProxy)# #(showHostBrowser)#:: | #(/showHostBrowser)# #(showVocabulary)#::
#{vocabulary}##[name]#:#[terms]# #{/vocabulary}##(/showVocabulary)# + #(showSnapshots)#::Snapshots#(/showSnapshots)#

:: diff --git a/htroot/yacysearchitem.java b/htroot/yacysearchitem.java index 25b6d4780..c8a7521c8 100644 --- a/htroot/yacysearchitem.java +++ b/htroot/yacysearchitem.java @@ -24,6 +24,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +import java.io.File; import java.net.MalformedURLException; import java.util.Collection; import java.util.Date; @@ -43,6 +44,8 @@ import net.yacy.cora.protocol.RequestHeader.FileType; import net.yacy.cora.util.ConcurrentLog; import net.yacy.cora.util.Memory; import net.yacy.crawler.data.Cache; +import net.yacy.crawler.data.Transactions; +import net.yacy.crawler.data.Transactions.State; import net.yacy.crawler.retrieval.Response; import net.yacy.data.URLLicense; import net.yacy.kelondro.data.meta.URIMetadataNode; @@ -194,6 +197,7 @@ public class yacysearchitem { Date[] events = result.events(); boolean showEvent = events != null && events.length > 0 && sb.getConfig("search.navigation", "").indexOf("date",0) >= 0; 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 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); @@ -204,6 +208,7 @@ public class yacysearchitem { prop.put("content_showCache", sb.getConfigBool("search.result.show.cache", true) && Cache.has(resultURL.hash()) ? 1 : 0); prop.put("content_showProxy", sb.getConfigBool("search.result.show.proxy", true) && sb.getConfigBool("proxyURL", false) ? 1 : 0); prop.put("content_showHostBrowser", sb.getConfigBool("search.result.show.hostbrowser", true) ? 1 : 0); + prop.put("content_showSnapshots", snapshotPaths != null && snapshotPaths.size() > 0 && sb.getConfigBool("search.result.show.snapshots", true) ? 1 : 0); prop.put("content_showVocabulary", sb.getConfigBool("search.result.show.vocabulary", true) ? 1 : 0); if (showEvent) prop.put("content_showEvent_date", GenericFormatter.RFC1123_SHORT_FORMATTER.format(events[0])); @@ -220,7 +225,6 @@ public class yacysearchitem { int c = 0; for (String key: result.getFieldNames()) { if (key.startsWith("vocabulary_") && key.endsWith("_sxt")) { - @SuppressWarnings("unchecked") Collection terms = result.getFieldValues(key); prop.putHTML("content_showVocabulary_vocabulary_" + c + "_name", key.substring(11, key.length() - 4)); prop.putHTML("content_showVocabulary_vocabulary_" + c + "_terms", terms.toString()); @@ -233,6 +237,9 @@ public class yacysearchitem { prop.put("content_showVocabulary_vocabulary", 0); prop.put("content_showVocabulary", 0); } + if (snapshotPaths != null && snapshotPaths.size() > 0) { + prop.put("content_showSnapshots_link", snapshotPaths.iterator().next().getAbsolutePath()); + } } prop.put("content_urlhexhash", Seed.b64Hash2hexHash(urlhash)); prop.putHTML("content_urlname", nxTools.shortenURLString(result.urlname(), MAX_URL_LENGTH)); diff --git a/source/net/yacy/crawler/data/Transactions.java b/source/net/yacy/crawler/data/Transactions.java index 11d4180a7..ed5c29186 100644 --- a/source/net/yacy/crawler/data/Transactions.java +++ b/source/net/yacy/crawler/data/Transactions.java @@ -57,8 +57,8 @@ public class Transactions { private final static String XML_PREFIX = "\n