diff --git a/htroot/locale/de/index.html b/htroot/locale/de/index.html new file mode 100644 index 000000000..ac6d4ed8c --- /dev/null +++ b/htroot/locale/de/index.html @@ -0,0 +1,141 @@ + + + +YaCy: Suchseite +#[metas]# + + + +#[header]# +

+


P2P WEB SEARCH



+
#[promoteSearchPageGreeting]#

+ + +
+
+Suche nach (Wörter getrennt mit spaces): +
+ + +
+Maximale Anzahl der Ergebnisse: + +  ordnen nach: + +
+Quelle: + +     Maximale Such-Zeit (Sekunden): + +
+URL mask: +#(urlmaskoptions)# + +:: + restrict on + show all +#(/urlmaskoptions)# +
+
+

+#(excluded)# +:: +The following words are stop-words and had been excluded from the search: #[stopwords]#. +#(/excluded)# +#(num-results)# +:: +No Results. +:: +No Results. (length of search words must be at least 3 characters) +:: +

No Results. If you think this is unsatisfactory then you may consider to support +the global index by running your own proxy/peer. +If everybody contributes, the results will get better.

+

Other possible reasons for no result:
+

+

If you think the information you searched should exist in the global index, +then please run your own peer and start a crawl of your wanted information to make it +available for everyone. Then stay online to support crawls from other peers. Thank you!

+:: +#[linkcount]# results from a total number of #[totalcount]# known links. +You can try to +catch up more links +from 'late' peers to enricht this search result. +#(/num-results)# +#(combine)# +:: +
Please search for several words simultaneously! Click on one of these constraints:
+#{words}# +#[word]# +#{/words}# +#(/combine)# +

+ + +#{results}# + +

+#[description]# +
+#[urlname]#
+#[date]#

+ +#{/results}# + + +

+#(resultbottomline)# +:: +The global search resulted in #[globalresults]# link contributions from other YaCy peers +:: +You can enrich the search results by using the 'global' option: This will search also other YaCy peers +:: +You cannot get global search results because you are not connected to another YaCy peer. +To connect you must first use the proxy. +See here for an installation guide. +Alternatively, you can run the proxy in permanent online mode, which also grants global search. +To do this, press this button: +

+ +
+:: +You can enrich the search results by using the 'global' option; you must also switch to online mode +(by using the proxy) to contribute to the global index. +#(/resultbottomline)# +


+
+
YaCy is a GPL'ed project +with the target of implementing a P2P-based global search engine.
+Architecture and implementation (C) by Michael Peter Christen, +
+ +#[footer]# + + diff --git a/source/de/anomic/http/httpdFileHandler.java b/source/de/anomic/http/httpdFileHandler.java index b6557f796..4dd5dc6c7 100644 --- a/source/de/anomic/http/httpdFileHandler.java +++ b/source/de/anomic/http/httpdFileHandler.java @@ -109,65 +109,71 @@ public final class httpdFileHandler extends httpdAbstractHandler implements http private File htTemplatePath = null; private HashMap templates = null; private String[] defaultFiles = null; + private File htDefaultPath = null; + private File htLocalePath = null; private serverSwitch switchboard; private String adminAccountBase64MD5; public httpdFileHandler(serverSwitch switchboard) { - this.switchboard = switchboard; + this.switchboard = switchboard; - if (this.mimeTable == null) { - // load the mime table - this.mimeTable = new Properties(); - String mimeTablePath = switchboard.getConfig("mimeConfig",""); - FileInputStream mimeTableInputStream = null; - try { - serverLog.logSystem("HTTPDFiles", "Loading mime mapping file " + mimeTablePath); - mimeTableInputStream = new FileInputStream(new File(switchboard.getRootPath(), mimeTablePath)); - this.mimeTable.load(mimeTableInputStream); - } catch (Exception e) { - if (mimeTableInputStream != null) try { mimeTableInputStream.close(); } catch (Exception e1) {} - serverLog.logError("HTTPDFiles", "ERROR: path to configuration file or configuration invalid\n" + e); - System.exit(1); - } - } + if (this.mimeTable == null) { + // load the mime table + this.mimeTable = new Properties(); + String mimeTablePath = switchboard.getConfig("mimeConfig",""); + FileInputStream mimeTableInputStream = null; + try { + serverLog.logSystem("HTTPDFiles", "Loading mime mapping file " + mimeTablePath); + mimeTableInputStream = new FileInputStream(new File(switchboard.getRootPath(), mimeTablePath)); + this.mimeTable.load(mimeTableInputStream); + } catch (Exception e) { + if (mimeTableInputStream != null) try { mimeTableInputStream.close(); } catch (Exception e1) {} + serverLog.logError("HTTPDFiles", "ERROR: path to configuration file or configuration invalid\n" + e); + System.exit(1); + } + } - // create default files array - defaultFiles = switchboard.getConfig("defaultFiles","index.html").split(","); - if (defaultFiles.length == 0) defaultFiles = new String[] {"index.html"}; + // create default files array + defaultFiles = switchboard.getConfig("defaultFiles","index.html").split(","); + if (defaultFiles.length == 0) defaultFiles = new String[] {"index.html"}; - // create a htRootPath: system pages - if (htRootPath == null) { - htRootPath = new File(switchboard.getRootPath(), switchboard.getConfig("htRootPath","htroot")); - if (!(htRootPath.exists())) htRootPath.mkdir(); - } - - // create a htDocsPath: user defined pages - if (htDocsPath == null) { - htDocsPath = new File(switchboard.getRootPath(), switchboard.getConfig("htDocsPath", "htdocs")); - if (!(htDocsPath.exists())) htDocsPath.mkdir(); - } - - // create a htTemplatePath - if (htTemplatePath == null) { - htTemplatePath = new File(switchboard.getRootPath(), switchboard.getConfig("htTemplatePath","htroot/env/templates")); - if (!(htTemplatePath.exists())) htTemplatePath.mkdir(); - } + // create a htRootPath: system pages + if (htRootPath == null) { + htRootPath = new File(switchboard.getRootPath(), switchboard.getConfig("htRootPath","htroot")); + if (!(htRootPath.exists())) htRootPath.mkdir(); + } + // create a htDocsPath: user defined pages + if (htDocsPath == null) { + htDocsPath = new File(switchboard.getRootPath(), switchboard.getConfig("htDocsPath", "htdocs")); + if (!(htDocsPath.exists())) htDocsPath.mkdir(); + } + + // create a htTemplatePath + if (htTemplatePath == null) { + htTemplatePath = new File(switchboard.getRootPath(), switchboard.getConfig("htTemplatePath","htroot/env/templates")); + if (!(htTemplatePath.exists())) htTemplatePath.mkdir(); + } if (templates == null) templates = loadTemplates(htTemplatePath); - // create a class loader - if (provider == null) { - provider = new serverClassLoader(/*this.getClass().getClassLoader()*/); - // debug - /* - Package[] ps = ((cachedClassLoader) provider).packages(); - for (int i = 0; i < ps.length; i++) System.out.println("PACKAGE IN PROVIDER: " + ps[i].toString()); - */ - } - adminAccountBase64MD5 = null; + // create htLocaleDefault, htLocalePath + if (htDefaultPath == null) htDefaultPath = new File(switchboard.getRootPath(), switchboard.getConfig("htDefaultPath","htroot")); + if (htLocalePath == null) htLocalePath = new File(switchboard.getRootPath(), switchboard.getConfig("htLocalePath","htroot/locale")); + //htLocaleSelection = switchboard.getConfig("htLocaleSelection","default"); + + // create a class loader + if (provider == null) { + provider = new serverClassLoader(/*this.getClass().getClassLoader()*/); + // debug + /* + Package[] ps = ((cachedClassLoader) provider).packages(); + for (int i = 0; i < ps.length; i++) System.out.println("PACKAGE IN PROVIDER: " + ps[i].toString()); + */ + } + adminAccountBase64MD5 = null; - serverLog.logSystem("HTTPDFileHandler", "File Handler Initialized"); + serverLog.logSystem("HTTPDFileHandler", "File Handler Initialized"); } private void respondHeader(OutputStream out, int retcode, @@ -344,20 +350,33 @@ public final class httpdFileHandler extends httpdAbstractHandler implements http } // find defaults - File file = null; String testpath = path; if (path.endsWith("/")) { + File file; // attach default file name for (int i = 0; i < defaultFiles.length; i++) { testpath = path + defaultFiles[i]; - file = new File(htRootPath, testpath); + file = new File(htDefaultPath, testpath); if (!(file.exists())) file = new File(htDocsPath, testpath); if (file.exists()) {path = testpath; break;} } + } + + // find locales or alternatives in htDocsPath + File defaultFile = new File(htDefaultPath, path); + File localizedFile = defaultFile; + if (defaultFile.exists()) { + // look if we have a localization of that file + String htLocaleSelection = switchboard.getConfig("htLocaleSelection","default"); + if (!(htLocaleSelection.equals("default"))) { + File localePath = new File(htLocalePath, htLocaleSelection + "/" + path); + if (localePath.exists()) localizedFile = localePath; + } } else { - file = new File(htRootPath, path); - if (!(file.exists())) file = new File(htDocsPath, path); - } + // try to find that file in the htDocsPath + defaultFile = new File(htDocsPath, path); + localizedFile = defaultFile; + } /* if ((iMode) && (path.endsWith(".html"))) { @@ -369,12 +388,12 @@ public final class httpdFileHandler extends httpdAbstractHandler implements http } */ - if ((file.exists()) && (file.canRead())) { + if ((localizedFile.exists()) && (localizedFile.canRead())) { // we have found a file that can be written to the client // if this file uses templates, then we use the template // re-write - method to create an result serverObjects tp = new serverObjects(); - filedate = new Date(file.lastModified()); + filedate = new Date(localizedFile.lastModified()); String mimeType = mimeTable.getProperty(conProp.getProperty("EXT",""),"text/html"); byte[] result; if (path.endsWith("html") || @@ -382,7 +401,7 @@ public final class httpdFileHandler extends httpdAbstractHandler implements http path.endsWith("rss") || path.endsWith("csv") || path.endsWith("pac")) { - rc = rewriteClassFile(file); + rc = rewriteClassFile(defaultFile); if (rc != null) { // CGI-class: call the class to create a property for rewriting try { @@ -423,7 +442,7 @@ public final class httpdFileHandler extends httpdAbstractHandler implements http FileInputStream fis = null; try { o = new ByteArrayOutputStream(); - fis = new FileInputStream(file); + fis = new FileInputStream(localizedFile); httpTemplate.writeTemplate(fis, o, tp, "-UNRESOLVED_PATTERN-".getBytes()); result = o.toByteArray(); } finally { @@ -433,7 +452,7 @@ public final class httpdFileHandler extends httpdAbstractHandler implements http } else { // no html // write the file to the client - result = serverFileUtils.read(file); + result = serverFileUtils.read(localizedFile); } // check mime type again using the result array: these are 'magics' if (serverByteBuffer.equals(result, 1, "PNG".getBytes())) mimeType = mimeTable.getProperty("png","text/html"); diff --git a/source/de/anomic/plasma/plasmaWordIndexCache.java b/source/de/anomic/plasma/plasmaWordIndexCache.java index f3912bbab..183a39b0e 100644 --- a/source/de/anomic/plasma/plasmaWordIndexCache.java +++ b/source/de/anomic/plasma/plasmaWordIndexCache.java @@ -353,8 +353,8 @@ public final class plasmaWordIndexCache implements plasmaWordIndexInterface { } // print statistics - for (int k = 0; k < clusterCandidate.length; k++) - log.logDebug("FLUSH-LIST " + (k + 1) + ": " + clusterCandidate[k].size() + " entries"); + //for (int k = 0; k < clusterCandidate.length; k++) + // log.logDebug("FLUSH-LIST " + (k + 1) + ": " + clusterCandidate[k].size() + " entries"); Map.Entry entry; int candidateCounter; @@ -384,15 +384,13 @@ public final class plasmaWordIndexCache implements plasmaWordIndexInterface { entry = (Map.Entry) i.next(); key = (String) entry.getValue(); createTime = (Long) entry.getKey(); - if ((createTime != null) && ((System.currentTimeMillis() - createTime.longValue()) > 90000)) { + if ((createTime != null) && ((System.currentTimeMillis() - createTime.longValue()) > (cluster * 30000))) { //log.logDebug("flushing singleton-key " + key + ", count=" + count + ", cachesize=" + cache.size() + ", singleton-size=" + singletons.size()); count += java.lang.Math.abs(flushFromMem(key, true)); candidateCounter += cluster; } } if (candidateCounter > 0) log.logDebug("flushed low-cluster #" + cluster + ", count=" + count + ", candidateCounter=" + candidateCounter + ", cachesize=" + cache.size()); - if (count > 1000) return count; - } // stop flushing if cache is shrinked enough diff --git a/startYACY.sh b/startYACY.sh index 43cee3102..e8927e1ed 100755 --- a/startYACY.sh +++ b/startYACY.sh @@ -19,6 +19,7 @@ else echo "To stop YaCy, please execute stopYACY.sh and wait some seconds" echo "To administrate YaCy, start your web browser and open http://localhost:8080" else - java -Xms16m -Xmx200m -classpath classes:$CLASSPATH yacy + java -classpath classes:$CLASSPATH yacy + #java -Xms16m -Xmx200m -classpath classes:$CLASSPATH yacy fi fi diff --git a/yacy.init b/yacy.init index 372338968..6c8a46a7a 100644 --- a/yacy.init +++ b/yacy.init @@ -42,6 +42,16 @@ htDocsPath = DATA/HTDOCS # the first one is priorized defaultFiles = index.html,default.html,search.html,console.html,control.html,welcome.html,wiki.html,forum.html,blog.html,email.html,content.html,monitor.html,share.html,dir.html,readme.txt +# locale-options: yacy supports localization. +# Web pages for special languages are located in the htLocalePath +# The htLocaleLang defines a list of language options as / +# the must exist as sub-path to htLocalePath +# the htLocaleSelection selects from the given locales, value=one-of- +htDefaultPath=htroot +htLocalePath=htroot/locale +htLocaleLang=default/English,de/Deutsch,fr/Français,nl/Nederlands,it/Italiano,es/Español,pt/Portugês,fi/Suomi,se/Svenska,dk/Dansk,gr/Eλληvικα +htLocaleSelection=default + # virtual host for httpdFileServlet access # for example http:/// shall access the file servlet and # return the defaultFile at rootPath