From c39dda23747ab80e588f39a5b9658d23b2a8b7cc Mon Sep 17 00:00:00 2001 From: allo Date: Thu, 18 Jan 2007 10:42:36 +0000 Subject: [PATCH] finished refactoring of searchtemplates. now plasmaSwitchboard.searchFromLocal calculates a searchResults structure, which is parsed in the yacysearch/detailedSearch Servlets. git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3244 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- ChangeLog | 1 + htroot/DetailedSearch.java | 63 ++++++++++++++++++- htroot/yacysearch.java | 62 +++++++++++++++++- source/de/anomic/data/searchResults.java | 18 ++++++ .../de/anomic/plasma/plasmaSwitchboard.java | 57 +++-------------- 5 files changed, 150 insertions(+), 51 deletions(-) diff --git a/ChangeLog b/ChangeLog index f7e74e4f6..b6c5f0fce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,7 @@ version 0.50 * CHANGED: Migrated to the new Database Structure * ADDED: XSS protection for all pages as default. * ADDED: searchResults structure. + * CHANGED: the searchtemplates are now generated from a searchResults structure in the servlets. version 0.49 * CHANGED: New Database Structure for Index and URL Storage diff --git a/htroot/DetailedSearch.java b/htroot/DetailedSearch.java index 3d3747a79..c351497d0 100644 --- a/htroot/DetailedSearch.java +++ b/htroot/DetailedSearch.java @@ -47,22 +47,32 @@ // javac -classpath .:../classes index.java // if the shell's current path is HTROOT +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; import java.util.HashMap; import java.util.Iterator; import java.util.TreeSet; import java.util.Map; +import de.anomic.data.searchResults; import de.anomic.http.httpHeader; import de.anomic.kelondro.kelondroMSetTools; +import de.anomic.net.URL; +import de.anomic.plasma.plasmaSearchPreOrder; import de.anomic.plasma.plasmaSearchQuery; import de.anomic.plasma.plasmaSearchRankingProfile; import de.anomic.plasma.plasmaSearchTimingProfile; import de.anomic.plasma.plasmaSwitchboard; +import de.anomic.plasma.plasmaURL; import de.anomic.server.serverCore; import de.anomic.server.serverObjects; import de.anomic.server.serverSwitch; import de.anomic.yacy.yacyCore; +import de.anomic.yacy.yacyNewsPool; +import de.anomic.yacy.yacySeed; import de.anomic.tools.crypt; +import de.anomic.tools.nxTools; public class DetailedSearch { @@ -235,7 +245,58 @@ public class DetailedSearch { plasmaSearchRankingProfile localRanking = new plasmaSearchRankingProfile("local", post.toString()); plasmaSearchTimingProfile localTiming = new plasmaSearchTimingProfile(4 * thisSearch.maximumTime / 10, thisSearch.wantedResults); plasmaSearchTimingProfile remoteTiming = new plasmaSearchTimingProfile(6 * thisSearch.maximumTime / 10, thisSearch.wantedResults); - final serverObjects prop = sb.searchFromLocal(thisSearch, localRanking, localTiming, remoteTiming, postsort, (String) header.get("CLIENTIP")); + + final serverObjects prop = new serverObjects();//sb.searchFromLocal(thisSearch, localRanking, localTiming, remoteTiming, postsort, (String) header.get("CLIENTIP")); + searchResults results = sb.searchFromLocal(thisSearch, localRanking, localTiming, remoteTiming, postsort, (String) header.get("CLIENTIP")); + //prop.put("references", 0); + URL wordURL=null; + prop.put("num-results_totalcount", results.getTotalcount()); + prop.put("num-results_filteredcount", results.getFilteredcount()); + prop.put("num-results_orderedcount", results.getOrderedcount()); + prop.put("num-results_linkcount", results.getLinkcount()); + prop.put("type_results", 0); + if(results.numResults()!=0){ + //we've got results + prop.put("num-results_totalcount", results.getTotalcount()); + prop.put("num-results_filteredcount", results.getFilteredcount()); + prop.put("num-results_orderedcount", Integer.toString(results.getOrderedcount())); //why toString? + prop.put("num-results_globalresults", results.getGlobalresults()); + for(int i=0;i