implemented localization environment

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@171 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 20 years ago
parent 6cc4297761
commit 5f90daa265

@ -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&ouml;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>
&nbsp;&nbsp;ordnen nach:
<select NAME="order">
<option value="Quality-Date" #(order-quality)#::selected#(/order-quality)#>Qualit&auml;t-Datum</option>
<option value="Date-Quality" #(order-date)#::selected#(/order-date)#>Datum-Qualit&auml;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>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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>

@ -109,6 +109,8 @@ public final class httpdFileHandler extends httpdAbstractHandler implements http
private File htTemplatePath = null; private File htTemplatePath = null;
private HashMap templates = null; private HashMap templates = null;
private String[] defaultFiles = null; private String[] defaultFiles = null;
private File htDefaultPath = null;
private File htLocalePath = null;
private serverSwitch switchboard; private serverSwitch switchboard;
private String adminAccountBase64MD5; private String adminAccountBase64MD5;
@ -153,9 +155,13 @@ public final class httpdFileHandler extends httpdAbstractHandler implements http
htTemplatePath = new File(switchboard.getRootPath(), switchboard.getConfig("htTemplatePath","htroot/env/templates")); htTemplatePath = new File(switchboard.getRootPath(), switchboard.getConfig("htTemplatePath","htroot/env/templates"));
if (!(htTemplatePath.exists())) htTemplatePath.mkdir(); if (!(htTemplatePath.exists())) htTemplatePath.mkdir();
} }
if (templates == null) templates = loadTemplates(htTemplatePath); if (templates == null) templates = loadTemplates(htTemplatePath);
// 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 // create a class loader
if (provider == null) { if (provider == null) {
provider = new serverClassLoader(/*this.getClass().getClassLoader()*/); provider = new serverClassLoader(/*this.getClass().getClassLoader()*/);
@ -344,19 +350,32 @@ public final class httpdFileHandler extends httpdAbstractHandler implements http
} }
// find defaults // find defaults
File file = null;
String testpath = path; String testpath = path;
if (path.endsWith("/")) { if (path.endsWith("/")) {
File file;
// attach default file name // attach default file name
for (int i = 0; i < defaultFiles.length; i++) { for (int i = 0; i < defaultFiles.length; i++) {
testpath = path + defaultFiles[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())) file = new File(htDocsPath, testpath);
if (file.exists()) {path = testpath; break;} 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 { } else {
file = new File(htRootPath, path); // try to find that file in the htDocsPath
if (!(file.exists())) file = new File(htDocsPath, path); defaultFile = new File(htDocsPath, path);
localizedFile = defaultFile;
} }
/* /*
@ -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 // we have found a file that can be written to the client
// if this file uses templates, then we use the template // if this file uses templates, then we use the template
// re-write - method to create an result // re-write - method to create an result
serverObjects tp = new serverObjects(); serverObjects tp = new serverObjects();
filedate = new Date(file.lastModified()); filedate = new Date(localizedFile.lastModified());
String mimeType = mimeTable.getProperty(conProp.getProperty("EXT",""),"text/html"); String mimeType = mimeTable.getProperty(conProp.getProperty("EXT",""),"text/html");
byte[] result; byte[] result;
if (path.endsWith("html") || if (path.endsWith("html") ||
@ -382,7 +401,7 @@ public final class httpdFileHandler extends httpdAbstractHandler implements http
path.endsWith("rss") || path.endsWith("rss") ||
path.endsWith("csv") || path.endsWith("csv") ||
path.endsWith("pac")) { path.endsWith("pac")) {
rc = rewriteClassFile(file); rc = rewriteClassFile(defaultFile);
if (rc != null) { if (rc != null) {
// CGI-class: call the class to create a property for rewriting // CGI-class: call the class to create a property for rewriting
try { try {
@ -423,7 +442,7 @@ public final class httpdFileHandler extends httpdAbstractHandler implements http
FileInputStream fis = null; FileInputStream fis = null;
try { try {
o = new ByteArrayOutputStream(); o = new ByteArrayOutputStream();
fis = new FileInputStream(file); fis = new FileInputStream(localizedFile);
httpTemplate.writeTemplate(fis, o, tp, "-UNRESOLVED_PATTERN-".getBytes()); httpTemplate.writeTemplate(fis, o, tp, "-UNRESOLVED_PATTERN-".getBytes());
result = o.toByteArray(); result = o.toByteArray();
} finally { } finally {
@ -433,7 +452,7 @@ public final class httpdFileHandler extends httpdAbstractHandler implements http
} else { // no html } else { // no html
// write the file to the client // 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' // check mime type again using the result array: these are 'magics'
if (serverByteBuffer.equals(result, 1, "PNG".getBytes())) mimeType = mimeTable.getProperty("png","text/html"); if (serverByteBuffer.equals(result, 1, "PNG".getBytes())) mimeType = mimeTable.getProperty("png","text/html");

@ -353,8 +353,8 @@ public final class plasmaWordIndexCache implements plasmaWordIndexInterface {
} }
// print statistics // print statistics
for (int k = 0; k < clusterCandidate.length; k++) //for (int k = 0; k < clusterCandidate.length; k++)
log.logDebug("FLUSH-LIST " + (k + 1) + ": " + clusterCandidate[k].size() + " entries"); // log.logDebug("FLUSH-LIST " + (k + 1) + ": " + clusterCandidate[k].size() + " entries");
Map.Entry entry; Map.Entry entry;
int candidateCounter; int candidateCounter;
@ -384,15 +384,13 @@ public final class plasmaWordIndexCache implements plasmaWordIndexInterface {
entry = (Map.Entry) i.next(); entry = (Map.Entry) i.next();
key = (String) entry.getValue(); key = (String) entry.getValue();
createTime = (Long) entry.getKey(); 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()); //log.logDebug("flushing singleton-key " + key + ", count=" + count + ", cachesize=" + cache.size() + ", singleton-size=" + singletons.size());
count += java.lang.Math.abs(flushFromMem(key, true)); count += java.lang.Math.abs(flushFromMem(key, true));
candidateCounter += cluster; candidateCounter += cluster;
} }
} }
if (candidateCounter > 0) log.logDebug("flushed low-cluster #" + cluster + ", count=" + count + ", candidateCounter=" + candidateCounter + ", cachesize=" + cache.size()); 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 // stop flushing if cache is shrinked enough

@ -19,6 +19,7 @@ else
echo "To stop YaCy, please execute stopYACY.sh and wait some seconds" 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" echo "To administrate YaCy, start your web browser and open http://localhost:8080"
else else
java -Xms16m -Xmx200m -classpath classes:$CLASSPATH yacy java -classpath classes:$CLASSPATH yacy
#java -Xms16m -Xmx200m -classpath classes:$CLASSPATH yacy
fi fi
fi fi

@ -42,6 +42,16 @@ htDocsPath = DATA/HTDOCS
# the first one is priorized # 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 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 <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&ccedil;ais,nl/Nederlands,it/Italiano,es/Espa&ntilde;ol,pt/Portug&ecirc;s,fi/Suomi,se/Svenska,dk/Dansk,gr/E&lambda;&lambda;&eta;v&iota;&kappa;&alpha;
htLocaleSelection=default
# virtual host for httpdFileServlet access # virtual host for httpdFileServlet access
# for example http://<fileHost>/ shall access the file servlet and # for example http://<fileHost>/ shall access the file servlet and
# return the defaultFile at rootPath # return the defaultFile at rootPath

Loading…
Cancel
Save