Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

fix for term iteration

orbiter45e497a9bd63
diff --git a/source/net/yacy/cora/ranking/Rating.java b/source/net/yacy/cora/ranking/Rating.java
index e1a1c67f2..6b8fc80c7 100644
--- a/source/net/yacy/cora/ranking/Rating.java
+++ b/source/net/yacy/cora/ranking/Rating.java
@@ -48,19 +48,8 @@ public class Rating<A> {
return this.object;
}
- @SuppressWarnings("rawtypes")
- public final static ObjectComparator<?> objectComparator = new ObjectComparator();
public final static ScoreComparator scoreComparator = new ScoreComparator();
- public static class ObjectComparator<B> implements Comparator<Rating<B>> {
-
- @SuppressWarnings("unchecked")
- public int compare(final Rating<B> arg0, final Rating<B> arg1) {
- if (!(arg0 instanceof Comparable<?>)) throw new UnsupportedOperationException("object class must implement comparable");
- return ((Comparable<B>) arg0.getObject()).compareTo(arg1.getObject());
- }
- }
-
public static class ScoreComparator implements Comparator<Rating<?>> {
public int compare(final Rating<?> arg0, final Rating<?> arg1) {
diff --git a/source/net/yacy/kelondro/rwi/IndexCell.java b/source/net/yacy/kelondro/rwi/IndexCell.java
index de48ee3fc..0f80d1b32 100644
--- a/source/net/yacy/kelondro/rwi/IndexCell.java
+++ b/source/net/yacy/kelondro/rwi/IndexCell.java
@@ -34,7 +34,6 @@ import java.util.TreeMap;
import net.yacy.cora.ranking.Order;
import net.yacy.cora.ranking.Rating;
-import net.yacy.cora.ranking.RatingOrder;
import net.yacy.cora.storage.ComparableARC;
import net.yacy.kelondro.data.meta.URIMetadataRow;
import net.yacy.kelondro.index.HandleSet;
@@ -453,19 +452,7 @@ public final class IndexCell<ReferenceType extends Reference> extends AbstractBu
}
public CloneableIterator<Rating<byte[]>> referenceCountIterator(final byte[] starttermHash, final boolean rot) {
- final RatingOrder<byte[]> containerOrder = new RatingOrder<byte[]>(this.ram.rowdef().getOrdering());
- containerOrder.rotate(new Rating<byte[]>(starttermHash, 0));
- return new MergeIterator<Rating<byte[]>>(
- this.ram.referenceCountIterator(starttermHash, rot),
- new MergeIterator<Rating<byte[]>>(
- this.ram.referenceCountIterator(starttermHash, false),
- this.array.referenceCountIterator(starttermHash, false),
- containerOrder,
- ReferenceContainer.containerMergeMethod,
- true),
- containerOrder,
- ReferenceContainer.containerMergeMethod,
- true);
+ return this.array.referenceCountIterator(starttermHash, false);
}
public CloneableIterator<ReferenceContainer<ReferenceType>> referenceContainerIterator(final byte[] starttermHash, final boolean rot) {
diff --git a/source/net/yacy/kelondro/rwi/ReferenceContainer.java b/source/net/yacy/kelondro/rwi/ReferenceContainer.java
index 725cfaca5..0e5b2b06f 100644
--- a/source/net/yacy/kelondro/rwi/ReferenceContainer.java
+++ b/source/net/yacy/kelondro/rwi/ReferenceContainer.java
@@ -216,9 +216,12 @@ public class ReferenceContainer<ReferenceType extends Reference> extends RowSet
}
public static Object mergeUnique(final Object a, final Object b) throws RowSpaceExceededException {
- final ReferenceContainer<?> c = (ReferenceContainer<?>) a;
- c.addAllUnique((ReferenceContainer<?>) b);
- return c;
+ if (a instanceof ReferenceContainer<?>) {
+ final ReferenceContainer<?> c = (ReferenceContainer<?>) a;
+ c.addAllUnique((ReferenceContainer<?>) b);
+ return c;
+ }
+ throw new UnsupportedOperationException("Objects have wrong type: " + a.getClass().getName());
}
public static final Method containerMergeMethod;
diff --git a/source/net/yacy/kelondro/rwi/ReferenceContainerCache.java b/source/net/yacy/kelondro/rwi/ReferenceContainerCache.java
index 95dd7bf3b..92dff501d 100644
--- a/source/net/yacy/kelondro/rwi/ReferenceContainerCache.java
+++ b/source/net/yacy/kelondro/rwi/ReferenceContainerCache.java
@@ -185,7 +185,6 @@ public final class ReferenceContainerCache<ReferenceType extends Reference> exte
if (entry.getValue() != null && entry.getValue().getTermHash() != null) list.add(new Rating<ByteArray>(entry.getKey(), entry.getValue().size()));
}
}
- Collections.sort(list, new Rating.ObjectComparator<ByteArray>());
return list;
}