Skip to content

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

fixed webgraph postprocessing and status display in Crawler_p servlet

Michael Peter Christenb3b174e2b8da
diff --git a/htroot/api/status_p.java b/htroot/api/status_p.java
index 18f2ba541..72d84165d 100644
--- a/htroot/api/status_p.java
+++ b/htroot/api/status_p.java
@@ -27,7 +27,6 @@
import java.io.IOException;
-import net.yacy.cora.federate.solr.connector.AbstractSolrConnector;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.cora.util.Memory;
import net.yacy.crawler.CrawlSwitchboard;
@@ -40,6 +39,7 @@ import net.yacy.search.Switchboard;
import net.yacy.search.SwitchboardConstants;
import net.yacy.search.index.Fulltext;
import net.yacy.search.index.Segment;
+import net.yacy.search.schema.CollectionConfiguration;
import net.yacy.search.schema.CollectionSchema;
import net.yacy.search.schema.WebgraphSchema;
import net.yacy.server.serverObjects;
@@ -133,38 +133,31 @@ public class status_p {
prop.put("crawlProfiles_count", count);
prop.put("crawlProfiles", count == 0 ? 0 : 1);
- prop.put("postprocessingRunning", Switchboard.postprocessingRunning ? 1 : 0);
+ prop.put("postprocessingRunning", CollectionConfiguration.postprocessingRunning ? 1 : 0);
boolean processCollection = sb.index.fulltext().getDefaultConfiguration().contains(CollectionSchema.process_sxt) && (sb.index.connectedCitation() || sb.index.fulltext().useWebgraph());
boolean processWebgraph = sb.index.fulltext().getWebgraphConfiguration().contains(WebgraphSchema.process_sxt) && sb.index.fulltext().useWebgraph();
- long collectionTimeSinceStart = processCollection && Switchboard.postprocessingRunning ? System.currentTimeMillis() - Switchboard.postprocessingStartTime[0] : 0;
- long webgraphTimeSinceStart = processWebgraph && Switchboard.postprocessingRunning ? System.currentTimeMillis() - Switchboard.postprocessingStartTime[1] : 0;
-
- long collectionRemainingCount = 0;
- if (processCollection) try {collectionRemainingCount = sb.index.fulltext().getDefaultConnector().getCountByQuery(CollectionSchema.process_sxt.getSolrFieldName() + AbstractSolrConnector.CATCHALL_DTERM);} catch (IOException e) {}
- long collectionCountSinceStart = Switchboard.postprocessingRunning ? Switchboard.postprocessingCount[0] - collectionRemainingCount : 0;
- int collectionSpeed = collectionTimeSinceStart == 0 ? 0 : (int) (60000 * collectionCountSinceStart / collectionTimeSinceStart); // pages per minute
- long collectionRemainingTime = collectionSpeed == 0 ? 0 : 60000 * collectionRemainingCount / collectionSpeed; // millis
- int collectionRemainingTimeMinutes = (int) (collectionRemainingTime / 60000);
- int collectionRemainingTimeSeconds = (int) ((collectionRemainingTime - (collectionRemainingTimeMinutes * 60000)) / 1000);
-
- long webgraphRemainingCount = 0;
- if (processWebgraph) try {webgraphRemainingCount = sb.index.fulltext().getWebgraphConnector().getCountByQuery(WebgraphSchema.process_sxt.getSolrFieldName() + AbstractSolrConnector.CATCHALL_DTERM);} catch (IOException e) {}
- long webgraphCountSinceStart = Switchboard.postprocessingRunning ? Switchboard.postprocessingCount[1] - webgraphRemainingCount : 0;
- int webgraphSpeed = webgraphTimeSinceStart == 0 ? 0 : (int) (60000 * webgraphCountSinceStart / webgraphTimeSinceStart); // pages per minute
- long webgraphRemainingTime = webgraphSpeed == 0 ? 0 : 60000 * webgraphRemainingCount / webgraphSpeed; // millis
- int webgraphRemainingTimeMinutes = (int) (webgraphRemainingTime / 60000);
- int webgraphRemainingTimeSeconds = (int) ((webgraphRemainingTime - (webgraphRemainingTimeMinutes * 60000)) / 1000);
+ long timeSinceStart = (processCollection || processWebgraph) && CollectionConfiguration.postprocessingRunning ? System.currentTimeMillis() - CollectionConfiguration.postprocessingStartTime : 0;
+ //postprocessingCollection1Count = 0;
+ //postprocessingsWebgraphCount = 0;
+ long collectionRemainingCount = 0, webgraphRemainingCount = 0;
+ if (processCollection) try {collectionRemainingCount = sb.index.fulltext().getDefaultConnector().getCountByQuery(CollectionConfiguration.collection1query(sb.index, null));} catch (IOException e) {}
+ if (processWebgraph) try {webgraphRemainingCount = sb.index.fulltext().getWebgraphConnector().getCountByQuery(CollectionConfiguration.webgraphquery(sb.index, null));} catch (IOException e) {}
+ long countSinceStart = CollectionConfiguration.postprocessingRunning ? CollectionConfiguration.postprocessingCollection1Count + CollectionConfiguration.postprocessingWebgraphCount - collectionRemainingCount - webgraphRemainingCount : 0;
+ int speed = timeSinceStart == 0 ? 0 : (int) (60000 * countSinceStart / timeSinceStart); // pages per minute
+ long remainingTime = speed == 0 ? 0 : 60000 * collectionRemainingCount / speed; // millis
+ int remainingTimeMinutes = (int) (remainingTime / 60000);
+ int remainingTimeSeconds = (int) ((remainingTime - (remainingTimeMinutes * 60000)) / 1000);
prop.put("postprocessingCollectionRemainingCount", collectionRemainingCount);
prop.put("postprocessingWebgraphRemainingCount", webgraphRemainingCount);
- prop.put("postprocessingRunning_activity", collectionTimeSinceStart > 0 ? "collection" : "webgraph");
- prop.put("postprocessingSpeed", collectionTimeSinceStart > 0 ? collectionSpeed : webgraphSpeed);
- prop.put("postprocessingElapsedTime", collectionTimeSinceStart > 0 ? collectionTimeSinceStart : webgraphTimeSinceStart);
- prop.put("postprocessingRemainingTime", collectionTimeSinceStart > 0 ? collectionRemainingTime : webgraphRemainingTime);
- prop.put("postprocessingRemainingTimeMinutes", collectionTimeSinceStart > 0 ? collectionRemainingTimeMinutes : webgraphRemainingTimeMinutes);
- prop.put("postprocessingRemainingTimeSeconds", collectionTimeSinceStart > 0 ? collectionRemainingTimeSeconds : webgraphRemainingTimeSeconds);
+ prop.put("postprocessingRunning_activity", collectionRemainingCount == CollectionConfiguration.postprocessingCollection1Count && webgraphRemainingCount == CollectionConfiguration.postprocessingWebgraphCount ? "citation computation" : collectionRemainingCount == CollectionConfiguration.postprocessingCollection1Count ? "webgraph" : "collection");
+ prop.put("postprocessingSpeed", speed);
+ prop.put("postprocessingElapsedTime", timeSinceStart);
+ prop.put("postprocessingRemainingTime", remainingTime);
+ prop.put("postprocessingRemainingTimeMinutes", (remainingTimeMinutes < 10 ? "0" : "") + Integer.toString(remainingTimeMinutes));
+ prop.put("postprocessingRemainingTimeSeconds", (remainingTimeSeconds < 10 ? "0" : "") + Integer.toString(remainingTimeSeconds));
// return rewrite properties
return prop;
diff --git a/source/net/yacy/cora/federate/solr/SchemaConfiguration.java b/source/net/yacy/cora/federate/solr/SchemaConfiguration.java
index 9e46ee6fc..b98b0e738 100644
--- a/source/net/yacy/cora/federate/solr/SchemaConfiguration.java
+++ b/source/net/yacy/cora/federate/solr/SchemaConfiguration.java
@@ -145,7 +145,6 @@ public class SchemaConfiguration extends Configuration implements Serializable {
boolean changed = false;
// FIND OUT IF THIS IS A DOUBLE DOCUMENT
String hostid = url.hosthash();
- String protocol = url.getProtocol();
for (CollectionSchema[] checkfields: new CollectionSchema[][]{
{CollectionSchema.exact_signature_l, CollectionSchema.exact_signature_unique_b, CollectionSchema.exact_signature_copycount_i},
{CollectionSchema.fuzzy_signature_l, CollectionSchema.fuzzy_signature_unique_b, CollectionSchema.fuzzy_signature_copycount_i}}) {
diff --git a/source/net/yacy/search/Switchboard.java b/source/net/yacy/search/Switchboard.java
index 6e9d9c90e..42f769fad 100644
--- a/source/net/yacy/search/Switchboard.java
+++ b/source/net/yacy/search/Switchboard.java
@@ -2030,11 +2030,6 @@ public final class Switchboard extends serverSwitch {
return c;
}
- public static boolean postprocessingRunning = false;
- // if started, the following values are assigned for [collection1, webgraph]:
- public static long[] postprocessingStartTime = new long[]{0,0}; // the start time for the processing; not started = 0
- public static int[] postprocessingCount = new int[]{0,0}; // number of documents to be processed
-
public boolean cleanupJob() {
ConcurrentLog.ensureWorkerIsRunning();
@@ -2298,13 +2293,8 @@ public final class Switchboard extends serverSwitch {
if (allCrawlsFinished) {
if (postprocessing) {
// run postprocessing on all profiles
- postprocessingRunning = true;
- postprocessingStartTime[0] = System.currentTimeMillis();
- try {postprocessingCount[0] = (int) fulltext.getDefaultConnector().getCountByQuery(CollectionSchema.process_sxt.getSolrFieldName() + AbstractSolrConnector.CATCHALL_DTERM);} catch (IOException e) {}
ReferenceReportCache rrCache = index.getReferenceReportCache();
proccount += collection1Configuration.postprocessing(index, rrCache, null);
- postprocessingStartTime[0] = 0;
- try {postprocessingCount[0] = (int) fulltext.getDefaultConnector().getCountByQuery(CollectionSchema.process_sxt.getSolrFieldName() + AbstractSolrConnector.CATCHALL_DTERM);} catch (IOException e) {} // should be zero but you never know
this.index.fulltext().commit(true); // without a commit the success is not visible in the monitoring
}
this.crawler.cleanProfiles(this.crawler.getActiveProfiles());
@@ -2316,26 +2306,17 @@ public final class Switchboard extends serverSwitch {
if (cleanupByHarvestkey > 0) {
if (postprocessing) {
// run postprocessing on these profiles
- postprocessingRunning = true;
- postprocessingStartTime[0] = System.currentTimeMillis();
- try {postprocessingCount[0] = (int) fulltext.getDefaultConnector().getCountByQuery(CollectionSchema.process_sxt.getSolrFieldName() + AbstractSolrConnector.CATCHALL_DTERM);} catch (IOException e) {}
ReferenceReportCache rrCache = index.getReferenceReportCache();
for (String profileHash: deletionCandidates) proccount += collection1Configuration.postprocessing(index, rrCache, profileHash);
- postprocessingStartTime[0] = 0;
- try {postprocessingCount[0] = (int) fulltext.getDefaultConnector().getCountByQuery(CollectionSchema.process_sxt.getSolrFieldName() + AbstractSolrConnector.CATCHALL_DTERM);} catch (IOException e) {} // should be zero but you never know
this.index.fulltext().commit(true); // without a commit the success is not visible in the monitoring
}
this.crawler.cleanProfiles(deletionCandidates);
log.info("cleanup removed " + cleanupByHarvestkey + " crawl profiles, post-processed " + proccount + " documents");
}
}
-
- postprocessingStartTime = new long[]{0,0}; // the start time for the processing; not started = 0
- postprocessingRunning = false;
}
if (allCrawlsFinished) {
- postprocessingRunning = true;
// flush caches
Domains.clear();
this.crawlQueues.noticeURL.clear();
@@ -2357,8 +2338,7 @@ public final class Switchboard extends serverSwitch {
log.info("Solr auto-optimization: running solr.optimize(" + opts + ")");
fulltext.optimize(opts);
this.optimizeLastRun = System.currentTimeMillis();
- }
- postprocessingRunning = false;
+ }
}
// execute api actions; this must be done after postprocessing because
diff --git a/source/net/yacy/search/schema/CollectionConfiguration.java b/source/net/yacy/search/schema/CollectionConfiguration.java
index ea611012d..e121c34aa 100644
--- a/source/net/yacy/search/schema/CollectionConfiguration.java
+++ b/source/net/yacy/search/schema/CollectionConfiguration.java
@@ -887,7 +887,7 @@ public class CollectionConfiguration extends SchemaConfiguration implements Seri
// create a subgraph
if (!containsCanonical && webgraph != null) {
// a document with canonical tag should not get a webgraph relation, because that belongs to the canonical document
- List<SolrInputDocument> edges = webgraph.getEdges(subgraph, digestURL, responseHeader, collections, crawldepth, images, document.getAnchors(), sourceName);
+ List<SolrInputDocument> edges = webgraph.getEdges(subgraph, digestURL, responseHeader, collections, crawldepth, images, processTypes, document.getAnchors(), sourceName);
// this also enriched the subgraph
doc.webgraphDocuments.addAll(edges);
} else {
@@ -947,7 +947,7 @@ public class CollectionConfiguration extends SchemaConfiguration implements Seri
doc.setField(CollectionSchema.VOCABULARY_PREFIX + facetName + CollectionSchema.VOCABULARY_SUFFIX, facetValues.toArray(new String[facetValues.size()]));
}
- if (allAttr || contains(CollectionSchema.process_sxt)) {
+ if ((allAttr || contains(CollectionSchema.process_sxt)) && processTypes.size() > 0) {
List<String> p = new ArrayList<String>();
for (ProcessType t: processTypes) p.add(t.name());
add(doc, CollectionSchema.process_sxt, p);
@@ -958,6 +958,24 @@ public class CollectionConfiguration extends SchemaConfiguration implements Seri
return doc;
}
+ public static boolean postprocessingRunning = false;
+ // if started, the following values are assigned
+ public static long postprocessingStartTime = 0; // the start time for the processing; not started = 0
+ public static int postprocessingCollection1Count = 0; // number of documents to be processed
+ public static int postprocessingWebgraphCount = 0; // number of documents to be processed
+
+ public static final String collection1query(final Segment segment, final String harvestkey) {
+ return (harvestkey == null || !segment.fulltext().getDefaultConfiguration().contains(CollectionSchema.harvestkey_s) ?
+ "" :
+ CollectionSchema.harvestkey_s.getSolrFieldName() + ":\"" + harvestkey + "\" AND ") +
+ CollectionSchema.process_sxt.getSolrFieldName() + AbstractSolrConnector.CATCHALL_DTERM;
+ }
+ public static final String webgraphquery(final Segment segment, final String harvestkey) {
+ return (harvestkey == null || !segment.fulltext().getWebgraphConfiguration().contains(WebgraphSchema.harvestkey_s) ?
+ "" :
+ WebgraphSchema.harvestkey_s.getSolrFieldName() + ":\"" + harvestkey + "\" AND ") +
+ WebgraphSchema.process_sxt.getSolrFieldName() + AbstractSolrConnector.CATCHALL_DTERM;
+ }
/**
* post-processing steps for all entries that have a process tag assigned
@@ -974,17 +992,28 @@ public class CollectionConfiguration extends SchemaConfiguration implements Seri
final CollectionConfiguration collection = segment.fulltext().getDefaultConfiguration();
final WebgraphConfiguration webgraph = segment.fulltext().getWebgraphConfiguration();
-
+ // calculate the number of documents to be processed
+ String collection1query = collection1query(segment, harvestkey);
+ String webgraphquery = webgraphquery(segment, harvestkey);
+
+ try {
+ postprocessingCollection1Count = (int) collectionConnector.getCountByQuery(collection1query);
+ postprocessingWebgraphCount = segment.fulltext().useWebgraph() ? (int) segment.fulltext().getWebgraphConnector().getCountByQuery(webgraphquery) : 0;
+ } catch (IOException e) {
+ postprocessingCollection1Count = -1;
+ postprocessingWebgraphCount = -1;
+ }
+ postprocessingRunning = true;
+ postprocessingStartTime = System.currentTimeMillis();
+
// collect hosts from index which shall take part in citation computation
- String query = (harvestkey == null || !segment.fulltext().getDefaultConfiguration().contains(CollectionSchema.harvestkey_s) ? "" : CollectionSchema.harvestkey_s.getSolrFieldName() + ":\"" + harvestkey + "\" AND ") +
- CollectionSchema.process_sxt.getSolrFieldName() + AbstractSolrConnector.CATCHALL_DTERM;
- ReversibleScoreMap<String> hostscore;
+ ReversibleScoreMap<String> collection1hosts;
try {
- Map<String, ReversibleScoreMap<String>> hostfacet = collectionConnector.getFacets(query, 10000000, CollectionSchema.host_s.getSolrFieldName());
- hostscore = hostfacet.get(CollectionSchema.host_s.getSolrFieldName());
+ Map<String, ReversibleScoreMap<String>> hostfacet = collectionConnector.getFacets(collection1query, 10000000, CollectionSchema.host_s.getSolrFieldName());
+ collection1hosts = hostfacet.get(CollectionSchema.host_s.getSolrFieldName());
} catch (final IOException e2) {
ConcurrentLog.logException(e2);
- hostscore = new ClusteredScoreMap<String>();
+ collection1hosts = new ClusteredScoreMap<String>();
}
// create the ranking map
@@ -995,10 +1024,10 @@ public class CollectionConfiguration extends SchemaConfiguration implements Seri
(collection.contains(CollectionSchema.cr_host_count_i) &&
collection.contains(CollectionSchema.cr_host_chance_d) &&
collection.contains(CollectionSchema.cr_host_norm_i)))) try {
- int concurrency = Math.min(hostscore.size(), Runtime.getRuntime().availableProcessors());
- ConcurrentLog.info("CollectionConfiguration", "collecting " + hostscore.size() + " hosts, concurrency = " + concurrency);
+ int concurrency = Math.min(collection1hosts.size(), Runtime.getRuntime().availableProcessors());
+ ConcurrentLog.info("CollectionConfiguration", "collecting " + collection1hosts.size() + " hosts, concurrency = " + concurrency);
int countcheck = 0;
- for (String host: hostscore.keyList(true)) {
+ for (String host: collection1hosts.keyList(true)) {
// Patch the citation index for links with canonical tags.
// This shall fulfill the following requirement:
// If a document A links to B and B contains a 'canonical C', then the citation rank computation shall consider that A links to C and B does not link to C.
@@ -1042,7 +1071,7 @@ public class CollectionConfiguration extends SchemaConfiguration implements Seri
if (patchquerycount != patchquerycountcheck) ConcurrentLog.warn("CollectionConfiguration", "ambiguous patchquery count for host " + host + ": expected=" + patchquerycount + ", counted=" + patchquerycountcheck);
// do the citation rank computation
- if (hostscore.get(host) <= 0) continue;
+ if (collection1hosts.get(host) <= 0) continue;
// select all documents for each host
CRHost crh = new CRHost(segment, rrCache, host, 0.85d, 6);
int convergence_attempts = 0;
@@ -1065,10 +1094,10 @@ public class CollectionConfiguration extends SchemaConfiguration implements Seri
}
countcheck++;
}
- if (hostscore.size() != countcheck) ConcurrentLog.warn("CollectionConfiguration", "ambiguous host count: expected=" + hostscore.size() + ", counted=" + countcheck);
+ if (collection1hosts.size() != countcheck) ConcurrentLog.warn("CollectionConfiguration", "ambiguous host count: expected=" + collection1hosts.size() + ", counted=" + countcheck);
} catch (final IOException e2) {
ConcurrentLog.logException(e2);
- hostscore = new ClusteredScoreMap<String>();
+ collection1hosts = new ClusteredScoreMap<String>();
}
// process all documents at the webgraph for the outgoing links of this document
@@ -1077,17 +1106,27 @@ public class CollectionConfiguration extends SchemaConfiguration implements Seri
final Set<String> omitFields = new HashSet<String>();
omitFields.add(WebgraphSchema.process_sxt.getSolrFieldName());
omitFields.add(WebgraphSchema.harvestkey_s.getSolrFieldName());
+
+ // collect hosts from index which shall take part in citation computation
+ ReversibleScoreMap<String> webgraphhosts;
+ try {
+ Map<String, ReversibleScoreMap<String>> hostfacet = segment.fulltext().getWebgraphConnector().getFacets(webgraphquery, 10000000, WebgraphSchema.source_host_s.getSolrFieldName());
+ webgraphhosts = hostfacet.get(WebgraphSchema.source_host_s.getSolrFieldName());
+ } catch (final IOException e2) {
+ ConcurrentLog.logException(e2);
+ webgraphhosts = new ClusteredScoreMap<String>();
+ }
try {
final long start = System.currentTimeMillis();
- for (String host: hostscore.keyList(true)) {
- if (hostscore.get(host) <= 0) continue;
+ for (String host: webgraphhosts.keyList(true)) {
+ if (webgraphhosts.get(host) <= 0) continue;
final String hostfinal = host;
// select all webgraph edges and modify their cr value
- query = WebgraphSchema.source_host_s.getSolrFieldName() + ":\"" + host + "\" AND " + WebgraphSchema.process_sxt.getSolrFieldName() + AbstractSolrConnector.CATCHALL_DTERM;
- final long count = segment.fulltext().getWebgraphConnector().getCountByQuery(query);
+ String patchquery = WebgraphSchema.source_host_s.getSolrFieldName() + ":\"" + host + "\" AND " + WebgraphSchema.process_sxt.getSolrFieldName() + AbstractSolrConnector.CATCHALL_DTERM;
+ final long count = segment.fulltext().getWebgraphConnector().getCountByQuery(patchquery);
int concurrency = Math.min((int) count, Math.max(1, Runtime.getRuntime().availableProcessors() / 4));
ConcurrentLog.info("CollectionConfiguration", "collecting " + count + " documents from the webgraph, concurrency = " + concurrency);
- final BlockingQueue<SolrDocument> docs = segment.fulltext().getWebgraphConnector().concurrentDocumentsByQuery(query, WebgraphSchema.source_chars_i.getSolrFieldName() + " asc", 0, 100000000, Long.MAX_VALUE, 200, concurrency);
+ final BlockingQueue<SolrDocument> docs = segment.fulltext().getWebgraphConnector().concurrentDocumentsByQuery(patchquery, WebgraphSchema.source_chars_i.getSolrFieldName() + " asc", 0, 100000000, Long.MAX_VALUE, 200, concurrency);
final AtomicInteger proccount = new AtomicInteger(0);
Thread[] t = new Thread[concurrency];
for (final AtomicInteger i = new AtomicInteger(0); i.get() < t.length; i.incrementAndGet()) {
@@ -1101,27 +1140,30 @@ public class CollectionConfiguration extends SchemaConfiguration implements Seri
while ((doc = docs.take()) != AbstractSolrConnector.POISON_DOCUMENT) {
SolrInputDocument sid = webgraph.toSolrInputDocument(doc, omitFields);
Collection<Object> proctags = doc.getFieldValues(WebgraphSchema.process_sxt.getSolrFieldName());
- Set<ProcessType> process = new HashSet<ProcessType>();
- for (Object tag: proctags) {
+
+ for (Object tag: proctags) try {
+
+ // switch over tag types
ProcessType tagtype = ProcessType.valueOf((String) tag);
- process.add(tagtype);
- }
-
- // set cr values
- if (webgraph.contains(WebgraphSchema.source_id_s) && webgraph.contains(WebgraphSchema.source_cr_host_norm_i)) {
- id = (String) doc.getFieldValue(WebgraphSchema.source_id_s.getSolrFieldName());
- CRV crv = rankings.get(id);
- if (crv != null) {
- sid.setField(WebgraphSchema.source_cr_host_norm_i.getSolrFieldName(), crv.crn);
- }
- }
- if (webgraph.contains(WebgraphSchema.target_id_s) && webgraph.contains(WebgraphSchema.target_cr_host_norm_i)) {
- id = (String) doc.getFieldValue(WebgraphSchema.target_id_s.getSolrFieldName());
- CRV crv = rankings.get(id);
- if (crv != null) {
- sid.setField(WebgraphSchema.target_cr_host_norm_i.getSolrFieldName(), crv.crn);
+
+ // set cr values
+ if (tagtype == ProcessType.CITATION) {
+ if (webgraph.contains(WebgraphSchema.source_id_s) && webgraph.contains(WebgraphSchema.source_cr_host_norm_i)) {
+ id = (String) doc.getFieldValue(WebgraphSchema.source_id_s.getSolrFieldName());
+ CRV crv = rankings.get(id);
+ if (crv != null) {
+ sid.setField(WebgraphSchema.source_cr_host_norm_i.getSolrFieldName(), crv.crn);
+ }
+ }
+ if (webgraph.contains(WebgraphSchema.target_id_s) && webgraph.contains(WebgraphSchema.target_cr_host_norm_i)) {
+ id = (String) doc.getFieldValue(WebgraphSchema.target_id_s.getSolrFieldName());
+ CRV crv = rankings.get(id);
+ if (crv != null) {
+ sid.setField(WebgraphSchema.target_cr_host_norm_i.getSolrFieldName(), crv.crn);
+ }
+ }
}
- }
+ } catch (IllegalArgumentException e) {}
// write document back to index
try {
@@ -1158,8 +1200,6 @@ public class CollectionConfiguration extends SchemaConfiguration implements Seri
}
// process all documents in collection
- query = (harvestkey == null || !segment.fulltext().getDefaultConfiguration().contains(CollectionSchema.harvestkey_s) ? "" : CollectionSchema.harvestkey_s.getSolrFieldName() + ":\"" + harvestkey + "\" AND ") +
- CollectionSchema.process_sxt.getSolrFieldName() + AbstractSolrConnector.CATCHALL_DTERM;
Map<String, Long> hostExtentCache = new HashMap<String, Long>(); // a mapping from the host id to the number of documents which contain this host-id
Set<String> uniqueURLs = new HashSet<String>();
try {
@@ -1167,11 +1207,11 @@ public class CollectionConfiguration extends SchemaConfiguration implements Seri
omitFields.add(CollectionSchema.process_sxt.getSolrFieldName());
omitFields.add(CollectionSchema.harvestkey_s.getSolrFieldName());
int proccount = 0, proccount_referencechange = 0, proccount_citationchange = 0, proccount_uniquechange = 0;
- long count = collectionConnector.getCountByQuery(query);
+ long count = collectionConnector.getCountByQuery(collection1query);
long start = System.currentTimeMillis();
ConcurrentLog.info("CollectionConfiguration", "collecting " + count + " documents from the collection for harvestkey " + harvestkey);
BlockingQueue<SolrDocument> docs = collectionConnector.concurrentDocumentsByQuery(
- query,
+ collection1query,
CollectionSchema.host_subdomain_s.getSolrFieldName() + " asc," + // sort on subdomain to get hosts without subdomain first; that gives an opportunity to set www_unique_b flag to false
CollectionSchema.url_protocol_s.getSolrFieldName() + " asc," + // sort on protocol to get http before https; that gives an opportunity to set http_unique_b flag to false
CollectionSchema.url_chars_i.getSolrFieldName() + " asc",
@@ -1261,6 +1301,9 @@ public class CollectionConfiguration extends SchemaConfiguration implements Seri
ConcurrentLog.warn("CollectionConfiguration", e3.getMessage(), e3);
}
collectionConnector.commit(true); // make changes available directly to prevent that the process repeats again
+ postprocessingCollection1Count = 0;
+ postprocessingWebgraphCount = 0;
+ postprocessingRunning = false;
return allcount.get();
}
diff --git a/source/net/yacy/search/schema/WebgraphConfiguration.java b/source/net/yacy/search/schema/WebgraphConfiguration.java
index a32d7b27d..ce7d4bb06 100644
--- a/source/net/yacy/search/schema/WebgraphConfiguration.java
+++ b/source/net/yacy/search/schema/WebgraphConfiguration.java
@@ -31,7 +31,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.Iterator;
-import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -103,7 +102,7 @@ public class WebgraphConfiguration extends SchemaConfiguration implements Serial
public List<SolrInputDocument> getEdges(
final Subgraph subgraph,
final DigestURL source, final ResponseHeader responseHeader, Map<String, Pattern> collections, int crawldepth_source,
- final List<ImageEntry> images, final Collection<AnchorURL> links,
+ final List<ImageEntry> images, final Set<ProcessType> processTypes, final Collection<AnchorURL> links,
final String sourceName) {
boolean allAttr = this.isEmpty();
boolean generalNofollow = responseHeader == null ? false : responseHeader.get("X-Robots-Tag", "").indexOf("nofollow") >= 0;
@@ -111,7 +110,7 @@ public class WebgraphConfiguration extends SchemaConfiguration implements Serial
List<SolrInputDocument> edges = new ArrayList<SolrInputDocument>();
for (final AnchorURL target_url: links) {
SolrInputDocument edge = getEdge(
- subgraph, source, responseHeader, collections, crawldepth_source, images,
+ subgraph, source, responseHeader, collections, crawldepth_source, images, processTypes,
sourceName, allAttr, generalNofollow, target_order, target_url);
target_order++;
// add the edge to the subgraph
@@ -123,10 +122,9 @@ public class WebgraphConfiguration extends SchemaConfiguration implements Serial
public SolrInputDocument getEdge(
final Subgraph subgraph,
final DigestURL source_url, final ResponseHeader responseHeader, Map<String, Pattern> collections, int crawldepth_source,
- final List<ImageEntry> images,
+ final List<ImageEntry> images, final Set<ProcessType> processTypes,
final String sourceName, boolean allAttr, boolean generalNofollow, int target_order, AnchorURL target_url) {
- Set<ProcessType> processTypes = new LinkedHashSet<ProcessType>();
final String name = target_url.getNameProperty(); // the name attribute
final String text = target_url.getTextProperty(); // the text between the <a></a> tag
String rel = target_url.getRelProperty(); // the rel-attribute
@@ -284,7 +282,7 @@ public class WebgraphConfiguration extends SchemaConfiguration implements Serial
}
}
- if (allAttr || contains(WebgraphSchema.process_sxt)) {
+ if ((allAttr || contains(WebgraphSchema.process_sxt)) && processTypes.size() > 0) {
List<String> pr = new ArrayList<String>();
for (ProcessType t: processTypes) pr.add(t.name());
add(edge, WebgraphSchema.process_sxt, pr);