Skip to content

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

- warning instead of NPE if urlHash is not in index of CrawResults - times of LOCAL_SEARCH are shown in milliseconds

danielre12438142e4b
diff --git a/htroot/CrawlResults.java b/htroot/CrawlResults.java
index d453693ec..16204ce7d 100644
--- a/htroot/CrawlResults.java
+++ b/htroot/CrawlResults.java
@@ -169,15 +169,21 @@ public class CrawlResults {
// serverLog.logFinest("PLASMA", "plasmaCrawlLURL/genTableProps urlHash=" + urlHash);
try {
urle = sb.webIndex.getURL(urlHash, null, 0);
- indexURLReference.Components comp = urle.comp();
+ if(urle == null) {
+ serverLog.logWarning("PLASMA", "CrawlResults: URL not in index for crawl result "+ i +" with hash "+ urlHash);
+ urlstr = null;
+ urltxt = null;
+ cachepath = null;
+ } else {
+ indexURLReference.Components comp = urle.comp();
+ urlstr = comp.url().toNormalform(false, true);
+ urltxt = nxTools.shortenURLString(urlstr, 72); // shorten the string text like a URL
+ cachepath = plasmaHTCache.getCachePath(new yacyURL(urlstr, null)).toString().replace('\\', '/').substring(plasmaHTCache.cachePath.toString().length() + 1);
+ }
// serverLog.logFinest("PLASMA", "plasmaCrawlLURL/genTableProps urle=" + urle.toString());
initiatorSeed = sb.webIndex.seedDB.getConnected(initiatorHash);
executorSeed = sb.webIndex.seedDB.getConnected(executorHash);
- urlstr = comp.url().toNormalform(false, true);
- urltxt = nxTools.shortenURLString(urlstr, 72); // shorten the string text like a URL
- cachepath = plasmaHTCache.getCachePath(new yacyURL(urlstr, null)).toString().replace('\\', '/').substring(plasmaHTCache.cachePath.toString().length() + 1);
-
prop.put("table_indexed_" + cnt + "_dark", (dark) ? "1" : "0");
if (showControl) {
prop.put("table_indexed_" + cnt + "_showControl", "1");
diff --git a/htroot/yacy/user/ysearch.java b/htroot/yacy/user/ysearch.java
index 0662fd64a..821758925 100644
--- a/htroot/yacy/user/ysearch.java
+++ b/htroot/yacy/user/ysearch.java
@@ -228,16 +228,16 @@ public class ysearch {
plasmaSearchEvent theSearch = plasmaSearchEvent.getEvent(theQuery, ranking, sb.webIndex, sb.crawlResults, (sb.isRobinsonMode()) ? sb.clusterhashes : null, false);
// generate result object
- serverLog.logFine("LOCAL_SEARCH", "SEARCH TIME AFTER ORDERING OF SEARCH RESULTS: " + ((System.currentTimeMillis() - timestamp) / 1000) + " seconds");
- serverLog.logFine("LOCAL_SEARCH", "SEARCH TIME AFTER RESULT PREPARATION: " + ((System.currentTimeMillis() - timestamp) / 1000) + " seconds");
+ //serverLog.logFine("LOCAL_SEARCH", "SEARCH TIME AFTER ORDERING OF SEARCH RESULTS: " + (System.currentTimeMillis() - timestamp) + " ms");
+ //serverLog.logFine("LOCAL_SEARCH", "SEARCH TIME AFTER RESULT PREPARATION: " + (System.currentTimeMillis() - timestamp) + " ms");
// calc some more cross-reference
- serverLog.logFine("LOCAL_SEARCH", "SEARCH TIME AFTER XREF PREPARATION: " + ((System.currentTimeMillis() - timestamp) / 1000) + " seconds");
+ //serverLog.logFine("LOCAL_SEARCH", "SEARCH TIME AFTER XREF PREPARATION: " + (System.currentTimeMillis() - timestamp) + " ms");
// log
serverLog.logInfo("LOCAL_SEARCH", "EXIT WORD SEARCH: " + theQuery.queryString + " - " +
(theSearch.getRankingResult().getLocalResourceSize() + theSearch.getRankingResult().getRemoteResourceSize()) + " links found, " +
- ((System.currentTimeMillis() - timestamp) / 1000) + " seconds");
+ (System.currentTimeMillis() - timestamp) + " ms");
// prepare search statistics
theQuery.resultcount = theSearch.getRankingResult().getLocalResourceSize() + theSearch.getRankingResult().getRemoteResourceSize();