From c0851ee9433bc67a69d8a9a53f3b2d891a573eb0 Mon Sep 17 00:00:00 2001 From: orbiter Date: Fri, 19 Jan 2007 00:38:03 +0000 Subject: [PATCH] refactoring: moved and renamed de.anomic.data.searchResults to plasma package git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3248 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/DetailedSearch.java | 6 +++--- htroot/yacy/search.java | 4 ++-- htroot/yacysearch.java | 7 +++---- .../de/anomic/plasma/plasmaSearchEvent.java | 20 +++++++++---------- .../de/anomic/plasma/plasmaSearchImages.java | 2 +- ...Result.java => plasmaSearchPostOrder.java} | 12 +++++------ .../plasmaSearchResults.java} | 18 +++++++---------- .../de/anomic/plasma/plasmaSwitchboard.java | 11 ++++------ 8 files changed, 36 insertions(+), 44 deletions(-) rename source/de/anomic/plasma/{plasmaSearchResult.java => plasmaSearchPostOrder.java} (94%) rename source/de/anomic/{data/searchResults.java => plasma/plasmaSearchResults.java} (90%) diff --git a/htroot/DetailedSearch.java b/htroot/DetailedSearch.java index c351497d0..d7b94d71c 100644 --- a/htroot/DetailedSearch.java +++ b/htroot/DetailedSearch.java @@ -55,7 +55,6 @@ 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; @@ -65,6 +64,7 @@ import de.anomic.plasma.plasmaSearchRankingProfile; import de.anomic.plasma.plasmaSearchTimingProfile; import de.anomic.plasma.plasmaSwitchboard; import de.anomic.plasma.plasmaURL; +import de.anomic.plasma.plasmaSearchResults; import de.anomic.server.serverCore; import de.anomic.server.serverObjects; import de.anomic.server.serverSwitch; @@ -247,7 +247,7 @@ public class DetailedSearch { plasmaSearchTimingProfile remoteTiming = new plasmaSearchTimingProfile(6 * thisSearch.maximumTime / 10, thisSearch.wantedResults); 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")); + plasmaSearchResults 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()); @@ -262,7 +262,7 @@ public class DetailedSearch { prop.put("num-results_orderedcount", Integer.toString(results.getOrderedcount())); //why toString? prop.put("num-results_globalresults", results.getGlobalresults()); for(int i=0;i 50) fetchpeers = 50; @@ -364,7 +364,7 @@ public final class plasmaSearchEvent extends Thread implements Runnable { return rcLocal; } - public plasmaSearchResult orderFinal(indexContainer rcLocal) { + public plasmaSearchPostOrder orderFinal(indexContainer rcLocal) { // we collect the urlhashes and construct a list with urlEntry objects // attention: if minEntries is too high, this method will not terminate within the maxTime @@ -391,7 +391,7 @@ public final class plasmaSearchEvent extends Thread implements Runnable { System.out.println("DEBUG: postorder-final (urlfetch) maxtime = " + postorderTime); long postorderLimitTime = (postorderTime < 0) ? Long.MAX_VALUE : (System.currentTimeMillis() + postorderTime); profileLocal.startTimer(); - plasmaSearchResult acc = new plasmaSearchResult(query, ranking); + plasmaSearchPostOrder acc = new plasmaSearchPostOrder(query, ranking); indexRWIEntryNew entry; indexURLEntry page; @@ -417,12 +417,12 @@ public final class plasmaSearchEvent extends Thread implements Runnable { Iterator wi = query.queryHashes.iterator(); while (wi.hasNext()) wordIndex.removeEntry((String) wi.next(), page.hash()); } else if (query.contentdom != plasmaSearchQuery.CONTENTDOM_TEXT) { - if ((query.contentdom == plasmaSearchQuery.CONTENTDOM_AUDIO) && (page.laudio() > 0)) acc.addResult(page, preranking); - else if ((query.contentdom == plasmaSearchQuery.CONTENTDOM_VIDEO) && (page.lvideo() > 0)) acc.addResult(page, preranking); - else if ((query.contentdom == plasmaSearchQuery.CONTENTDOM_IMAGE) && (page.limage() > 0)) acc.addResult(page, preranking); - else if ((query.contentdom == plasmaSearchQuery.CONTENTDOM_APP) && (page.lapp() > 0)) acc.addResult(page, preranking); + if ((query.contentdom == plasmaSearchQuery.CONTENTDOM_AUDIO) && (page.laudio() > 0)) acc.addPage(page, preranking); + else if ((query.contentdom == plasmaSearchQuery.CONTENTDOM_VIDEO) && (page.lvideo() > 0)) acc.addPage(page, preranking); + else if ((query.contentdom == plasmaSearchQuery.CONTENTDOM_IMAGE) && (page.limage() > 0)) acc.addPage(page, preranking); + else if ((query.contentdom == plasmaSearchQuery.CONTENTDOM_APP) && (page.lapp() > 0)) acc.addPage(page, preranking); } else { - acc.addResult(page, preranking); + acc.addPage(page, preranking); } } } @@ -434,7 +434,7 @@ public final class plasmaSearchEvent extends Thread implements Runnable { // start postsorting profileLocal.startTimer(); - acc.sortResults(postsort); + acc.sortPages(postsort); profileLocal.setYieldTime(plasmaSearchTimingProfile.PROCESS_POSTSORT); profileLocal.setYieldCount(plasmaSearchTimingProfile.PROCESS_POSTSORT, acc.sizeOrdered()); diff --git a/source/de/anomic/plasma/plasmaSearchImages.java b/source/de/anomic/plasma/plasmaSearchImages.java index c9dabcf84..7a1b7f848 100644 --- a/source/de/anomic/plasma/plasmaSearchImages.java +++ b/source/de/anomic/plasma/plasmaSearchImages.java @@ -99,7 +99,7 @@ public final class plasmaSearchImages { } } - public plasmaSearchImages(plasmaSnippetCache sc, long maxTime, plasmaSearchResult sres, int depth) { + public plasmaSearchImages(plasmaSnippetCache sc, long maxTime, plasmaSearchPostOrder sres, int depth) { long start = System.currentTimeMillis(); this.images = new TreeSet(); indexURLEntry urlentry; diff --git a/source/de/anomic/plasma/plasmaSearchResult.java b/source/de/anomic/plasma/plasmaSearchPostOrder.java similarity index 94% rename from source/de/anomic/plasma/plasmaSearchResult.java rename to source/de/anomic/plasma/plasmaSearchPostOrder.java index 5b28b4bc8..f2d80bb5d 100644 --- a/source/de/anomic/plasma/plasmaSearchResult.java +++ b/source/de/anomic/plasma/plasmaSearchPostOrder.java @@ -58,7 +58,7 @@ import de.anomic.kelondro.kelondroMScoreCluster; import de.anomic.net.URL; import de.anomic.server.serverCodings; -public final class plasmaSearchResult { +public final class plasmaSearchPostOrder { private TreeMap pageAcc; // key = order hash; value = plasmaLURL.entry private kelondroMScoreCluster ref; // reference score computation for the commonSense heuristic @@ -69,7 +69,7 @@ public final class plasmaSearchResult { public int localContributions; public int filteredResults; - public plasmaSearchResult(plasmaSearchQuery query, plasmaSearchRankingProfile ranking) { + public plasmaSearchPostOrder(plasmaSearchQuery query, plasmaSearchRankingProfile ranking) { this.pageAcc = new TreeMap(); this.ref = new kelondroMScoreCluster(); this.results = new ArrayList(); @@ -80,9 +80,9 @@ public final class plasmaSearchResult { this.filteredResults = 0; } - public plasmaSearchResult cloneSmart() { + public plasmaSearchPostOrder cloneSmart() { // clones only the top structure - plasmaSearchResult theClone = new plasmaSearchResult(this.query, this.ranking); + plasmaSearchPostOrder theClone = new plasmaSearchPostOrder(this.query, this.ranking); theClone.pageAcc = (TreeMap) this.pageAcc.clone(); theClone.ref = this.ref; theClone.results = this.results; @@ -107,7 +107,7 @@ public final class plasmaSearchResult { return (indexURLEntry) pageAcc.remove(top); } - protected void addResult(indexURLEntry page, Long preranking) { + protected void addPage(indexURLEntry page, Long preranking) { // take out relevant information for reference computation indexURLEntry.Components comp = page.comp(); @@ -123,7 +123,7 @@ public final class plasmaSearchResult { addScoreFiltered(descrcomps); } - protected void sortResults(boolean postsort) { + protected void sortPages(boolean postsort) { // finally sort the results // create a commonSense - set that represents a set of words that is diff --git a/source/de/anomic/data/searchResults.java b/source/de/anomic/plasma/plasmaSearchResults.java similarity index 90% rename from source/de/anomic/data/searchResults.java rename to source/de/anomic/plasma/plasmaSearchResults.java index 7e8eb3a25..bdb5f5b7a 100644 --- a/source/de/anomic/data/searchResults.java +++ b/source/de/anomic/plasma/plasmaSearchResults.java @@ -1,6 +1,6 @@ -//plasmaSearchResults.java - a container for searchresults. -//---------------------------------------------------------- -//part of YaCy +// plasmaSearchResults.java - a container for search results +// --------------------------------------------------------- +// part of YaCy // // (C) 2007 by Alexander Schier // @@ -21,16 +21,12 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -package de.anomic.data; +package de.anomic.plasma; import java.util.ArrayList; -import java.util.Date; import de.anomic.index.indexURLEntry; -import de.anomic.plasma.plasmaSearchQuery; -import de.anomic.plasma.plasmaSearchRankingProfile; -import de.anomic.plasma.plasmaSnippetCache; -public class searchResults { +public class plasmaSearchResults { private int totalcount=0; private int filteredcount=0; private int orderedcount=0; @@ -42,10 +38,10 @@ public class searchResults { private ArrayList results=null; private Object[] references=null; - public searchResults(){ + public plasmaSearchResults(){ this.results=new ArrayList(); } - public searchResults(int totalcount, int filteredcount, int orderedcount, int linkcount){ + public plasmaSearchResults(int totalcount, int filteredcount, int orderedcount, int linkcount){ this.results=new ArrayList(); this.totalcount=totalcount; this.filteredcount=filteredcount; diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.java index 789db94fa..d01d9bf0a 100644 --- a/source/de/anomic/plasma/plasmaSwitchboard.java +++ b/source/de/anomic/plasma/plasmaSwitchboard.java @@ -110,7 +110,6 @@ import java.io.UnsupportedEncodingException; import java.lang.reflect.Constructor; import java.net.InetAddress; import java.net.MalformedURLException; -import java.net.URLEncoder; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; @@ -126,7 +125,6 @@ import de.anomic.data.blogBoard; import de.anomic.data.bookmarksDB; import de.anomic.data.listManager; import de.anomic.data.messageBoard; -import de.anomic.data.searchResults; import de.anomic.data.userDB; import de.anomic.data.wikiBoard; import de.anomic.htmlFilter.htmlFilterContentScraper; @@ -160,7 +158,6 @@ import de.anomic.server.serverSwitch; import de.anomic.server.serverThread; import de.anomic.server.logging.serverLog; import de.anomic.tools.crypt; -import de.anomic.tools.nxTools; import de.anomic.yacy.yacyClient; import de.anomic.yacy.yacyCore; import de.anomic.yacy.yacyNewsPool; @@ -2080,7 +2077,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser if (date == null) return ""; else return DateFormatter.format(date); } - public searchResults searchFromLocal(plasmaSearchQuery query, + public plasmaSearchResults searchFromLocal(plasmaSearchQuery query, plasmaSearchRankingProfile ranking, plasmaSearchTimingProfile localTiming, plasmaSearchTimingProfile remoteTiming, @@ -2090,7 +2087,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser // tell all threads to do nothing for a specific time intermissionAllThreads(2 * query.maximumTime); - searchResults results=new searchResults(); + plasmaSearchResults results=new plasmaSearchResults(); results.setRanking(ranking); results.setQuery(query); results.setFormerSearch(""); @@ -2113,7 +2110,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser // create a new search event plasmaSearchEvent theSearch = new plasmaSearchEvent(query, ranking, localTiming, remoteTiming, postsort, log, wordIndex, wordIndex.loadedURL, snippetCache); - plasmaSearchResult acc = theSearch.search(); + plasmaSearchPostOrder acc = theSearch.search(); // fetch snippets //if (query.domType != plasmaSearchQuery.SEARCHDOM_GLOBALDHT) snippetCache.fetch(acc.cloneSmart(), query.queryHashes, query.urlMask, 10, 1000); @@ -2181,7 +2178,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser */ //addScoreForked(ref, gs, descr.split(" ")); //addScoreForked(ref, gs, urlstring.split("/")); - searchResults.searchResult result=results.createSearchResult(); + plasmaSearchResults.searchResult result=results.createSearchResult(); result.setUrl(urlstring); result.setUrlname(urlname); result.setUrlentry(urlentry);