Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
more bugfixes (also for latest commit)
orbitere54cb7fb0ce4
diff --git a/source/de/anomic/search/SearchEvent.java b/source/de/anomic/search/SearchEvent.javaindex eadf685db..a9e4f9a44 100644--- a/source/de/anomic/search/SearchEvent.java+++ b/source/de/anomic/search/SearchEvent.java@@ -517,6 +517,7 @@ public final class SearchEvent {if (checkedPeers.contains(peer)) continue; // do not ask a peer againurls = entry.getValue();words = wordsFromPeer(peer, urls);+ if (words.length() == 0) continue; // ???assert words.length() >= 12 : "words = " + words;//System.out.println("DEBUG-INDEXABSTRACT ***: peer " + peer + " has urls: " + urls + " from words: " + words);rankedCache.moreFeeders(1);diff --git a/source/net/yacy/kelondro/data/image/ImageReferenceVars.java b/source/net/yacy/kelondro/data/image/ImageReferenceVars.javaindex 671252ca7..0e4e46357 100644--- a/source/net/yacy/kelondro/data/image/ImageReferenceVars.java+++ b/source/net/yacy/kelondro/data/image/ImageReferenceVars.java@@ -309,7 +309,7 @@ public class ImageReferenceVars extends AbstractReference implements ImageRefereif (this.virtualAge > (v = other.virtualAge)) this.virtualAge = v;if (this.wordsintext > (v = other.wordsintext)) this.wordsintext = v;if (this.phrasesintext > (v = other.phrasesintext)) this.phrasesintext = v;- if (other.positions != null) a(this.positions, Math.min(min(this.positions), min(other.positions)));+ if (other.positions != null) a(this.positions, min(this.positions, other.positions));if (this.posinphrase > (v = other.posinphrase)) this.posinphrase = v;if (this.posofphrase > (v = other.posofphrase)) this.posofphrase = v;if (this.lastModified > (w = other.lastModified)) this.lastModified = w;@@ -331,7 +331,7 @@ public class ImageReferenceVars extends AbstractReference implements ImageRefereif (this.virtualAge < (v = other.virtualAge)) this.virtualAge = v;if (this.wordsintext < (v = other.wordsintext)) this.wordsintext = v;if (this.phrasesintext < (v = other.phrasesintext)) this.phrasesintext = v;- if (other.positions != null) a(this.positions, Math.max(max(this.positions), max(other.positions)));+ if (other.positions != null) a(this.positions, max(this.positions, other.positions));if (this.posinphrase < (v = other.posinphrase)) this.posinphrase = v;if (this.posofphrase < (v = other.posofphrase)) this.posofphrase = v;if (this.lastModified < (w = other.lastModified)) this.lastModified = w;diff --git a/source/net/yacy/kelondro/data/word/WordReferenceVars.java b/source/net/yacy/kelondro/data/word/WordReferenceVars.javaindex a9f14f2f0..ffab3d7c8 100644--- a/source/net/yacy/kelondro/data/word/WordReferenceVars.java+++ b/source/net/yacy/kelondro/data/word/WordReferenceVars.java@@ -27,7 +27,9 @@package net.yacy.kelondro.data.word;import java.util.ArrayList;+import java.util.Collections;import java.util.Comparator;+import java.util.List;import java.util.concurrent.BlockingQueue;import java.util.concurrent.LinkedBlockingQueue;import java.util.concurrent.Semaphore;@@ -60,7 +62,7 @@ public class WordReferenceVars extends AbstractReference implements WordReferencposinphrase, posofphrase,urlcomps, urllength, virtualAge,wordsintext, wordsintitle;- private final ArrayList<Integer> positions;+ private final List<Integer> positions;public double termFrequency;public WordReferenceVars(@@ -71,7 +73,7 @@ public class WordReferenceVars extends AbstractReference implements WordReferencfinal int hitcount, // how often appears this word in the textfinal int wordcount, // total number of wordsfinal int phrasecount, // total number of phrases- final ArrayList<Integer> ps, // positions of words that are joined into the reference+ final List<Integer> ps, // positions of words that are joined into the referencefinal int posinphrase, // position of word in its phrasefinal int posofphrase, // number of the phrase where word appearsfinal long lastmodified, // last-modified time of the document where word appears@@ -96,7 +98,7 @@ public class WordReferenceVars extends AbstractReference implements WordReferencthis.llocal = outlinksSame;this.lother = outlinksOther;this.phrasesintext = phrasecount;- this.positions = new ArrayList<Integer>(ps.size());+ this.positions = Collections.synchronizedList(new ArrayList<Integer>(ps.size()));for (int i = 0; i < ps.size(); i++) this.positions.add(ps.get(i));this.posinphrase = posinphrase;this.posofphrase = posofphrase;@@ -317,7 +319,7 @@ public class WordReferenceVars extends AbstractReference implements WordReferencif (this.virtualAge > (v = other.virtualAge)) this.virtualAge = v;if (this.wordsintext > (v = other.wordsintext)) this.wordsintext = v;if (this.phrasesintext > (v = other.phrasesintext)) this.phrasesintext = v;- if (other.positions != null) a(this.positions, Math.min(min(this.positions), min(other.positions)));+ if (other.positions != null) a(this.positions, min(this.positions, other.positions));if (this.posinphrase > (v = other.posinphrase)) this.posinphrase = v;if (this.posofphrase > (v = other.posofphrase)) this.posofphrase = v;if (this.lastModified > (w = other.lastModified)) this.lastModified = w;@@ -339,7 +341,7 @@ public class WordReferenceVars extends AbstractReference implements WordReferencif (this.virtualAge < (v = other.virtualAge)) this.virtualAge = v;if (this.wordsintext < (v = other.wordsintext)) this.wordsintext = v;if (this.phrasesintext < (v = other.phrasesintext)) this.phrasesintext = v;- if (other.positions != null) a(this.positions, Math.max(max(this.positions), max(other.positions)));+ if (other.positions != null) a(this.positions, max(this.positions, other.positions));if (this.posinphrase < (v = other.posinphrase)) this.posinphrase = v;if (this.posofphrase < (v = other.posofphrase)) this.posofphrase = v;if (this.lastModified < (w = other.lastModified)) this.lastModified = w;diff --git a/source/net/yacy/kelondro/rwi/AbstractReference.java b/source/net/yacy/kelondro/rwi/AbstractReference.javaindex 8c2ab30ba..cffb7fbfd 100644--- a/source/net/yacy/kelondro/rwi/AbstractReference.java+++ b/source/net/yacy/kelondro/rwi/AbstractReference.java@@ -26,28 +26,48 @@package net.yacy.kelondro.rwi;-import java.util.ArrayList;+import java.util.List;public abstract class AbstractReference implements Reference {- protected static void a(ArrayList<Integer> a, int i) {+ protected static void a(List<Integer> a, int i) {assert a != null;- a.clear();- a.add(i);+ if (i < 0) return; // signal for 'do nothing'+ synchronized (a) {+ a.clear();+ a.add(i);+ }+ }+ protected static int max(List<Integer> a, List<Integer> b) {+ assert a != null;+ if (a.size() == 0) return max(b);+ if (b.size() == 0) return max(a);+ return Math.max(max(a), max(b));}- protected static int max(ArrayList<Integer> a) {+ protected static int min(List<Integer> a, List<Integer> b) {+ assert a != null;+ if (a.size() == 0) return min(b);+ if (b.size() == 0) return min(a);+ int ma = min(a);+ int mb = min(b);+ if (ma == -1) return mb;+ if (mb == -1) return ma;+ return Math.min(ma, mb);+ }++ private static int max(List<Integer> a) {assert a != null;- assert !a.isEmpty();+ if (a.size() == 0) return -1;if (a.size() == 1) return a.get(0);if (a.size() == 2) return Math.max(a.get(0), a.get(1));int r = a.get(0);for (int i = 1; i < a.size(); i++) if (a.get(i) > r) r = a.get(i);return r;}- protected static int min(ArrayList<Integer> a) {+ private static int min(List<Integer> a) {assert a != null;- assert !a.isEmpty();+ if (a.size() == 0) return -1;if (a.size() == 1) return a.get(0);if (a.size() == 2) return Math.min(a.get(0), a.get(1));int r = a.get(0);