Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
catch rwi ranking div by zero exception during rwi search result processing worddistance calculation is effected by concurrent update (normalization) of min/max ranking parameter for wordpositions. On update of min/max the exception is raised in distance calc and now catched. This concurrent update and change of ranking results is needed for speed but should be further checked for optimization
reger4c67ed3f8d82
diff --git a/source/net/yacy/kelondro/rwi/AbstractReference.java b/source/net/yacy/kelondro/rwi/AbstractReference.javaindex 4417159d0..d972b4e29 100644--- a/source/net/yacy/kelondro/rwi/AbstractReference.java+++ b/source/net/yacy/kelondro/rwi/AbstractReference.java@@ -28,6 +28,7 @@ package net.yacy.kelondro.rwi;import java.util.Collection;import java.util.Iterator;+import net.yacy.cora.util.ConcurrentLog;public abstract class AbstractReference implements Reference {@@ -128,7 +129,15 @@ public abstract class AbstractReference implements Reference {}// despite first line checks for size < 2 Arithmetic exception div by zero occured (1.91/9278 2016-10-19)// added d == 0 condition as protection for this (which was in all above tests the case)- return d == 0 ? 0 : d / (positions().size() - 1);+ try {+ return d == 0 ? 0 : d / (positions().size() - 1);+ } catch (ArithmeticException ex) {+ // TODO: in peer to peer normalization of rwi queue modifies concurrently positions resulting in div by 0 exception+ // with effect of above check position() < 2 is false but now true, it also results in changing ranking results until normalization is finished+ // see related/causing code ReferenceOrder.normalizewith() and WordReferenceVars.max()/WordReferenceVars.min() -> refacturing of posintext, distance, min, max needed+ ConcurrentLog.fine("AbstractReference", "word distance calculation:" + ex.getMessage());+ return 0;+ }}@Override