From 53dfe9fe9aa6f85a325debff6293b597882ecd14 Mon Sep 17 00:00:00 2001 From: orbiter Date: Sun, 18 May 2008 21:29:43 +0000 Subject: [PATCH] added RECENT command for search query: add RECENT (in uppercase letters) to the search words and results will be ordered by date (recent first) git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4825 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/yacy/ui/result.java | 15 ++++++++------- htroot/yacy/user/ysearch.java | 15 ++++++++------- htroot/yacysearch.java | 13 +++++++------ 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/htroot/yacy/ui/result.java b/htroot/yacy/ui/result.java index 118d11d94..e817c8690 100644 --- a/htroot/yacy/ui/result.java +++ b/htroot/yacy/ui/result.java @@ -163,16 +163,17 @@ public class result { if ((!block) && (post.get("cat", "href").equals("href"))) { + plasmaSearchRankingProfile ranking = sb.getRanking(); final TreeSet[] query = plasmaSearchQuery.cleanQuery(querystring); // converts also umlaute - boolean near = (query[0].contains("near")) && (querystring.indexOf("NEAR") >= 0); - if (near) { - query[0].remove("near"); + if ((query[0].contains("near")) && (querystring.indexOf("NEAR") >= 0)) { + query[0].remove("near"); + ranking.coeff_worddistance = plasmaSearchRankingProfile.COEFF_MAX; } - plasmaSearchRankingProfile ranking = sb.getRanking(); - if (near) { - ranking.coeff_worddistance = plasmaSearchRankingProfile.COEFF_MAX; + if ((query[0].contains("recent")) && (querystring.indexOf("RECENT") >= 0)) { + query[0].remove("recent"); + ranking.coeff_date = plasmaSearchRankingProfile.COEFF_MAX; } - + // filter out stopwords final TreeSet filtered = kelondroMSetTools.joinConstructive(query[0], plasmaSwitchboard.stopwords); if (filtered.size() > 0) { diff --git a/htroot/yacy/user/ysearch.java b/htroot/yacy/user/ysearch.java index db65bc1ea..2d888ab8b 100644 --- a/htroot/yacy/user/ysearch.java +++ b/htroot/yacy/user/ysearch.java @@ -163,16 +163,17 @@ public class ysearch { if ((!block) && (post.get("cat", "href").equals("href"))) { + plasmaSearchRankingProfile ranking = sb.getRanking(); final TreeSet[] query = plasmaSearchQuery.cleanQuery(querystring); // converts also umlaute - boolean near = (query[0].contains("near")) && (querystring.indexOf("NEAR") >= 0); - if (near) { - query[0].remove("near"); + if ((query[0].contains("near")) && (querystring.indexOf("NEAR") >= 0)) { + query[0].remove("near"); + ranking.coeff_worddistance = plasmaSearchRankingProfile.COEFF_MAX; } - plasmaSearchRankingProfile ranking = sb.getRanking(); - if (near) { - ranking.coeff_worddistance = plasmaSearchRankingProfile.COEFF_MAX; + if ((query[0].contains("recent")) && (querystring.indexOf("RECENT") >= 0)) { + query[0].remove("recent"); + ranking.coeff_date = plasmaSearchRankingProfile.COEFF_MAX; } - + // filter out stopwords final TreeSet filtered = kelondroMSetTools.joinConstructive(query[0], plasmaSwitchboard.stopwords); if (filtered.size() > 0) { diff --git a/htroot/yacysearch.java b/htroot/yacysearch.java index 266bb77b2..ae18b12d5 100644 --- a/htroot/yacysearch.java +++ b/htroot/yacysearch.java @@ -192,16 +192,17 @@ public class yacysearch { } catch (InterruptedException e) { e.printStackTrace(); } if ((!block) && (post.get("cat", "href").equals("href"))) { - + + plasmaSearchRankingProfile ranking = sb.getRanking(); final TreeSet[] query = plasmaSearchQuery.cleanQuery(querystring); // converts also umlaute - boolean near = (query[0].contains("near")) && (querystring.indexOf("NEAR") >= 0); - if (near) { + if ((query[0].contains("near")) && (querystring.indexOf("NEAR") >= 0)) { query[0].remove("near"); - } - plasmaSearchRankingProfile ranking = sb.getRanking(); - if (near) { ranking.coeff_worddistance = plasmaSearchRankingProfile.COEFF_MAX; } + if ((query[0].contains("recent")) && (querystring.indexOf("RECENT") >= 0)) { + query[0].remove("recent"); + ranking.coeff_date = plasmaSearchRankingProfile.COEFF_MAX; + } // filter out stopwords final TreeSet filtered = kelondroMSetTools.joinConstructive(query[0], plasmaSwitchboard.stopwords);