Skip to content

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

add ranking weight to json-search-results

f1orid671de8c17a6
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<ResultEntry>, Comparator<ResultEn
private final List<MediaSnippet> 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>(resultEntry, ranking)); // remove smallest in case of overflow
if (nav_topics) rankingProcess.addTopics(resultEntry);
}