(1);
while ((voc = querystring.indexOf("/vocabulary/", 0)) >= 0) {
String vocabulary = "";
int ve = querystring.indexOf(' ', voc + 12);
diff --git a/htroot/yacysearchitem.html b/htroot/yacysearchitem.html
index 0789fb3b7..de0086832 100644
--- a/htroot/yacysearchitem.html
+++ b/htroot/yacysearchitem.html
@@ -29,6 +29,7 @@
#(showMetadata)#:: | Metadata#(/showMetadata)#
#(showParser)#:: | Parser#(/showParser)#
#(showPictures)#:: | Pictures#(/showPictures)#
+ #(showCache)#:: | Cache#(/showCache)#
::
#(item)#::
diff --git a/htroot/yacysearchitem.java b/htroot/yacysearchitem.java
index c5f823473..9604d2a5e 100644
--- a/htroot/yacysearchitem.java
+++ b/htroot/yacysearchitem.java
@@ -128,6 +128,7 @@ public class yacysearchitem {
prop.put("content_showMetadata", sb.getConfigBool("search.result.show.metadata", true) ? 1 : 0);
prop.put("content_showParser", sb.getConfigBool("search.result.show.parser", true) ? 1 : 0);
prop.put("content_showPictures", sb.getConfigBool("search.result.show.pictures", true) ? 1 : 0);
+ prop.put("content_showCache", sb.getConfigBool("search.result.show.cache", true) ? 1 : 0);
prop.put("content_authorized", authenticated ? "1" : "0");
final String urlhash = ASCII.String(result.hash());
prop.put("content_authorized_bookmark", sb.tables.bookmarks.hasBookmark("admin", urlhash) ? "0" : "1");
@@ -198,7 +199,7 @@ public class yacysearchitem {
} else {
prop.put("content_code", "");
}
- if (result.lat() == 0.0f || result.lon() == 0.0f) {
+ if (result.lat() == 0.0d || result.lon() == 0.0d) {
prop.put("content_loc", 0);
} else {
prop.put("content_loc", 1);
diff --git a/htroot/yacysearchtrailer.java b/htroot/yacysearchtrailer.java
index 934632d6e..a7c55ff68 100644
--- a/htroot/yacysearchtrailer.java
+++ b/htroot/yacysearchtrailer.java
@@ -28,9 +28,9 @@ import java.util.Iterator;
import java.util.Map;
import net.yacy.cora.document.MultiProtocolURI;
+import net.yacy.cora.lod.SimpleVocabulary;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.cora.sorting.ScoreMap;
-import net.yacy.document.Autotagging;
import net.yacy.document.LibraryProvider;
import net.yacy.kelondro.util.Formatter;
import net.yacy.peers.graphics.ProfilingGraph;
@@ -307,7 +307,7 @@ public class yacysearchtrailer {
while (i < 20 && navigatorIterator.hasNext()) {
name = navigatorIterator.next();
count = ve.getValue().get(name);
- nav = "%2Fvocabulary%2F" + navname + "%2F" + MultiProtocolURI.escape(Autotagging.encodePrintname(name)).toString();
+ nav = "%2Fvocabulary%2F" + navname + "%2F" + MultiProtocolURI.escape(SimpleVocabulary.Metatag.encodePrintname(name)).toString();
queryStringForUrl = theQuery.queryStringForUrl();
p = queryStringForUrl.indexOf(nav);
if (p < 0) {
diff --git a/source/net/yacy/cora/storage/Files.java b/source/net/yacy/cora/storage/Files.java
index 7fab34611..017b6fe6a 100644
--- a/source/net/yacy/cora/storage/Files.java
+++ b/source/net/yacy/cora/storage/Files.java
@@ -1,5 +1,5 @@
/**
- * ConfigurationSet
+ * Files
* Copyright 2011 by Michael Peter Christen, mc@yacy.net, Frankfurt a. M., Germany
* First released 29.06.2011 at http://yacy.net
*
@@ -26,15 +26,92 @@ package net.yacy.cora.storage;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
+import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.io.InputStreamReader;
import java.io.OutputStream;
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.BlockingQueue;
+import java.util.zip.GZIPInputStream;
+
+import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream;
public class Files {
+ /**
+ * open text files for reading. If the files are compressed, choose the
+ * appropriate decompression method automatically
+ * @param f
+ * @return the input stream for the file
+ * @throws IOException
+ */
+ public static InputStream read(File f) throws IOException {
+
+ // make input stream
+ InputStream is = new BufferedInputStream(new FileInputStream(f));
+ if (f.toString().endsWith(".bz2")) is = new BZip2CompressorInputStream(is);
+ if (f.toString().endsWith(".gz")) is = new GZIPInputStream(is);
+
+ return is;
+ }
+
+ /**
+ * reading a file line by line should be done with two concurrent processes
+ * - one reading the file and doing IO operations
+ * - one processing the result
+ * This method makes is easy to create concurrent file readers by providing
+ * a process that fills a blocking queue with lines from a file.
+ * After the method is called, it returns immediately a blocking queue which is
+ * filled concurrently with the lines of the file. When the reading is finished,
+ * this is signalled with a poison entry, the POISON_LINE String which can be
+ * compared with an "==" operation.
+ * @param f the file to read
+ * @param maxQueueSize
+ * @return a blocking queue which is filled with the lines, terminated by POISON_LINE
+ * @throws IOException
+ */
+ public final static String POISON_LINE = "__@POISON__";
+ public static BlockingQueue concurentLineReader(final File f, final int maxQueueSize) throws IOException {
+ final BlockingQueue q = new ArrayBlockingQueue(maxQueueSize);
+ final InputStream is = read(f);
+ final BufferedReader br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
+ Thread t = new Thread() {
+ public void run() {
+ String line;
+ try {
+ while ((line = br.readLine()) != null) {
+ q.put(line);
+ }
+ } catch (IOException e) {
+ } catch (InterruptedException e) {
+ } finally {
+ try {
+ q.put(POISON_LINE);
+ try {
+ br.close();
+ is.close();
+ } catch (IOException ee) {
+ }
+ } catch (InterruptedException e) {
+ // last try
+ q.add(POISON_LINE);
+ try {
+ br.close();
+ is.close();
+ } catch (IOException ee) {
+ }
+ }
+ }
+ }
+ };
+ t.start();
+ return q;
+ }
+
/**
* copy a file or a complete directory
* @param from the source file or directory