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
pull/1/head
orbiter 18 years ago
parent 979656f09c
commit c0851ee943

@ -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<results.numResults();i++){
searchResults.searchResult result=results.getResult(i);
plasmaSearchResults.searchResult result=results.getResult(i);
try {
prop.put("type_results_" + i + "_authorized_recommend", (yacyCore.newsPool.getSpecific(yacyNewsPool.OUTGOING_DB, "stippadd", "url", result.getUrl()) == null) ? 1 : 0);
} catch (IOException e) {}

@ -62,7 +62,7 @@ import de.anomic.plasma.plasmaCondenser;
import de.anomic.plasma.plasmaSearchEvent;
import de.anomic.plasma.plasmaSearchQuery;
import de.anomic.plasma.plasmaSearchRankingProfile;
import de.anomic.plasma.plasmaSearchResult;
import de.anomic.plasma.plasmaSearchPostOrder;
import de.anomic.plasma.plasmaSearchTimingProfile;
import de.anomic.plasma.plasmaSnippetCache;
import de.anomic.plasma.plasmaSwitchboard;
@ -131,7 +131,7 @@ public final class search {
// prepare an abstract result
StringBuffer indexabstract = new StringBuffer();
int joincount = 0;
plasmaSearchResult acc = null;
plasmaSearchPostOrder acc = null;
plasmaSearchQuery squery = null;
plasmaSearchEvent theSearch = null;
if ((query.length() == 0) && (abstractSet != null)) {

@ -54,9 +54,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.TreeSet;
import de.anomic.data.searchResults;
import de.anomic.data.wikiCode;
import de.anomic.data.searchResults.searchResult;
import de.anomic.htmlFilter.htmlFilterImageEntry;
import de.anomic.http.httpHeader;
import de.anomic.index.indexURLEntry;
@ -73,6 +71,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.serverDate;
import de.anomic.server.serverObjects;
@ -267,7 +266,7 @@ public class yacysearch {
plasmaSearchTimingProfile localTiming = new plasmaSearchTimingProfile(4 * thisSearch.maximumTime / 10, thisSearch.wantedResults);
plasmaSearchTimingProfile remoteTiming = new plasmaSearchTimingProfile(6 * thisSearch.maximumTime / 10, thisSearch.wantedResults);
searchResults results = sb.searchFromLocal(thisSearch, ranking, localTiming, remoteTiming, true, (String) header.get("CLIENTIP"));
plasmaSearchResults results = sb.searchFromLocal(thisSearch, ranking, localTiming, remoteTiming, true, (String) header.get("CLIENTIP"));
//prop=sb.searchFromLocal(thisSearch, ranking, localTiming, remoteTiming, true, (String) header.get("CLIENTIP"));
prop=new serverObjects();
//prop.put("references", 0);
@ -284,7 +283,7 @@ public class yacysearch {
prop.put("num-results_orderedcount", Integer.toString(results.getOrderedcount())); //why toString?
prop.put("num-results_globalresults", results.getGlobalresults());
for(int i=0;i<results.numResults();i++){
searchResults.searchResult result=results.getResult(i);
plasmaSearchResults.searchResult result=results.getResult(i);
try {
prop.put("type_results_" + i + "_authorized_recommend", (yacyCore.newsPool.getSpecific(yacyNewsPool.OUTGOING_DB, "stippadd", "url", result.getUrl()) == null) ? 1 : 0);
} catch (IOException e) {}

@ -133,14 +133,14 @@ public final class plasmaSearchEvent extends Thread implements Runnable {
return r;
}
public plasmaSearchResult search() {
public plasmaSearchPostOrder search() {
// combine all threads
// we synchronize with flushThreads to allow only one local search at a time,
// so all search tasks are queued
synchronized (flushThreads) {
long start = System.currentTimeMillis();
plasmaSearchResult result;
plasmaSearchPostOrder result;
if (query.domType == plasmaSearchQuery.SEARCHDOM_GLOBALDHT) {
int fetchpeers = (int) (query.maximumTime / 500L); // number of target peers; means 10 peers in 10 seconds
if (fetchpeers > 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());

@ -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;

@ -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

@ -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;

@ -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);

Loading…
Cancel
Save