From 31d2a5645ee1289599c4473211399db9d93b2485 Mon Sep 17 00:00:00 2001 From: reger Date: Sat, 15 Oct 2016 19:29:19 +0200 Subject: [PATCH] remove obsolete query variable leftover from https://github.com/yacy/yacy_search_server/commit/8fb370d9f899a83908e029336690cc6f5bb2059a#diff-1d4259005ebfddc11083387857a86175 harmonize ranking shift parameter to 0xFF correct addresult weight parameter to long --- source/net/yacy/search/query/QueryParams.java | 1 - source/net/yacy/search/query/SearchEvent.java | 12 ++++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/source/net/yacy/search/query/QueryParams.java b/source/net/yacy/search/query/QueryParams.java index 3a27dd74e..9efbb8dcf 100644 --- a/source/net/yacy/search/query/QueryParams.java +++ b/source/net/yacy/search/query/QueryParams.java @@ -224,7 +224,6 @@ public final class QueryParams { } catch (final PatternSyntaxException ex) { throw new IllegalArgumentException("Not a valid regular expression: " + prefer, ex); } - this.prefer.toString().equals(matchnothing_pattern.toString()); assert language != null; this.targetlang = language; this.metatags = metatags; diff --git a/source/net/yacy/search/query/SearchEvent.java b/source/net/yacy/search/query/SearchEvent.java index 0359b3c93..96e241fde 100644 --- a/source/net/yacy/search/query/SearchEvent.java +++ b/source/net/yacy/search/query/SearchEvent.java @@ -1448,9 +1448,9 @@ public final class SearchEvent { * @param resultEntry to add * @param score current ranking */ - public void addResult(URIMetadataNode resultEntry, final float score) { + public void addResult(URIMetadataNode resultEntry, final long score) { if (resultEntry == null) return; - final long ranking = ((long) (score * 128.f)) + postRanking(resultEntry, this.ref /*this.getTopicNavigator(MAX_TOPWORDS)*/); + final long ranking = (score * 128) + postRanking(resultEntry, this.ref /*this.getTopicNavigator(MAX_TOPWORDS)*/); // TODO: above was originally using (see below), but getTopicNavigator returns this.ref and possibliy alters this.ref on first call (this.ref.size < 2 -> this.ref.clear) // TODO: verify and straighten the use of addTopic, getTopic and getTopicNavigator and related score calculation // final long ranking = ((long) (score * 128.f)) + postRanking(resultEntry, this.getTopicNavigator(MAX_TOPWORDS)); @@ -1486,8 +1486,8 @@ public final class SearchEvent { r += (128 * referencesCount / (1 + 2 * rentry.llocal() + rentry.lother())) << this.query.ranking.coeff_citation; } /* else r += 0; */ // prefer hit with 'prefer' pattern - if (this.query.prefer.matcher(rentry.url().toNormalform(true)).matches()) r += 256 << this.query.ranking.coeff_prefer; - if (this.query.prefer.matcher(rentry.title()).matches()) r += 256 << this.query.ranking.coeff_prefer; + if (this.query.prefer.matcher(rentry.url().toNormalform(true)).matches()) r += 255 << this.query.ranking.coeff_prefer; + if (this.query.prefer.matcher(rentry.title()).matches()) r += 255 << this.query.ranking.coeff_prefer; // apply 'common-sense' heuristic using references final String urlstring = rentry.url().toNormalform(true); @@ -1512,8 +1512,8 @@ public final class SearchEvent { String queryword; while (shi.hasNext()) { queryword = shi.next(); - if (urlcompmap.contains(queryword)) r += 256 << this.query.ranking.coeff_appurl; - if (descrcompmap.contains(queryword)) r += 256 << this.query.ranking.coeff_app_dc_title; + if (urlcompmap.contains(queryword)) r += 255 << this.query.ranking.coeff_appurl; + if (descrcompmap.contains(queryword)) r += 255 << this.query.ranking.coeff_app_dc_title; } return r; }