Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
implemented localization environment
orbiter5f90daa265b6
diff --git a/htroot/locale/de/index.html b/htroot/locale/de/index.htmlnew file mode 100644index 000000000..ac6d4ed8c--- /dev/null+++ b/htroot/locale/de/index.html@@ -0,0 +1,141 @@+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">+<html>+<head>+<title>YaCy: Suchseite</title>+#[metas]#+<link rel="alternate" type="application/rss+xml" title="Suche nach #[former]#" href="index.rss?search=#[former]#">+</head>+<body marginheight="0" marginwidth="0" leftmargin="0" topmargin="0">+#[header]#+<br><br>+<center><h2><font size="2" face="Helvetica, Arial" color="#212942"><img src="/env/grafics/kaskelix.png" align="middle"><br>P2P WEB SEARCH</font></h2></center><br><br>+<center>#[promoteSearchPageGreeting]#</center><br>++<!-- <form action="yacy/search.html" method="get"> -->+<form action="index.html" method="get">+<center><table border="0" cellspacing="0" cellpadding="0"><tr><td>+Suche nach (Wörter getrennt mit spaces):+</td></tr><tr><td>+<input name="search" type="text" size="52" maxlength="80" value="#[former]#">+<input type="submit" name="Enter" value="Search">+</td></tr><tr><td>+Maximale Anzahl der Ergebnisse:+<select NAME="count">+<option #(count-10)#::selected#(/count-10)#>10</option>+<option #(count-50)#::selected#(/count-50)#>50</option>+<option #(count-100)#::selected#(/count-100)#>100</option>+<option #(count-1000)#::selected#(/count-1000)#>1000</option>+</select>+ ordnen nach:+<select NAME="order">+<option value="Quality-Date" #(order-quality)#::selected#(/order-quality)#>Qualität-Datum</option>+<option value="Date-Quality" #(order-date)#::selected#(/order-date)#>Datum-Qualität</option>+</select>+</td></tr><tr><td>+Quelle:+<select NAME="resource">+<option value="global" #(resource-global)#::selected#(/resource-global)#>global</option>+<option value="local" #(resource-local)#::selected#(/resource-local)#>lokal</option>+</select>+ Maximale Such-Zeit (Sekunden):+<select NAME="time">+<option #(time-1)#::selected#(/time-1)#>1</option>+<option #(time-3)#::selected#(/time-3)#>3</option>+<option #(time-10)#::selected#(/time-10)#>10</option>+<option #(time-30)#::selected#(/time-30)#>30</option>+<option #(time-60)#::selected#(/time-60)#>60</option>+</select>+</td></tr><tr><td>+URL mask:+#(urlmaskoptions)#+<input name="urlmaskfilter" type="text" size="12" maxlength="80" value="#[urlmaskfilter]#">+::+<input type="radio" name="urlmask" value="yes" checked> restrict on <input name="urlmaskfilter" type="text" size="12" maxlength="80" value="#[urlmaskfilter]#">+<input type="radio" name="urlmask" value="no"> show all+#(/urlmaskoptions)#+</td></tr></table></center>+</form>+<p>+#(excluded)#+::+<b>The following words are stop-words and had been excluded from the search: #[stopwords]#.</b>+#(/excluded)#+#(num-results)#+::+No Results.+::+No Results. (length of search words must be at least 3 characters)+::+<p>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.</p>+<p>Other possible reasons for no result:<br>+<ul>+<li>The search time was too short. Search again with same query to catch up 'late peers'<li>+<li>There is currently no support for german umlaute. Please use ae/oe/ue instead</li>+<li>Words of length < 3 are not indexed. Please omit such words</li>+<li>YaCy tries to index singular instead of plural words. Please use the singular form</li>+<li>Only complete words are indexed, not parts of words</li>+<li>Don't use stopwords as search words</li>+<li>During this test phase the reaction time of remote peers is unknown.+Please repeat your search to see if there are late-responses from remote peers</li>+</ul></p>+<p>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!</p>+::+#[linkcount]# results from a total number of #[totalcount]# known links.+You can try to+<a href="/index.html?search=#[former]#&Enter=Search&count=#[count]#&order=#[order]#&resource=#[resource]#&time=#[time]#&urlmaskfilter=.*">catch up more links</a>+from 'late' peers to enricht this search result.+#(/num-results)#+#(combine)#+::+<br><b>Please search for several words simultaneously!</b> Click on one of these constraints:<br>+#{words}#+<a href="index.html?search=#[newsearch]#&Enter=Search&count=#[count]#&order=#[order]#&resource=#[resource]#&time=#[time]#">#[word]#</a>+#{/words}#+#(/combine)#+</p>+<!-- linklist begin -->++#{results}#+<!-- link begin -->+<p><b>+#[description]#+</b><br>+<a href="#[url]#">#[urlname]#</a><br>+#[date]#<br></p>+<!-- link end -->+#{/results}#++<!-- linklist end -->+<p>+#(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 <a href="http://www.anomic.de/AnomicHTTPProxy/Installation.html#wininst">installation guide</a>.+Alternatively, you can run the proxy in permanent online mode, which also grants global search.+To do this, press this button:+<form action="SettingsAck_p.html" method="get">+<input type="submit" name="pmode" value="go online">+</form>+::+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)#+</p><br>+<hr>+<center><i>YaCy is a GPL'ed project+with the target of implementing a P2P-based global search engine.<br>+Architecture and implementation (C) by Michael Peter Christen,+<img src="/env/grafics/mcemailh.gif"></i></center>++#[footer]#+</body>+</html>diff --git a/source/de/anomic/http/httpdFileHandler.java b/source/de/anomic/http/httpdFileHandler.javaindex 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 httpprivate 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 namefor (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 resultserverObjects 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 httppath.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 rewritingtry {@@ -423,7 +442,7 @@ public final class httpdFileHandler extends httpdAbstractHandler implements httpFileInputStream 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.javaindex 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 enoughdiff --git a/startYACY.sh b/startYACY.shindex 43cee3102..e8927e1ed 100755--- a/startYACY.sh+++ b/startYACY.sh@@ -19,6 +19,7 @@ elseecho "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 yacyfifidiff --git a/yacy.init b/yacy.initindex 372338968..6c8a46a7a 100644--- a/yacy.init+++ b/yacy.init@@ -42,6 +42,16 @@ htDocsPath = DATA/HTDOCS# the first one is priorizeddefaultFiles = 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 <dir>/<named-language>+# the <dir> must exist as sub-path to htLocalePath+# the htLocaleSelection selects from the given locales, value=one-of-<dir>+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://<fileHost>/ shall access the file servlet and# return the defaultFile at rootPath