Browse files

Fixed search result Snapshots link.

Previously rendered as a broken URL containing the absolute file path of
a snapshot on the search server.

Now rendered as a valid URL linking to the /api/snapshot API to provide
available snapshot content. Snapshot format is selected among the
available ones in the following order of preference  : JPG/PNG, PDF, and
  • Loading branch information...
luccioman committed Oct 17, 2017
1 parent 34ca73d commit 4da15db9983f53be542147345c4ae355e8692656
Showing with 26 additions and 5 deletions.
  1. +1 −1 htroot/ConfigSearchPage_p.html
  2. +1 −1 htroot/yacysearchitem.html
  3. +22 −1 htroot/
  4. +1 −1 locales/fr.lng
  5. +1 −1 locales/master.lng.xlf
@@ -258,7 +258,7 @@ <h4 class="linktitle">
<td><span role="separator" aria-orientation="vertical">&nbsp;|&nbsp;</span><a id="cacheLink" href="CacheResource_p.html" target="LayouTest">Cache</a></td>
<td><span role="separator" aria-orientation="vertical">&nbsp;|&nbsp;</span><a id="proxyLink" href="proxy.html" target="LayouTest">View via Proxy</a></td>
<td><span role="separator" aria-orientation="vertical">&nbsp;|&nbsp;</span><a id="browseIndexLink" href="HostBrowser.html" target="LayouTest"><img src="env/grafics/minitree.png" width="15" height="8" title="Browse index" alt="Browse index"/></a></td>
<td><span role="separator" aria-orientation="vertical">&nbsp;|&nbsp;</span><a id="snapshotsLink" href="yacysearch.html" target="LayouTest">Snapshots</a></td>
<td><span role="separator" aria-orientation="vertical">&nbsp;|&nbsp;</span><a id="snapshotsLink" href="yacysearch.html" target="LayouTest">JPG Snapshot</a></td>
#(<td><span role="separator" aria-orientation="vertical">&nbsp;|&nbsp;</span><span title="Raw ranking score value">Ranking: 1.12195955E9</span>#(/
@@ -49,7 +49,7 @@ <h4 class="linktitle">
#(showProxy)#::<span role="separator" aria-orientation="vertical">&nbsp;|&nbsp;</span><a href="proxy.html?url=#[link]#" target="_blank">View via proxy</a>#(/showProxy)#
#(showHostBrowser)#::<span role="separator" aria-orientation="vertical">&nbsp;|&nbsp;</span><a href="HostBrowser.html?path=#[link]#"><img src="env/grafics/minitree.png" width="15" height="8" title="Browse index" alt="Browse index"/></a>#(/showHostBrowser)#
#(showVocabulary)#::<br/>#{vocabulary}##[name]#:#[terms]# #{/vocabulary}##(/showVocabulary)#
#(showSnapshots)#::<a href="#[link]#">Snapshots</a>#(/showSnapshots)#
#(showSnapshots)#::<span role="separator" aria-orientation="vertical">&nbsp;|&nbsp;</span><a href="#[link]#" target="_blank">#[extension]# Snapshot</a>#(/showSnapshots)#
#(showRanking)#::<span role="separator" aria-orientation="vertical">&nbsp;|&nbsp;</span><span title="Raw ranking score value">Ranking: #[ranking]#</span>#(/showRanking)#
@@ -33,6 +33,7 @@
import java.util.Collection;
import java.util.Date;
import java.util.Iterator;
import java.util.Locale;
import java.util.StringTokenizer;
@@ -338,7 +339,27 @@ public static serverObjects respond(final RequestHeader header, final serverObje
prop.put("content_showVocabulary", 0);
if (snapshotPaths != null && snapshotPaths.size() > 0) {
prop.put("content_showSnapshots_link", snapshotPaths.iterator().next().getAbsolutePath());
/* Only add a link to the eventual snapshot file in the format it is stored (no resource fetching and conversion here) */
String selectedExt = null, ext;
for(final File snapshot : snapshotPaths) {
ext = MultiProtocolURL.getFileExtension(snapshot.getName());
if("jpg".equals(ext) || "png".equals(ext)) {
/* Prefer snapshots in jpeg or png format */
selectedExt = ext;
} else if("pdf".equals(ext)) {
selectedExt = ext;
} else if("xml".equals(ext) && selectedExt == null) {
/* Use the XML metadata snapshot in last resort */
selectedExt = ext;
if(selectedExt != null) {
prop.putHTML("content_showSnapshots_extension", selectedExt.toUpperCase(Locale.ROOT));
prop.putHTML("content_showSnapshots_link", "api/snapshot." + selectedExt + "?url=" + resultURL);
} else {
prop.put("content_showSnapshots", 0);
prop.put("content_showRanking_ranking", Float.toString(result.score()));
prop.put("content_ranking", Float.toString(result.score()));
@@ -590,7 +590,7 @@ Maximum range (in days)==Période maximale (en jours)
Maximum days number in the histogram. Beware that a large value may trigger high CPU loads both on the server and on the browser with large result sets.==Nombre maximum de jours de l'histogramme. Veuillez noter qu'une valeur élevée peut déclencher des charges CPU importantes tant sur le serveur que sur le navigateur lorsqu'il y a un grand nombre de résultats.
keyword subject keyword2 keyword3==mot-clé sujet mot-clé2 mot-clé3
View via Proxy==Ouvrir via le proxy
>JPG Snapshot<==>Capture JPG<
"Raw ranking score value"=="Score de classement brut"
Ranking: 1.12195955E9==Score: 1.12195955E9
"Delete navigator"=="Supprimer le groupe"
@@ -2172,7 +2172,7 @@
<source>View via Proxy</source>
<trans-unit id="43d1a9cb" xml:space="preserve" approved="no" translate="yes">
<source>&gt;JPG Snapshot&lt;</source>
<trans-unit id="f5192903" xml:space="preserve" approved="no" translate="yes">
<source>"Raw ranking score value"</source>

0 comments on commit 4da15db

Please sign in to comment.