mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
more bugfixes (also for latest commit)
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7202 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
parent
be6b48311c
commit
e54cb7fb0c
|
@ -517,6 +517,7 @@ public final class SearchEvent {
|
|||
if (checkedPeers.contains(peer)) continue; // do not ask a peer again
|
||||
urls = 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);
|
||||
|
|
|
@ -309,7 +309,7 @@ public class ImageReferenceVars extends AbstractReference implements ImageRefere
|
|||
if (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 ImageRefere
|
|||
if (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;
|
||||
|
|
|
@ -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 WordReferenc
|
|||
posinphrase, 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 WordReferenc
|
|||
final int hitcount, // how often appears this word in the text
|
||||
final int wordcount, // total number of words
|
||||
final 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 reference
|
||||
final int posinphrase, // position of word in its phrase
|
||||
final int posofphrase, // number of the phrase where word appears
|
||||
final long lastmodified, // last-modified time of the document where word appears
|
||||
|
@ -96,7 +98,7 @@ public class WordReferenceVars extends AbstractReference implements WordReferenc
|
|||
this.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 WordReferenc
|
|||
if (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 WordReferenc
|
|||
if (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;
|
||||
|
|
|
@ -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(ArrayList<Integer> a) {
|
||||
protected static int max(List<Integer> a, List<Integer> b) {
|
||||
assert a != null;
|
||||
assert !a.isEmpty();
|
||||
if (a.size() == 0) return max(b);
|
||||
if (b.size() == 0) return max(a);
|
||||
return Math.max(max(a), max(b));
|
||||
}
|
||||
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;
|
||||
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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user