Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
added new field host_extent_i which, after a crawl and postprocessing, holds the number of documents for the host where the document is hosted. This is necessary for ranking and the norming of references per local host in the ranking computation.
Michael Peter Christen27d622288068
diff --git a/defaults/solr.collection.schema b/defaults/solr.collection.schemaindex 07d2b229a..be104511b 100644--- a/defaults/solr.collection.schema+++ b/defaults/solr.collection.schema@@ -337,6 +337,9 @@ host_organization_s## the remaining part of the host without organizationdnc#host_subdomain_s+## number of documents from the same host; can be used to measure references_internal_i for likelihood computation, integer+host_extent_i+## number of titles (counting the 'title' field) in the document#title_count_idiff --git a/defaults/yacy.init b/defaults/yacy.initindex b97f077e0..552414b0e 100644--- a/defaults/yacy.init+++ b/defaults/yacy.init@@ -957,7 +957,7 @@ search.ranking.rwi.profile =# The field boostfunctionmode can be either 'add' or 'multiply' to describe the mode.# All boost methods > 0 must have names to be able to select this name with a query, with the syntax /namesearch.ranking.solr.collection.boostname.tmp.0=_default-search.ranking.solr.collection.boostfields.tmp.0=text_t^2.0,url_paths_sxt^20.0,title^100.0,synonyms_sxt^1.0+search.ranking.solr.collection.boostfields.tmp.0=text_t^2.0,url_paths_sxt^50.0,title^100.0,synonyms_sxt^1.0search.ranking.solr.collection.boostquery.tmp.0=fuzzy_signature_unique_b:true^100000.0search.ranking.solr.collection.boostfunction.tmp.0=search.ranking.solr.collection.boostfunctionmode.tmp.0=adddiff --git a/htroot/IndexControlRWIs_p.java b/htroot/IndexControlRWIs_p.javaindex 036b06919..c1035007a 100644--- a/htroot/IndexControlRWIs_p.java+++ b/htroot/IndexControlRWIs_p.java@@ -35,7 +35,6 @@ import java.util.List;import net.yacy.cora.date.GenericFormatter;import net.yacy.cora.document.ASCII;-import net.yacy.cora.document.analysis.Classification;import net.yacy.cora.document.analysis.Classification.ContentDomain;import net.yacy.cora.federate.yacy.CacheStrategy;import net.yacy.cora.protocol.RequestHeader;@@ -70,7 +69,6 @@ import net.yacy.search.query.QueryParams;import net.yacy.search.query.SearchEvent;import net.yacy.search.query.SearchEventCache;import net.yacy.search.ranking.BlockRank;-import net.yacy.search.ranking.RankingProfile;import net.yacy.server.serverObjects;import net.yacy.server.serverSwitch;diff --git a/source/net/yacy/cora/federate/solr/SchemaConfiguration.java b/source/net/yacy/cora/federate/solr/SchemaConfiguration.javaindex aadc2bd72..14387752e 100644--- a/source/net/yacy/cora/federate/solr/SchemaConfiguration.java+++ b/source/net/yacy/cora/federate/solr/SchemaConfiguration.java@@ -26,6 +26,7 @@ import java.io.Serializable;import java.util.Date;import java.util.Iterator;import java.util.List;+import java.util.Map;import org.apache.log4j.Logger;import org.apache.solr.common.SolrDocument;@@ -93,13 +94,14 @@ public class SchemaConfiguration extends Configuration implements Serializable {return false;}- public boolean postprocessing_references(Segment segment, SolrDocument doc, SolrInputDocument sid, DigestURI url) {+ public boolean postprocessing_references(Segment segment, SolrDocument doc, SolrInputDocument sid, DigestURI url, Map<String, Long> hostExtentCount) {if (!(this.contains(CollectionSchema.references_i) || this.contains(CollectionSchema.references_internal_i) ||this.contains(CollectionSchema.references_external_i) || this.contains(CollectionSchema.references_exthosts_i))) return false;Integer all_old = doc == null ? null : (Integer) doc.getFieldValue(CollectionSchema.references_i.getSolrFieldName());Integer internal_old = doc == null ? null : (Integer) doc.getFieldValue(CollectionSchema.references_internal_i.getSolrFieldName());Integer external_old = doc == null ? null : (Integer) doc.getFieldValue(CollectionSchema.references_external_i.getSolrFieldName());Integer exthosts_old = doc == null ? null : (Integer) doc.getFieldValue(CollectionSchema.references_exthosts_i.getSolrFieldName());+ Integer hostextc_old = doc == null ? null : (Integer) doc.getFieldValue(CollectionSchema.host_extent_i.getSolrFieldName());ReferenceContainer<CitationReference> references;try {int all = 0, internal = 0, external = 0;@@ -134,6 +136,11 @@ public class SchemaConfiguration extends Configuration implements Serializable {sid.setField(CollectionSchema.references_exthosts_i.getSolrFieldName(), exthosts.size());change = true;}+ Long hostExtent = hostExtentCount == null ? Integer.MAX_VALUE : hostExtentCount.get(url.hosthash());+ if (hostextc_old == null || hostextc_old.intValue() != hostExtent) {+ sid.setField(CollectionSchema.host_extent_i.getSolrFieldName(), hostExtent.intValue());+ change = true;+ }return change;} catch (IOException e) {} catch (SpaceExceededException e) {diff --git a/source/net/yacy/search/index/Segment.java b/source/net/yacy/search/index/Segment.javaindex 4d8f99763..69de7512a 100644--- a/source/net/yacy/search/index/Segment.java+++ b/source/net/yacy/search/index/Segment.java@@ -292,7 +292,7 @@ public class Segment {if (count > 0) return count;}try {- return (int) this.fulltext.getDefaultConnector().getQueryCount(CollectionSchema.text_t.getSolrFieldName() + ':' + word);+ return (int) this.fulltext.getDefaultConnector().getQueryCount(CollectionSchema.text_t.getSolrFieldName() + ":\"" + word + "\"");} catch (Throwable e) {Log.logException(e);return 0;@@ -544,7 +544,7 @@ public class Segment {// ENRICH DOCUMENT WITH RANKING INFORMATIONif (this.connectedCitation()) {- this.fulltext.getDefaultConfiguration().postprocessing_references(this, null, vector, url);+ this.fulltext.getDefaultConfiguration().postprocessing_references(this, null, vector, url, null);}// STORE TO SOLRString error = null;diff --git a/source/net/yacy/search/schema/CollectionConfiguration.java b/source/net/yacy/search/schema/CollectionConfiguration.javaindex 1f82e29e0..08528bbf8 100644--- a/source/net/yacy/search/schema/CollectionConfiguration.java+++ b/source/net/yacy/search/schema/CollectionConfiguration.java@@ -351,9 +351,9 @@ public class CollectionConfiguration extends SchemaConfiguration implements Sericlickdepth = 0;this.lazy = lc;} else {- clickdepth = 999;- processTypes.add(ProcessType.CLICKDEPTH); // postprocessing needed; this is also needed if the depth is positive; there could be a shortcut+ clickdepth = 999;}+ processTypes.add(ProcessType.CLICKDEPTH); // postprocessing needed; this is also needed if the depth is positive; there could be a shortcutCollectionSchema.clickdepth_i.add(doc, clickdepth); // no lazy value checking to get a '0' into the index}@@ -779,6 +779,8 @@ public class CollectionConfiguration extends SchemaConfiguration implements SeriSolrDocument doc;int proccount = 0, proccount_clickdepthchange = 0, proccount_referencechange = 0;++ Map<String, Long> hostExtentCache = new HashMap<String, Long>();try {while ((doc = docs.take()) != AbstractSolrConnector.POISON_DOCUMENT) {// for each to-be-processed entry work on the process tag@@ -796,7 +798,14 @@ public class CollectionConfiguration extends SchemaConfiguration implements Seri}// refresh the link count; it's 'cheap' to do this here- if (postprocessing_references(segment, doc, sid, url)) proccount_referencechange++;+ String hosthash = url.hosthash();+ if (!hostExtentCache.containsKey(hosthash)) {+ StringBuilder q = new StringBuilder();+ q.append(CollectionSchema.host_id_s.getSolrFieldName()).append(":\"").append(hosthash).append("\" AND ").append(CollectionSchema.httpstatus_i.getSolrFieldName()).append(":200");+ long count = segment.fulltext().getDefaultConnector().getQueryCount(q.toString());+ hostExtentCache.put(hosthash, count);+ }+ if (postprocessing_references(segment, doc, sid, url, hostExtentCache)) proccount_referencechange++;// all processing steps checked, remove the processing tagsid.removeField(CollectionSchema.process_sxt.getSolrFieldName());diff --git a/source/net/yacy/search/schema/CollectionSchema.java b/source/net/yacy/search/schema/CollectionSchema.javaindex 13d79db9f..0817e0071 100644--- a/source/net/yacy/search/schema/CollectionSchema.java+++ b/source/net/yacy/search/schema/CollectionSchema.java@@ -153,6 +153,7 @@ public enum CollectionSchema implements SchemaDeclaration {host_organization_s(SolrType.string, true, true, false, false, true, "either the second level domain or, if a ccSLD is used, the third level domain"),host_organizationdnc_s(SolrType.string, true, true, false, false, true, "the organization and dnc concatenated with '.'"),host_subdomain_s(SolrType.string, true, true, false, false, true, "the remaining part of the host without organizationdnc"),+ host_extent_i(SolrType.num_integer, true, true, false, false, false, "number of documents from the same host; can be used to measure references_internal_i for likelihood computation"),title_count_i(SolrType.num_integer, true, true, false, false, false, "number of titles (counting the 'title' field) in the document"),title_chars_val(SolrType.num_integer, true, true, true, false, false, "number of characters for each title"),