Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
minor fixes, some generics
orbitere2e7f065e934
diff --git a/source/de/anomic/kelondro/kelondroRowSet.java b/source/de/anomic/kelondro/kelondroRowSet.javaindex 11296db64..412108f85 100644--- a/source/de/anomic/kelondro/kelondroRowSet.java+++ b/source/de/anomic/kelondro/kelondroRowSet.java@@ -33,7 +33,7 @@ import de.anomic.server.logging.serverLog;public class kelondroRowSet extends kelondroRowCollection implements kelondroIndex {- private static final int collectionReSortLimit = 300;+ private static final int collectionReSortLimit = 400;private kelondroProfile profile;@@ -144,6 +144,10 @@ public class kelondroRowSet extends kelondroRowCollection implements kelondroIndif (rowdef.objectOrder == null) return iterativeSearch(a, astart, alength, 0, this.chunkcount);+ if ((this.chunkcount - this.sortBound) > (collectionReSortLimit << 1)) {+ sort();+ }+if ((this.rowdef.objectOrder != null) && (this.rowdef.objectOrder instanceof kelondroBase64Order) && (this.sortBound > 4000)) {// first try to find in sorted areafinal byte[] compiledPivot = compilePivot(a, astart, alength);diff --git a/source/de/anomic/plasma/plasmaCrawlBalancer.java b/source/de/anomic/plasma/plasmaCrawlBalancer.javaindex bc29b019c..c64af7c18 100644--- a/source/de/anomic/plasma/plasmaCrawlBalancer.java+++ b/source/de/anomic/plasma/plasmaCrawlBalancer.java@@ -465,7 +465,7 @@ public class plasmaCrawlBalancer {assert delta >= 0: "delta = " + delta;int s = urlFileIndex.size();kelondroRow.Entry rowEntry = urlFileIndex.remove(result.getBytes(), false);- assert (rowEntry != null) && (urlFileIndex.size() + 1 == s) : "urlFileIndex.size() = " + urlFileIndex.size() + ", s = " + s + ", result = " + result;+ assert (rowEntry == null) || (urlFileIndex.size() + 1 == s) : "urlFileIndex.size() = " + urlFileIndex.size() + ", s = " + s + ", result = " + result;if (rowEntry == null) {serverLog.logSevere("PLASMA BALANCER", "get() found a valid urlhash, but failed to fetch the corresponding url entry - total size = " + size() + ", fileStack.size() = " + urlFileStack.size() + ", ramStack.size() = " + urlRAMStack.size() + ", domainStacks.size() = " + domainStacks.size());return null;diff --git a/source/de/anomic/yacy/yacySearch.java b/source/de/anomic/yacy/yacySearch.javaindex 2b453dce0..04c448bce 100644--- a/source/de/anomic/yacy/yacySearch.java+++ b/source/de/anomic/yacy/yacySearch.java@@ -120,9 +120,9 @@ public class yacySearch extends Thread {}}- public static String set2string(Set hashes) {+ public static String set2string(Set<String> hashes) {String wh = "";- final Iterator iter = hashes.iterator();+ final Iterator<String> iter = hashes.iterator();while (iter.hasNext()) { wh = wh + (String) iter.next(); }return wh;}@@ -139,28 +139,28 @@ public class yacySearch extends Thread {return targetPeer;}- private static yacySeed[] selectClusterPeers(TreeMap peerhashes) {- Iterator i = peerhashes.entrySet().iterator();- ArrayList l = new ArrayList();- Map.Entry entry;+ private static yacySeed[] selectClusterPeers(TreeMap<String, String> peerhashes) {+ Iterator<Map.Entry<String, String>> i = peerhashes.entrySet().iterator();+ ArrayList<yacySeed> l = new ArrayList<yacySeed>();+ Map.Entry<String, String> entry;yacySeed s;while (i.hasNext()) {- entry = (Map.Entry) i.next();- s = yacyCore.seedDB.get((String) entry.getKey()); // should be getConnected; get only during testing time+ entry = i.next();+ s = yacyCore.seedDB.get(entry.getKey()); // should be getConnected; get only during testing timeif (s != null) {- s.setAlternativeAddress((String) entry.getValue());+ s.setAlternativeAddress(entry.getValue());l.add(s);}}yacySeed[] result = new yacySeed[l.size()];for (int j = 0; j < l.size(); j++) {- result[j] = (yacySeed) l.get(j);+ result[j] = l.get(j);}return result;//return (yacySeed[]) l.toArray();}- private static yacySeed[] selectSearchTargets(Set wordhashes, int seedcount) {+ private static yacySeed[] selectSearchTargets(Set<String> wordhashes, int seedcount) {// find out a specific number of seeds, that would be relevant for the given word hash(es)// the result is ordered by relevance: [0] is most relevant// the seedcount is the maximum number of wanted results@@ -171,15 +171,15 @@ public class yacySearch extends Thread {// put in seeds according to dhtfinal kelondroMScoreCluster<String> ranking = new kelondroMScoreCluster<String>();- final HashMap seeds = new HashMap();+ final HashMap<String, yacySeed> seeds = new HashMap<String, yacySeed>();yacySeed seed;- Iterator dhtEnum;+ Iterator<yacySeed> dhtEnum;int c;String wordhash;double distance;- Iterator iter = wordhashes.iterator();+ Iterator<String> iter = wordhashes.iterator();while (iter.hasNext()) {- wordhash = (String) iter.next();+ wordhash = iter.next();dhtEnum = yacyCore.dhtAgent.getDHTSeeds(true, wordhash, (float) 0.0);c = seedcount;while (dhtEnum.hasNext() && c > 0) {@@ -200,7 +200,7 @@ public class yacySearch extends Thread {int score;if (c > yacyCore.seedDB.sizeConnected()) { c = yacyCore.seedDB.sizeConnected(); }while (dhtEnum.hasNext() && c > 0) {- seed = (yacySeed) dhtEnum.next();+ seed = dhtEnum.next();if (seed == null) continue;if (!seed.getFlagAcceptRemoteIndex()) continue; // probably a robinson peerscore = (int) Math.round(Math.random() * ((c / 3) + 3));@@ -214,7 +214,7 @@ public class yacySearch extends Thread {// or seeds that are newbies to ensure that public demonstrations always workdhtEnum = yacyCore.seedDB.seedsConnected(true, false, null, (float) 0.50);while (dhtEnum.hasNext()) {- seed = (yacySeed) dhtEnum.next();+ seed = dhtEnum.next();if (seed == null) continue;if (seed.matchPeerTags(wordhashes)) { // access robinson peers with matching tagserverLog.logInfo("PLASMA", "selectPeers/PeerTags: " + seed.hash + ":" + seed.getName() + ", is specialized peer for " + seed.getPeerTags().toString());