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
pull/1/head
orbiter 17 years ago
parent a7dadf7f2f
commit 53dfe9fe9a

@ -163,15 +163,16 @@ public class result {
if ((!block) && (post.get("cat", "href").equals("href"))) { if ((!block) && (post.get("cat", "href").equals("href"))) {
plasmaSearchRankingProfile ranking = sb.getRanking();
final TreeSet<String>[] query = plasmaSearchQuery.cleanQuery(querystring); // converts also umlaute final TreeSet<String>[] query = plasmaSearchQuery.cleanQuery(querystring); // converts also umlaute
boolean near = (query[0].contains("near")) && (querystring.indexOf("NEAR") >= 0); if ((query[0].contains("near")) && (querystring.indexOf("NEAR") >= 0)) {
if (near) {
query[0].remove("near"); query[0].remove("near");
}
plasmaSearchRankingProfile ranking = sb.getRanking();
if (near) {
ranking.coeff_worddistance = plasmaSearchRankingProfile.COEFF_MAX; 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 // filter out stopwords
final TreeSet<String> filtered = kelondroMSetTools.joinConstructive(query[0], plasmaSwitchboard.stopwords); final TreeSet<String> filtered = kelondroMSetTools.joinConstructive(query[0], plasmaSwitchboard.stopwords);

@ -163,15 +163,16 @@ public class ysearch {
if ((!block) && (post.get("cat", "href").equals("href"))) { if ((!block) && (post.get("cat", "href").equals("href"))) {
plasmaSearchRankingProfile ranking = sb.getRanking();
final TreeSet<String>[] query = plasmaSearchQuery.cleanQuery(querystring); // converts also umlaute final TreeSet<String>[] query = plasmaSearchQuery.cleanQuery(querystring); // converts also umlaute
boolean near = (query[0].contains("near")) && (querystring.indexOf("NEAR") >= 0); if ((query[0].contains("near")) && (querystring.indexOf("NEAR") >= 0)) {
if (near) {
query[0].remove("near"); query[0].remove("near");
}
plasmaSearchRankingProfile ranking = sb.getRanking();
if (near) {
ranking.coeff_worddistance = plasmaSearchRankingProfile.COEFF_MAX; 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 // filter out stopwords
final TreeSet<String> filtered = kelondroMSetTools.joinConstructive(query[0], plasmaSwitchboard.stopwords); final TreeSet<String> filtered = kelondroMSetTools.joinConstructive(query[0], plasmaSwitchboard.stopwords);

@ -193,15 +193,16 @@ public class yacysearch {
if ((!block) && (post.get("cat", "href").equals("href"))) { if ((!block) && (post.get("cat", "href").equals("href"))) {
plasmaSearchRankingProfile ranking = sb.getRanking();
final TreeSet<String>[] query = plasmaSearchQuery.cleanQuery(querystring); // converts also umlaute final TreeSet<String>[] query = plasmaSearchQuery.cleanQuery(querystring); // converts also umlaute
boolean near = (query[0].contains("near")) && (querystring.indexOf("NEAR") >= 0); if ((query[0].contains("near")) && (querystring.indexOf("NEAR") >= 0)) {
if (near) {
query[0].remove("near"); query[0].remove("near");
}
plasmaSearchRankingProfile ranking = sb.getRanking();
if (near) {
ranking.coeff_worddistance = plasmaSearchRankingProfile.COEFF_MAX; 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 // filter out stopwords
final TreeSet<String> filtered = kelondroMSetTools.joinConstructive(query[0], plasmaSwitchboard.stopwords); final TreeSet<String> filtered = kelondroMSetTools.joinConstructive(query[0], plasmaSwitchboard.stopwords);

Loading…
Cancel
Save