Merge origin/master into jetty

pull/1/head
reger 11 years ago
commit 5c4a3d1c01

@ -45,6 +45,7 @@ import net.yacy.cora.protocol.RequestHeader;
import net.yacy.data.BlogBoard;
import net.yacy.data.UserDB;
import net.yacy.peers.NewsPool;
import net.yacy.peers.Seed;
import net.yacy.search.Switchboard;
import net.yacy.server.serverObjects;
import net.yacy.server.serverSwitch;
@ -112,7 +113,7 @@ public class Blog {
if (sb.peers.mySeed() == null) {
strAuthor = "anonymous";
} else {
strAuthor = sb.peers.mySeed().get("Name", "anonymous");
strAuthor = sb.peers.mySeed().get(Seed.NAME, "anonymous");
}
}
}

@ -46,6 +46,7 @@ import net.yacy.data.MessageBoard;
import net.yacy.data.UserDB;
import net.yacy.data.BlogBoard.BlogEntry;
import net.yacy.peers.Network;
import net.yacy.peers.Seed;
import net.yacy.search.Switchboard;
import net.yacy.server.serverObjects;
import net.yacy.server.serverSwitch;
@ -95,7 +96,7 @@ public class BlogComments {
if (sb.peers.mySeed() == null) {
strAuthor = "anonymous";
} else {
strAuthor = sb.peers.mySeed().get("Name", "anonymous");
strAuthor = sb.peers.mySeed().get(Seed.NAME, "anonymous");
}
}
}

@ -137,13 +137,13 @@ public class HostBrowser {
sb.crawler.defaultProxyProfile.handle(),
0, 0, 0, 0
));
prop.put("result", reasonString == null ? ("added url to indexer: " + load) : ("not indexed url '" + load + "': " + reasonString));
prop.putHTML("result", reasonString == null ? ("added url to indexer: " + load) : ("not indexed url '" + load + "': " + reasonString));
if (wait) for (int i = 0; i < 30; i++) {
if (sb.index.exists(ASCII.String(url.hash()))) break;
try {Thread.sleep(100);} catch (final InterruptedException e) {}
}
} catch (final MalformedURLException e) {
prop.put("result", "bad url '" + load + "'");
prop.putHTML("result", "bad url '" + load + "'");
}
}
@ -192,7 +192,7 @@ public class HostBrowser {
String host;
while (i.hasNext() && c < maxcount) {
host = i.next();
prop.put("hosts_list_" + c + "_host", host);
prop.putHTML("hosts_list_" + c + "_host", host);
boolean inCrawler = crawler.containsKey(host);
int exclcount = exclscore.get(host);
int failcount = failscore.get(host);
@ -234,13 +234,13 @@ public class HostBrowser {
if (p > 0) path = path.substring(0, p + 1);
}
prop.put("files_complete", complete ? 1 : 0);
prop.put("files_complete_path", path);
prop.putHTML("files_complete_path", path);
p = path.substring(0, path.length() - 1).lastIndexOf('/');
if (p < 8) {
prop.put("files_root", 1);
} else {
prop.put("files_root", 0);
prop.put("files_root_path", path.substring(0, p + 1));
prop.putHTML("files_root_path", path.substring(0, p + 1));
}
try {
// generate file list from path
@ -420,7 +420,7 @@ public class HostBrowser {
if (entry.getValue() instanceof StoreType) {
// this is a file
prop.put("files_list_" + c + "_type", 0);
prop.put("files_list_" + c + "_type_url", entry.getKey());
prop.putHTML("files_list_" + c + "_type_url", entry.getKey());
StoreType type = (StoreType) entry.getValue();
try {uri = new DigestURL(entry.getKey());} catch (final MalformedURLException e) {uri = null;}
HarvestProcess process = uri == null ? null : sb.crawlQueues.exists(uri.hash());
@ -439,7 +439,7 @@ public class HostBrowser {
FailType failType = errorDocs.get(entry.getKey());
if (failType == null) {
// maybe this is only in the errorURL
prop.put("files_list_" + c + "_type_stored_error", process == HarvestProcess.ERRORS ? sb.crawlQueues.errorURL.get(ASCII.String(uri.hash())).getFailReason() : "unknown error");
prop.putHTML("files_list_" + c + "_type_stored_error", process == HarvestProcess.ERRORS ? sb.crawlQueues.errorURL.get(ASCII.String(uri.hash())).getFailReason() : "unknown error");
} else {
String ids = ASCII.String(uri.hash());
InfoCacheEntry ice = infoCache.get(ids);
@ -447,8 +447,8 @@ public class HostBrowser {
}
}
if (loadRight) {
prop.put("files_list_" + c + "_type_stored_load_url", entry.getKey());
prop.put("files_list_" + c + "_type_stored_load_path", path);
prop.putHTML("files_list_" + c + "_type_stored_load_url", entry.getKey());
prop.putHTML("files_list_" + c + "_type_stored_load_path", path);
}
if (++c >= maxcount) break;
}
@ -471,7 +471,7 @@ public class HostBrowser {
Iterator<String> i = score.keys(false);
while (i.hasNext() && c < maxcount) {
host = i.next();
prop.put("inbound_list_" + c + "_host", sb.webStructure.hostHash2hostName(host));
prop.putHTML("inbound_list_" + c + "_host", sb.webStructure.hostHash2hostName(host));
prop.put("inbound_list_" + c + "_count", score.get(host));
c++;
}
@ -490,7 +490,7 @@ public class HostBrowser {
Iterator<String> i = score.keys(false);
while (i.hasNext() && c < maxcount) {
host = i.next();
prop.put("outbound_list_" + c + "_host", host);
prop.putHTML("outbound_list_" + c + "_host", host);
prop.put("outbound_list_" + c + "_count", score.get(host));
prop.put("outbound_list_" + c + "_link", outboundHosts.get(host).getMinKey());
c++;

@ -34,6 +34,8 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.lucene.search.FieldCache;
import net.yacy.cora.date.GenericFormatter;
import net.yacy.cora.document.encoding.ASCII;
import net.yacy.cora.document.id.DigestURL;
@ -292,6 +294,7 @@ public class IndexControlURLs_p {
if (post.containsKey("rebootsolr")) {
segment.fulltext().rebootSolr();
FieldCache.DEFAULT.purgeAllCaches();
sb.tables.recordAPICall(post, "IndexControlURLs_p.html", WorkTables.TABLE_API_TYPE_STEERING, "solr reboot");
}

@ -46,6 +46,7 @@ import net.yacy.cora.util.ByteBuffer;
import net.yacy.data.Diff;
import net.yacy.data.wiki.WikiBoard;
import net.yacy.peers.NewsPool;
import net.yacy.peers.Seed;
import net.yacy.search.Switchboard;
import net.yacy.server.serverObjects;
import net.yacy.server.serverSwitch;
@ -79,7 +80,7 @@ public class Wiki {
if (author.equals(ANONYMOUS)) {
author = WikiBoard.guessAuthor(ip);
if (author == null) {
author = (sb.peers.mySeed() == null) ? ANONYMOUS : sb.peers.mySeed().get("Name", ANONYMOUS);
author = (sb.peers.mySeed() == null) ? ANONYMOUS : sb.peers.mySeed().get(Seed.NAME, ANONYMOUS);
}
}

@ -242,6 +242,7 @@ function yacysearch(clear) {
param[i] = item;
});
param[param.length] = { name : 'startRecord', value : startRecord };
ycurr = ycurr.replace("<"," ").replace(">"," ");
$.ajaxSetup({
timeout: 10000,
@ -274,7 +275,7 @@ function yacysearch(clear) {
else data = json;
var searchTerms = "";
searchTerms = data.channels[0].searchTerms;
searchTerms = data.channels[0].searchTerms.replace("<"," ").replace(">"," ");;
if($.trim(ycurr.replace(/ /g,"+")) != searchTerms) {
return false;

@ -0,0 +1,94 @@
// seedlist.java
// -----------------------
// part of YaCy
// (C) by Michael Peter Christen; mc@yacy.net
// first published on http://yacy.net
// Frankfurt, Germany, 2013
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import java.util.ArrayList;
import java.util.Map;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.peers.Seed;
import net.yacy.search.Switchboard;
import net.yacy.server.serverCore;
import net.yacy.server.serverObjects;
import net.yacy.server.serverSwitch;
/**
* this servlet generates the same file as the principal peers upload to a bootstrap position
* you can call it either with
* http://localhost:8090/yacy/seedlist.html
* or to generate json (or jsonp) with
* http://localhost:8090/yacy/seedlist.json
* http://localhost:8090/yacy/seedlist.json?callback=seedlist
*/
public final class seedlist {
private static final int LISTMAX = 1000;
public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
final Switchboard sb = (Switchboard) env;
int maxcount = Math.min(LISTMAX, post == null ? Integer.MAX_VALUE : post.getInt("maxcount", Integer.MAX_VALUE));
final ArrayList<Seed> v = sb.peers.getSeedlist(maxcount, true);
final serverObjects prop = new serverObjects();
// write simple-encoded seed lines or json
String EXT = header.get("EXT");
boolean json = EXT != null && EXT.equals("json");
if (json) {
// check for JSONP
if ( post != null && post.containsKey("callback") ) {
prop.put("jsonp-start", post.get("callback") + "([");
prop.put("jsonp-end", "]);");
} else {
prop.put("jsonp-start", "");
prop.put("jsonp-end", "");
}
// construct json property lists
for (int i = 0; i < v.size(); i++) {
prop.putJSON("peers_" + i + "_map_0_k", Seed.HASH);
prop.putJSON("peers_" + i + "_map_0_v", v.get(i).hash);
prop.put("peers_" + i + "_map_0_c", 1);
Map<String, String> map = v.get(i).getMap();
int c = 1;
for (Map.Entry<String, String> m: map.entrySet()) {
prop.putJSON("peers_" + i + "_map_" + c + "_k", m.getKey());
prop.putJSON("peers_" + i + "_map_" + c + "_v", m.getValue());
prop.put("peers_" + i + "_map_" + c + "_c", 1);
c++;
}
prop.put("peers_" + i + "_map_" + (c - 1) + "_c", 0);
prop.put("peers_" + i + "_map", c);
prop.put("peers_" + i + "_c", i < v.size() - 1 ? 1 : 0);
}
prop.put("peers", v.size());
} else {
final StringBuilder encoded = new StringBuilder(1024);
for (Seed seed: v) {
encoded.append(seed.genSeedStr(null)).append(serverCore.CRLF_STRING);
}
prop.put("encoded", encoded.toString());
}
// return rewrite properties
return prop;
}
}

@ -0,0 +1,6 @@
#[jsonp-start]#{
"peers":[#{peers}#{
#{map}#"#[k]#":"#[v]#"#(c)#::,#(/c)#
#{/map}#}#(c)#::,#(/c)##{/peers}#
]
}#[jsonp-end]#

@ -60,7 +60,7 @@ public class HTMLResponseWriter implements QueryResponseWriter {
@Override
public String getContentType(final SolrQueryRequest request, final SolrQueryResponse response) {
return CONTENT_TYPE_XML_UTF8;
return "text/html";
}
@Override

@ -20,8 +20,10 @@
package net.yacy.cora.order;
import java.io.IOException;
import java.io.Serializable;
import java.util.Comparator;
import java.util.Random;
import net.yacy.cora.document.encoding.UTF8;
@ -51,18 +53,18 @@ public class Base64Order extends AbstractOrder<byte[]> implements ByteOrder, Com
public static final Base64Order standardCoder = new Base64Order(true, true);
public static final Base64Order enhancedCoder = new Base64Order(true, false);
private final boolean rfc1113compliant;
private final boolean rfc1521compliant;
private final byte[] alpha;
private final byte[] ahpla;
private final byte[] ab; // decision table for comparisments
public Base64Order(final boolean up, final boolean rfc1113compliant) {
// if we choose not to be rfc1113compliant,
public Base64Order(final boolean up, final boolean rfc1521compliant) {
// if we choose not to be rfc1521compliant,
// then we get shorter base64 results which are also filename-compatible
this.rfc1113compliant = rfc1113compliant;
this.rfc1521compliant = rfc1521compliant;
this.asc = up;
this.alpha = (rfc1113compliant) ? alpha_standard : alpha_enhanced;
this.ahpla = (rfc1113compliant) ? ahpla_standard : ahpla_enhanced;
this.alpha = (rfc1521compliant) ? alpha_standard : alpha_enhanced;
this.ahpla = (rfc1521compliant) ? ahpla_standard : ahpla_enhanced;
this.ab = new byte[1 << 14];
byte acc, bcc;
byte c;
@ -90,7 +92,7 @@ public class Base64Order extends AbstractOrder<byte[]> implements ByteOrder, Com
@Override
public Order<byte[]> clone() {
final Base64Order o = new Base64Order(this.asc, this.rfc1113compliant);
final Base64Order o = new Base64Order(this.asc, this.rfc1521compliant);
o.rotate(this.zero);
return o;
}
@ -121,10 +123,10 @@ public class Base64Order extends AbstractOrder<byte[]> implements ByteOrder, Com
@Override
public final String signature() {
if ((!this.asc) && (!this.rfc1113compliant)) return "Bd";
if ((!this.asc) && ( this.rfc1113compliant)) return "bd";
if (( this.asc) && (!this.rfc1113compliant)) return "Bu";
if (( this.asc) && ( this.rfc1113compliant)) return "bu";
if ((!this.asc) && (!this.rfc1521compliant)) return "Bd";
if ((!this.asc) && ( this.rfc1521compliant)) return "bd";
if (( this.asc) && (!this.rfc1521compliant)) return "Bu";
if (( this.asc) && ( this.rfc1521compliant)) return "bu";
return null;
}
@ -218,7 +220,7 @@ public class Base64Order extends AbstractOrder<byte[]> implements ByteOrder, Com
}
// now there may be remaining bytes
if (in.length % 3 != 0) out = out.append((in.length % 3 == 2) ? encodeLongSB((((0XffL & in[pos]) << 8) + (0XffL & in[pos + 1])) << 8, 4).substring(0, 3) : encodeLongSB((((0XffL & in[pos])) << 8) << 8, 4).substring(0, 2));
if (this.rfc1113compliant) while (out.length() % 4 > 0) out.append("=");
if (this.rfc1521compliant) while (out.length() % 4 > 0) out.append("=");
// return result
//assert lene == out.length() : "lene = " + lene + ", out.len = " + out.length();
return out.toString();
@ -247,7 +249,7 @@ public class Base64Order extends AbstractOrder<byte[]> implements ByteOrder, Com
}
}
if (this.rfc1113compliant) while (writepos % 4 > 0 && writepos < sublen) out[writepos] = '=';
if (this.rfc1521compliant) while (writepos % 4 > 0 && writepos < sublen) out[writepos] = '=';
//assert encode(in).substring(0, sublen).equals(ASCII.String(out));
return out;
}
@ -261,7 +263,7 @@ public class Base64Order extends AbstractOrder<byte[]> implements ByteOrder, Com
try {
int posIn = 0;
int posOut = 0;
if (this.rfc1113compliant) while (in.charAt(in.length() - 1) == '=') in = in.substring(0, in.length() - 1);
if (this.rfc1521compliant) while (in.charAt(in.length() - 1) == '=') in = in.substring(0, in.length() - 1);
final byte[] out = new byte[in.length() / 4 * 3 + (((in.length() % 4) == 0) ? 0 : in.length() % 4 - 1)];
long l;
while (posIn + 3 < in.length()) {
@ -595,5 +597,36 @@ public class Base64Order extends AbstractOrder<byte[]> implements ByteOrder, Com
// return the cardinal of a given string as normalized float 0 .. 1 with the enhanced encoder
System.out.println(((double) Base64Order.enhancedCoder.cardinal(s[1].getBytes())) / ((double) Long.MAX_VALUE));
}
if ("-test".equals(s[0])) {
// do some checks
Random r = new Random(System.currentTimeMillis());
// encode with enhancedCoder, decode with standard RFC 1521 base64
sun.misc.BASE64Decoder rfc1521Decoder = new sun.misc.BASE64Decoder();
for (int i = 0; i < 100000; i++) {
String challenge = Long.toString(r.nextLong());
String eb64 = enhancedCoder.encode(UTF8.getBytes(challenge));
String rfc1521 = new String(eb64);
while (rfc1521.length() % 4 != 0) rfc1521 += "=";
rfc1521 = rfc1521.replace('-', '+').replace('_', '/');
System.out.println("Encode enhancedB64 + Decode RFC1521: Challenge=" + challenge + ", eb64=" + eb64 + ", rfc1521=" + rfc1521);
try {
if (!UTF8.String(rfc1521Decoder.decodeBuffer(rfc1521)).equals(challenge)) System.out.println("Encode Fail for " + challenge);
} catch (IOException e) {}
}
// encode with enhancedCoder, decode with standard RFC 1521 base64
sun.misc.BASE64Encoder rfc1521Encoder = new sun.misc.BASE64Encoder();
for (int i = 0; i < 100000; i++) {
// encode with enhancedCoder, decode with standard RFC 1521 base64
String challenge = Long.toString(r.nextLong());
String rfc1521 = rfc1521Encoder.encode(UTF8.getBytes(challenge));
String eb64 = new String(rfc1521);
while (eb64.endsWith("=")) eb64 = eb64.substring(0, eb64.length() - 1);
eb64 = eb64.replace('+', '-').replace('/', '_');
System.out.println("Encode RFC1521 + Decode enhancedB64: Challenge=" + challenge + ", rfc1521=" + rfc1521 + ", eb64=" + eb64);
if (!UTF8.String(enhancedCoder.decode(eb64)).equals(challenge)) System.out.println("Encode Fail for " + challenge);
}
}
}
}

@ -427,9 +427,9 @@ public class Network
try {
final NewsDB.Record record = this.sb.peers.newsPool.myPublication();
if ( record == null ) {
this.sb.peers.mySeed().put("news", "");
this.sb.peers.mySeed().put(Seed.NEWS, "");
} else {
this.sb.peers.mySeed().put("news", net.yacy.utils.crypt.simpleEncode(record.toString()));
this.sb.peers.mySeed().put(Seed.NEWS, net.yacy.utils.crypt.simpleEncode(record.toString()));
}
} catch (final Exception e ) {
log.severe("publishMySeed: problem with news encoding", e);

@ -207,7 +207,7 @@ public class PeerActions {
if (Network.log.isFine()) Network.log.fine("connect: no contact to a " + peer.get(Seed.PEERTYPE, Seed.PEERTYPE_VIRGIN) + " peer '" + peer.getName() + "' at " + peer.getPublicAddress() + ". Cause: " + cause);
synchronized (this.seedDB) {
if (!this.seedDB.hasDisconnected(ASCII.getBytes(peer.hash))) { this.disconnects++; }
peer.put("dct", Long.toString(System.currentTimeMillis()));
peer.put(Seed.DCT, Long.toString(System.currentTimeMillis()));
this.seedDB.addDisconnected(peer); // update info
}
EventChannel.channels(EventChannel.PEERNEWS).addMessage(new RSSMessage(peer.getName() + " left the network", "", ""));
@ -223,7 +223,7 @@ public class PeerActions {
}
private void processPeerArrival(final Seed peer) {
final String recordString = peer.get("news", null);
final String recordString = peer.get(Seed.NEWS, null);
//System.out.println("### triggered news arrival from peer " + peer.getName() + ", news " + ((recordString == null) ? "empty" : "attached"));
if ((recordString == null) || (recordString.isEmpty())) return;
final String decodedString = net.yacy.utils.crypt.simpleDecode(recordString);

@ -141,7 +141,7 @@ public class Seed implements Cloneable, Comparable<Seed>, Comparator<Seed>
/** the name of the peer (user-set) */
public static final String NAME = "Name";
private static final String HASH = "Hash";
public static final String HASH = "Hash";
/** Birthday - first startup */
private static final String BDATE = "BDate";
/** UTC-Offset */
@ -169,6 +169,9 @@ public class Seed implements Cloneable, Comparable<Seed>, Comparator<Seed>
public static final String IP = "IP";
public static final String PORT = "Port";
public static final String SEEDLISTURL = "seedURL";
public static final String NEWS = "news"; // news attachment
public static final String DCT = "dct"; // disconnect time
/** zero-value */
private static final String ZERO = "0";
@ -1102,8 +1105,8 @@ public class Seed implements Cloneable, Comparable<Seed>, Comparator<Seed>
final String r = toString();
final String z = crypt.simpleEncode(r, key, 'z');
final String b = crypt.simpleEncode(r, key, 'b');
// the compressed string may be longer that the uncompressed if there is too much overhead for compression meta-info
// take simply that string that is shorter
// the compressed string may be longer than the uncompressed if there is too much overhead for compression meta-info
// take simply that string which is shorter
return ( b.length() < z.length() ) ? b : z;
}

@ -33,6 +33,7 @@ import java.net.InetAddress;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.concurrent.ConcurrentHashMap;
@ -403,7 +404,7 @@ public final class SeedDB implements AlternativeDomainNames {
return new seedEnum(up, rot, (firstHash == null) ? null : firstHash, null, this.seedActiveDB, minVersion);
}
private Iterator<Seed> seedsDisconnected(final boolean up, final boolean rot, final byte[] firstHash, final double minVersion) {
public Iterator<Seed> seedsDisconnected(final boolean up, final boolean rot, final byte[] firstHash, final double minVersion) {
// enumerates seed-type objects: all seeds sequentially without order
return new seedEnum(up, rot, (firstHash == null) ? null : firstHash, null, this.seedPassiveDB, minVersion);
}
@ -716,40 +717,13 @@ public final class SeedDB implements AlternativeDomainNames {
try {
pw = new PrintWriter(new BufferedWriter(new FileWriter(seedFile)));
// store own peer seed
List<Seed> seedlist = getSeedlist(Integer.MAX_VALUE, addMySeed);
String line;
if (this.mySeed == null) initMySeed();
if (addMySeed) {
line = this.mySeed.genSeedStr(null);
for (Seed seed: seedlist) {
line = seed.genSeedStr(null);
v.add(line);
pw.print(line + serverCore.CRLF_STRING);
}
// store active peer seeds
Seed ys;
Iterator<Seed> se = seedsConnected(true, false, null, (float) 0.0);
while (se.hasNext()) {
ys = se.next();
if (ys != null) {
line = ys.genSeedStr(null);
v.add(line);
pw.print(line + serverCore.CRLF_STRING);
}
}
// store some of the not-so-old passive peer seeds (limit: 1 day)
se = seedsDisconnected(true, false, null, (float) 0.0);
final long timeout = System.currentTimeMillis() - (1000L * 60L * 60L * 24L);
while (se.hasNext()) {
ys = se.next();
if (ys != null) {
if (ys.getLastSeenUTC() < timeout) continue;
line = ys.genSeedStr(null);
v.add(line);
pw.print(line + serverCore.CRLF_STRING);
}
}
pw.flush();
} finally {
if (pw != null) try { pw.close(); } catch (final Exception e) {}
@ -757,6 +731,35 @@ public final class SeedDB implements AlternativeDomainNames {
return v;
}
public ArrayList<Seed> getSeedlist(int maxcount, boolean addMySeed) {
final ArrayList<Seed> v = new ArrayList<Seed>(this.seedActiveDB.size() + 1000);
// store own peer seed
if (addMySeed) v.add(this.mySeed);
// store active peer seeds
Seed ys;
Iterator<Seed> se = this.seedsConnected(true, false, null, (float) 0.0);
while (se.hasNext() && v.size() < maxcount) {
ys = se.next();
if (ys != null) v.add(ys);
}
// store some of the not-so-old passive peer seeds (limit: 1 day)
se = this.seedsDisconnected(true, false, null, (float) 0.0);
final long timeout = System.currentTimeMillis() - (1000L * 60L * 60L * 24L);
while (se.hasNext() && v.size() < maxcount) {
ys = se.next();
if (ys != null && ys.getLastSeenUTC() >= timeout) v.add(ys);
}
final StringBuilder encoded = new StringBuilder(1024);
for (Seed seed: v) {
encoded.append(seed.genSeedStr(null)).append(serverCore.CRLF_STRING);
}
return v;
}
protected String uploadSeedList(final yacySeedUploader uploader,
final serverSwitch sb,
final SeedDB seedDB,

@ -82,6 +82,7 @@ import java.util.zip.GZIPOutputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import org.apache.lucene.search.FieldCache;
import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.SolrInputDocument;
@ -2027,7 +2028,8 @@ public final class Switchboard extends serverSwitch {
// clear caches
if (WordCache.sizeCommonWords() > 1000) WordCache.clearCommonWords();
Word.clearCache();
// Domains.clear();
// Domains.clear();
FieldCache.DEFAULT.purgeAllCaches();
// clean up image stack
ResultImages.clearQueues();

@ -141,7 +141,12 @@ public class ResultEntry implements Comparable<ResultEntry>, Comparator<ResultEn
return (this.alternative_urlname == null) ? MultiProtocolURL.unescape(this.urlentry.url().toNormalform(true)) : this.alternative_urlname;
}
public String title() {
return this.urlentry.dc_title();
String titlestr = this.urlentry.dc_title();
// if title is empty use filename as title
if (titlestr.isEmpty()) { // if url has no filename, title is still empty (e.g. "www.host.com/" )
titlestr = this.urlentry.url() != null ? this.urlentry.url().getFileName() : "";
}
return titlestr;
}
public String publisher() {
// dc:publisher

Loading…
Cancel
Save