From 7b5b9baee02b1af205706ef5f5178f5700fd11a5 Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Mon, 16 Apr 2012 23:43:50 +0200 Subject: [PATCH] added citation rank to ranking profile --- htroot/Ranking_p.java | 1 + .../net/yacy/search/query/SnippetProcess.java | 2 +- .../yacy/search/ranking/RankingProfile.java | 19 ++++++++++++------- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/htroot/Ranking_p.java b/htroot/Ranking_p.java index ece5136be..c883b9115 100644 --- a/htroot/Ranking_p.java +++ b/htroot/Ranking_p.java @@ -77,6 +77,7 @@ public class Ranking_p { rankingParameters.put(RankingProfile.URLCOMPINTOPLIST, "URL Component Appears In Toplist;a higher ranking level prefers documents with words in the url path that match words in the toplist. The toplist is generated dynamically from the search results using a statistic of the most used words. The toplist is a top-10 list of the most used words in URLs and document titles."); rankingParameters.put(RankingProfile.DESCRCOMPINTOPLIST, "Description Comp. Appears In Toplist;a higher ranking level prefers documents with words in the document description that match words in the toplist. The toplist is generated dynamically from the search results using a statistic of the most used words. The toplist is a top-10 list of the most used words in URLs and document titles."); rankingParameters.put(RankingProfile.PREFER, "Application Of Prefer Pattern;a higher ranking level prefers documents where the url matches the prefer pattern given in a search request."); + rankingParameters.put(RankingProfile.CITATION, "Citation Rank;the more incoming links and the less outgoing links the better the ranking."); } private static serverObjects defaultValues() { diff --git a/source/net/yacy/search/query/SnippetProcess.java b/source/net/yacy/search/query/SnippetProcess.java index 18fea558c..90d23075a 100644 --- a/source/net/yacy/search/query/SnippetProcess.java +++ b/source/net/yacy/search/query/SnippetProcess.java @@ -308,7 +308,7 @@ public class SnippetProcess { // apply citation count //System.out.println("POSTRANKING CITATION: references = " + rentry.referencesCount() + ", inbound = " + rentry.llocal() + ", outbound = " + rentry.lother()); - r += (128 * rentry.referencesCount() / (1 + 2 * rentry.llocal() + rentry.lother())) << 8; + r += (128 * rentry.referencesCount() / (1 + 2 * rentry.llocal() + rentry.lother())) << this.query.ranking.coeff_citation; // prefer hit with 'prefer' pattern if (this.query.prefer.matcher(rentry.url().toNormalform(true, true)).matches()) { diff --git a/source/net/yacy/search/ranking/RankingProfile.java b/source/net/yacy/search/ranking/RankingProfile.java index dd663ff99..53dfa2d21 100644 --- a/source/net/yacy/search/ranking/RankingProfile.java +++ b/source/net/yacy/search/ranking/RankingProfile.java @@ -69,7 +69,8 @@ public class RankingProfile { // post-sort predicates public static final String URLCOMPINTOPLIST = "urlcompintoplist"; public static final String DESCRCOMPINTOPLIST = "descrcompintoplist"; - public static final String PREFER = "prefer"; + public static final String PREFER = "prefer"; + public static final String CITATION = "citation"; // coefficient max/min values public static final int COEFF_MIN = 0; @@ -82,16 +83,16 @@ public class RankingProfile { coeff_appurl, coeff_app_dc_title, coeff_app_dc_creator, coeff_app_dc_subject, coeff_app_dc_description, coeff_appemph, coeff_catindexof, coeff_cathasimage, coeff_cathasaudio, coeff_cathasvideo, coeff_cathasapp, coeff_urlcompintoplist, coeff_descrcompintoplist, coeff_prefer, - coeff_termfrequency, coeff_language; + coeff_termfrequency, coeff_language, coeff_citation; public RankingProfile(final ContentDomain mediatype) { // set default-values this.coeff_appemph = 5; this.coeff_appurl = 11; this.coeff_app_dc_creator = 1; - this.coeff_app_dc_description = 4; + this.coeff_app_dc_description = 8; this.coeff_app_dc_subject = 2; - this.coeff_app_dc_title = 8; + this.coeff_app_dc_title = 12; this.coeff_authority = 5; this.coeff_cathasapp = (mediatype == ContentDomain.APP) ? 15 : 0; this.coeff_cathasaudio = (mediatype == ContentDomain.AUDIO) ? 15 : 0; @@ -116,9 +117,10 @@ public class RankingProfile { this.coeff_wordsintitle = 2; this.coeff_ybr = 8; - this.coeff_urlcompintoplist = 15; - this.coeff_descrcompintoplist = 15; - this.coeff_prefer = 15; + this.coeff_urlcompintoplist = 2; + this.coeff_descrcompintoplist = 2; + this.coeff_prefer = 0; + this.coeff_citation = 15; } public RankingProfile(final String prefix, String profile) { @@ -181,6 +183,7 @@ public class RankingProfile { this.coeff_descrcompintoplist = parseMap(coeff, DESCRCOMPINTOPLIST, this.coeff_descrcompintoplist); this.coeff_prefer = parseMap(coeff, PREFER, this.coeff_prefer); this.coeff_language = parseMap(coeff, LANGUAGE, this.coeff_language); + this.coeff_citation = parseMap(coeff, CITATION, this.coeff_citation); } } @@ -275,10 +278,12 @@ public class RankingProfile { ext.put(URLCOMPINTOPLIST, Integer.toString(this.coeff_urlcompintoplist)); ext.put(DESCRCOMPINTOPLIST, Integer.toString(this.coeff_descrcompintoplist)); ext.put(PREFER, Integer.toString(this.coeff_prefer)); + ext.put(CITATION, Integer.toString(this.coeff_citation)); } else { ext.put(prefix + URLCOMPINTOPLIST, Integer.toString(this.coeff_urlcompintoplist)); ext.put(prefix + DESCRCOMPINTOPLIST, Integer.toString(this.coeff_descrcompintoplist)); ext.put(prefix + PREFER, Integer.toString(this.coeff_prefer)); + ext.put(prefix + CITATION, Integer.toString(this.coeff_citation)); } return ext; }