Skip to content

Commit

Permalink
added RECENT command for search query:
Browse files Browse the repository at this point in the history
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
  • Loading branch information
orbiter committed May 18, 2008
1 parent a7dadf7 commit 53dfe9f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 20 deletions.
15 changes: 8 additions & 7 deletions htroot/yacy/ui/result.java
Expand Up @@ -163,16 +163,17 @@ public static serverObjects respond(httpHeader header, serverObjects post, serve

if ((!block) && (post.get("cat", "href").equals("href"))) {

plasmaSearchRankingProfile ranking = sb.getRanking();
final TreeSet<String>[] 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<String> filtered = kelondroMSetTools.joinConstructive(query[0], plasmaSwitchboard.stopwords);
if (filtered.size() > 0) {
Expand Down
15 changes: 8 additions & 7 deletions htroot/yacy/user/ysearch.java
Expand Up @@ -163,16 +163,17 @@ public static serverObjects respond(httpHeader header, serverObjects post, serve

if ((!block) && (post.get("cat", "href").equals("href"))) {

plasmaSearchRankingProfile ranking = sb.getRanking();
final TreeSet<String>[] 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<String> filtered = kelondroMSetTools.joinConstructive(query[0], plasmaSwitchboard.stopwords);
if (filtered.size() > 0) {
Expand Down
13 changes: 7 additions & 6 deletions htroot/yacysearch.java
Expand Up @@ -192,16 +192,17 @@ public static serverObjects respond(httpHeader header, serverObjects post, serve
} catch (InterruptedException e) { e.printStackTrace(); }

if ((!block) && (post.get("cat", "href").equals("href"))) {


plasmaSearchRankingProfile ranking = sb.getRanking();
final TreeSet<String>[] 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<String> filtered = kelondroMSetTools.joinConstructive(query[0], plasmaSwitchboard.stopwords);
Expand Down

0 comments on commit 53dfe9f

Please sign in to comment.