Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
added debug code
Michael Peter Christen899e7e92b0c7
diff --git a/defaults/yacy.init b/defaults/yacy.initindex ae70b9162..25769d1a8 100644--- a/defaults/yacy.init+++ b/defaults/yacy.init@@ -442,6 +442,7 @@ seedScpPath=peerCycle=2# debug flags+debug.search.profiling=falsedebug.search.local.dht.off=falsedebug.search.local.solr.off=falsedebug.search.remote.dht.off=falsediff --git a/source/net/yacy/cora/federate/solr/connector/EmbeddedSolrConnector.java b/source/net/yacy/cora/federate/solr/connector/EmbeddedSolrConnector.javaindex 10d36a9c9..7b5c104d5 100644--- a/source/net/yacy/cora/federate/solr/connector/EmbeddedSolrConnector.java+++ b/source/net/yacy/cora/federate/solr/connector/EmbeddedSolrConnector.java@@ -30,6 +30,7 @@ import java.util.concurrent.LinkedBlockingQueue;import net.yacy.cora.federate.solr.instance.EmbeddedInstance;import net.yacy.cora.federate.solr.instance.SolrInstance;import net.yacy.cora.util.ConcurrentLog;+import net.yacy.search.Switchboard;import net.yacy.search.schema.CollectionSchema;import org.apache.lucene.document.Document;@@ -245,6 +246,17 @@ public class EmbeddedSolrConnector extends SolrServerConnector implements SolrCo@Overridepublic Set<String> existsByIds(Set<String> ids) {+ boolean debug = Switchboard.getSwitchboard().getConfigBool("debug.search.profiling", false);+ long debugSingleTime = 0; int debugSingleCount = 0;+ if (debug) {+ // run this also with single exist queries which might be faster (but we don't know, thats the reason we test that here)+ long start = System.currentTimeMillis();+ Set <String> idsr = new HashSet<String>();+ for (String id: ids) if (existsById(id)) idsr.add(id);+ debugSingleTime = System.currentTimeMillis() - start;+ debugSingleCount = idsr.size();+ }+ long start = System.currentTimeMillis();if (ids == null || ids.size() == 0) return new HashSet<String>();if (ids.size() == 1) return existsById(ids.iterator().next()) ? ids : new HashSet<String>();StringBuilder sb = new StringBuilder(); // construct something like "({!raw f=id}Ij7B63g-gSHA) OR ({!raw f=id}PBcGI3g-gSHA)"@@ -267,6 +279,10 @@ public class EmbeddedSolrConnector extends SolrServerConnector implements SolrCo} finally {docListSearcher.close();}+ long debugCollectionTime = System.currentTimeMillis() - start;+ if (debug) {+ ConcurrentLog.info("EmbeddedSolrConnector", "Comparisment of existsByIds: input=" + ids.size() + " records, output=" + idsr.size() + " records, singleTime=" + debugSingleTime + ", collectionTime=" + debugCollectionTime + ", singleCount=" + debugSingleCount + ", collectionCount=" + idsr.size());+ }// construct a new id list from thatreturn idsr;}