From d671de8c17a68391273e2282d8a9e315b5924b83 Mon Sep 17 00:00:00 2001 From: f1ori Date: Thu, 28 Apr 2011 11:18:14 +0000 Subject: [PATCH] add ranking weight to json-search-results git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7677 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/yacysearchitem.java | 1 + htroot/yacysearchitem.json | 4 +++- source/de/anomic/search/ResultEntry.java | 2 +- source/de/anomic/search/ResultFetcher.java | 1 + 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/htroot/yacysearchitem.java b/htroot/yacysearchitem.java index 2111fcde3..d863386a0 100644 --- a/htroot/yacysearchitem.java +++ b/htroot/yacysearchitem.java @@ -142,6 +142,7 @@ public class yacysearchitem { if (faviconURL != null && isHtml) sb.loader.loadIfNotExistBackground(faviconURL.toNormalform(true, false), 1024 * 1024 * 10); prop.putHTML("content_faviconCode", sb.licensedURLs.aquireLicense(faviconURL)); // acquire license for favicon url loading prop.put("content_urlhash", resulthashString); + prop.put("content_ranking", result.ranking); prop.put("content_showMetadata_urlhash", resulthashString); prop.put("content_showParser_urlhash", resulthashString); prop.put("content_urlhexhash", yacySeed.b64Hash2hexHash(resulthashString)); diff --git a/htroot/yacysearchitem.json b/htroot/yacysearchitem.json index e597469dd..bde450962 100644 --- a/htroot/yacysearchitem.json +++ b/htroot/yacysearchitem.json @@ -11,7 +11,9 @@ "faviconCode": "#[faviconCode]#", "host": "#[host]#", "path": "#[path]#", - "file": "#[file]#" + "file": "#[file]#", + "urlhash": "#[urlhash]#", + "ranking": "#[ranking]#" }::#(item)#::#(nl)#:: ,#(/nl)# { "title": "#[name]#", diff --git a/source/de/anomic/search/ResultEntry.java b/source/de/anomic/search/ResultEntry.java index 565a52d72..b4b6d56fe 100644 --- a/source/de/anomic/search/ResultEntry.java +++ b/source/de/anomic/search/ResultEntry.java @@ -57,7 +57,7 @@ public class ResultEntry implements Comparable, Comparator mediaSnippets; // statistic objects - public long dbRetrievalTime, snippetComputationTime; + public long dbRetrievalTime, snippetComputationTime, ranking; public ResultEntry(final URIMetadataRow urlentry, final Segment indexSegment, diff --git a/source/de/anomic/search/ResultFetcher.java b/source/de/anomic/search/ResultFetcher.java index fad8a36b3..c2bf59fb0 100644 --- a/source/de/anomic/search/ResultFetcher.java +++ b/source/de/anomic/search/ResultFetcher.java @@ -351,6 +351,7 @@ public class ResultFetcher { // apply post-ranking long ranking = Long.valueOf(rankingProcess.getOrder().cardinal(resultEntry.word())); ranking += postRanking(resultEntry, rankingProcess.getTopicNavigator(10)); + resultEntry.ranking = ranking; result.put(new ReverseElement(resultEntry, ranking)); // remove smallest in case of overflow if (nav_topics) rankingProcess.addTopics(resultEntry); }