Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
refactoring of search classes
orbiter0e8647d62ff9
diff --git a/htroot/AccessTracker_p.java b/htroot/AccessTracker_p.javaindex 36ed8a0e7..297df91f6 100644--- a/htroot/AccessTracker_p.java+++ b/htroot/AccessTracker_p.java@@ -38,7 +38,7 @@ import java.text.SimpleDateFormat;import de.anomic.http.httpRequestHeader;import de.anomic.net.natLib;import de.anomic.plasma.plasmaSwitchboard;-import de.anomic.search.Query;+import de.anomic.search.QueryParams;import de.anomic.server.serverCore;import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;@@ -138,8 +138,8 @@ public class AccessTracker_p {prop.put("page_num", entCount);}if ((page == 2) || (page == 4)) {- final ArrayList<Query> array = (page == 2) ? sb.localSearches : sb.remoteSearches;- Query searchProfile;+ final ArrayList<QueryParams> array = (page == 2) ? sb.localSearches : sb.remoteSearches;+ QueryParams searchProfile;int m = Math.min(maxCount, array.size());long qcountSum = 0;long rcountSum = 0;@@ -167,7 +167,7 @@ public class AccessTracker_p {} else {// remote searchprop.putHTML("page_list_" + entCount + "_peername", (searchProfile.remotepeer == null) ? "<unknown>" : searchProfile.remotepeer.getName());- prop.put("page_list_" + entCount + "_queryhashes", Query.anonymizedQueryHashes(searchProfile.queryHashes));+ prop.put("page_list_" + entCount + "_queryhashes", QueryParams.anonymizedQueryHashes(searchProfile.queryHashes));}prop.putNum("page_list_" + entCount + "_querycount", searchProfile.linesPerPage);prop.putNum("page_list_" + entCount + "_resultcount", searchProfile.resultcount);diff --git a/htroot/Blacklist_p.java b/htroot/Blacklist_p.javaindex 89af457dd..f0104bb92 100644--- a/htroot/Blacklist_p.java+++ b/htroot/Blacklist_p.java@@ -43,8 +43,8 @@ import de.anomic.data.AbstractBlacklist;import de.anomic.data.Blacklist;import de.anomic.data.listManager;import de.anomic.http.httpRequestHeader;-import de.anomic.plasma.plasmaSearchEvent;import de.anomic.plasma.plasmaSwitchboard;+import de.anomic.search.QueryEvent;import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;import de.anomic.yacy.yacyURL;@@ -66,7 +66,7 @@ public class Blacklist_p {listManager.listsPath = new File(listManager.switchboard.getRootPath(),listManager.switchboard.getConfig("listManager.listsPath", "DATA/LISTS"));// clean up all search events in case that a (new) blacklist entry denies previously returned results- plasmaSearchEvent.cleanupEvents(true);+ QueryEvent.cleanupEvents(true);// getting the list of supported blacklist typesfinal String supportedBlacklistTypesStr = AbstractBlacklist.BLACKLIST_TYPES_STRING;diff --git a/htroot/Bookmarks.java b/htroot/Bookmarks.javaindex f8ac12866..cacfb64f3 100644--- a/htroot/Bookmarks.java+++ b/htroot/Bookmarks.java@@ -44,8 +44,8 @@ import de.anomic.document.Document;import de.anomic.http.httpRequestHeader;import de.anomic.kelondro.text.metadataPrototype.URLMetadataRow;import de.anomic.kelondro.util.DateFormatter;-import de.anomic.plasma.plasmaSnippetCache;import de.anomic.plasma.plasmaSwitchboard;+import de.anomic.search.SnippetCache;import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;import de.anomic.yacy.yacyNewsPool;@@ -187,7 +187,7 @@ public class Bookmarks {Document document = null;if (urlentry != null) {final URLMetadataRow.Components metadata = urlentry.metadata();- document = plasmaSnippetCache.retrieveDocument(metadata.url(), true, 5000, true, false);+ document = SnippetCache.retrieveDocument(metadata.url(), true, 5000, true, false);prop.put("mode_edit", "0"); // create modeprop.put("mode_url", metadata.url().toNormalform(false, true));prop.putHTML("mode_title", metadata.dc_title());diff --git a/htroot/IndexControlRWIs_p.java b/htroot/IndexControlRWIs_p.javaindex 0b114645a..ec2edb205 100644--- a/htroot/IndexControlRWIs_p.java+++ b/htroot/IndexControlRWIs_p.java@@ -51,10 +51,10 @@ import de.anomic.kelondro.text.metadataPrototype.URLMetadataRow;import de.anomic.kelondro.text.referencePrototype.WordReference;import de.anomic.kelondro.text.referencePrototype.WordReferenceRow;import de.anomic.kelondro.util.DateFormatter;-import de.anomic.plasma.plasmaSearchEvent;-import de.anomic.plasma.plasmaSearchRankingProcess;import de.anomic.plasma.plasmaSwitchboard;-import de.anomic.search.Query;+import de.anomic.search.QueryParams;+import de.anomic.search.QueryEvent;+import de.anomic.search.RankingProcess;import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;import de.anomic.yacy.yacyClient;@@ -79,7 +79,7 @@ public class IndexControlRWIs_p {prop.put("genUrlList", 0);// clean up all search events- plasmaSearchEvent.cleanupEvents(true);+ QueryEvent.cleanupEvents(true);if (post != null) {// default values@@ -96,7 +96,7 @@ public class IndexControlRWIs_p {if (post.containsKey("keystringsearch")) {keyhash = Word.word2hash(keystring);prop.put("keyhash", keyhash);- final plasmaSearchRankingProcess ranking = genSearchresult(prop, sb, keyhash, null);+ final RankingProcess ranking = genSearchresult(prop, sb, keyhash, null);if (ranking.filteredCount() == 0) {prop.put("searchresult", 1);prop.putHTML("searchresult_word", keystring);@@ -107,7 +107,7 @@ public class IndexControlRWIs_p {if (keystring.length() == 0 || !new String(Word.word2hash(keystring)).equals(new String(keyhash))) {prop.put("keystring", "<not possible to compute word from hash>");}- final plasmaSearchRankingProcess ranking = genSearchresult(prop, sb, keyhash, null);+ final RankingProcess ranking = genSearchresult(prop, sb, keyhash, null);if (ranking.filteredCount() == 0) {prop.put("searchresult", 2);prop.putHTML("searchresult_wordhash", new String(keyhash));@@ -183,7 +183,7 @@ public class IndexControlRWIs_p {}final Bitfield flags = compileFlags(post);final int count = (post.get("lines", "all").equals("all")) ? -1 : post.getInt("lines", -1);- final plasmaSearchRankingProcess ranking = genSearchresult(prop, sb, keyhash, flags);+ final RankingProcess ranking = genSearchresult(prop, sb, keyhash, flags);genURLList(prop, keyhash, keystring, ranking, flags, count);}@@ -348,7 +348,7 @@ public class IndexControlRWIs_p {return prop;}- public static void genURLList(final serverObjects prop, final byte[] keyhash, final String keystring, final plasmaSearchRankingProcess ranked, final Bitfield flags, final int maxlines) {+ public static void genURLList(final serverObjects prop, final byte[] keyhash, final String keystring, final RankingProcess ranked, final Bitfield flags, final int maxlines) {// search for a word hash and generate a list of url linksprop.put("genUrlList_keyHash", new String(keyhash));@@ -381,7 +381,7 @@ public class IndexControlRWIs_p {prop.put("genUrlList_urlList_"+i+"_urlExists_urlStringShort", (us.length() > 40) ? (us.substring(0, 20) + "<br>" + us.substring(20, 40) + "...") : ((us.length() > 30) ? (us.substring(0, 20) + "<br>" + us.substring(20)) : us));prop.putNum("genUrlList_urlList_"+i+"_urlExists_ranking", (entry.ranking() - rn));prop.putNum("genUrlList_urlList_"+i+"_urlExists_domlength", yacyURL.domLengthEstimation(entry.hash()));- prop.putNum("genUrlList_urlList_"+i+"_urlExists_ybr", plasmaSearchRankingProcess.ybr(entry.hash()));+ prop.putNum("genUrlList_urlList_"+i+"_urlExists_ybr", RankingProcess.ybr(entry.hash()));prop.putNum("genUrlList_urlList_"+i+"_urlExists_tf", 1000.0 * entry.word().termFrequency());prop.putNum("genUrlList_urlList_"+i+"_urlExists_authority", (ranked.getOrder() == null) ? -1 : ranked.getOrder().authority(entry.hash()));prop.put("genUrlList_urlList_"+i+"_urlExists_date", DateFormatter.formatShortDay(new Date(entry.word().lastModified())));@@ -477,9 +477,9 @@ public class IndexControlRWIs_p {prop.put("searchresult_hosts", hc);}- public static plasmaSearchRankingProcess genSearchresult(final serverObjects prop, final plasmaSwitchboard sb, final byte[] keyhash, final Bitfield filter) {- final Query query = new Query(new String(keyhash), -1, sb.getRanking(), filter);- final plasmaSearchRankingProcess ranked = new plasmaSearchRankingProcess(sb.indexSegment, query, Integer.MAX_VALUE, 1);+ public static RankingProcess genSearchresult(final serverObjects prop, final plasmaSwitchboard sb, final byte[] keyhash, final Bitfield filter) {+ final QueryParams query = new QueryParams(new String(keyhash), -1, sb.getRanking(), filter);+ final RankingProcess ranked = new RankingProcess(sb.indexSegment, query, Integer.MAX_VALUE, 1);ranked.execQuery();if (ranked.filteredCount() == 0) {diff --git a/htroot/Ranking_p.java b/htroot/Ranking_p.javaindex 30a28875c..6d09c171a 100644--- a/htroot/Ranking_p.java+++ b/htroot/Ranking_p.java@@ -30,10 +30,10 @@ import java.util.Map;import java.util.Map.Entry;import de.anomic.http.httpRequestHeader;-import de.anomic.plasma.plasmaSearchEvent;import de.anomic.plasma.plasmaSwitchboard;-import de.anomic.search.Query;+import de.anomic.search.QueryParams;import de.anomic.search.RankingProfile;+import de.anomic.search.QueryEvent;import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;import de.anomic.tools.crypt;@@ -132,14 +132,14 @@ public class Ranking_p {final plasmaSwitchboard sb = (plasmaSwitchboard) env;// clean up all search events- plasmaSearchEvent.cleanupEvents(true);+ QueryEvent.cleanupEvents(true);// case if no values are requestedif ((post == null) || (sb == null)) {// we create empty entries for template stringsfinal serverObjects prop = defaultValues();final RankingProfile ranking;- if(sb == null) ranking = new RankingProfile(Query.CONTENTDOM_TEXT);+ if(sb == null) ranking = new RankingProfile(QueryParams.CONTENTDOM_TEXT);else ranking = sb.getRanking();putRanking(prop, ranking, "local");return prop;@@ -156,7 +156,7 @@ public class Ranking_p {if (post.containsKey("ResetRanking")) {sb.setConfig("rankingProfile", "");- final RankingProfile ranking = new RankingProfile(Query.CONTENTDOM_TEXT);+ final RankingProfile ranking = new RankingProfile(QueryParams.CONTENTDOM_TEXT);final serverObjects prop = defaultValues();//prop.putAll(ranking.toExternalMap("local"));putRanking(prop, ranking, "local");diff --git a/htroot/SearchEventPicture.java b/htroot/SearchEventPicture.javaindex 238137d44..a49797ec1 100644--- a/htroot/SearchEventPicture.java+++ b/htroot/SearchEventPicture.java@@ -27,8 +27,8 @@import de.anomic.http.httpRequestHeader;import de.anomic.plasma.plasmaGrafics;-import de.anomic.plasma.plasmaSearchEvent;import de.anomic.plasma.plasmaSwitchboard;+import de.anomic.search.QueryEvent;import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;import de.anomic.ymage.ymageMatrix;@@ -39,7 +39,7 @@ public class SearchEventPicture {public static ymageMatrix respond(final httpRequestHeader header, final serverObjects post, final serverSwitch<?> env) {final plasmaSwitchboard sb = (plasmaSwitchboard) env;- final String eventID = (String) header.get("event", plasmaSearchEvent.lastEventID);+ final String eventID = (String) header.get("event", QueryEvent.lastEventID);if (eventID == null) return null;final ymageMatrix yp = plasmaGrafics.getSearchEventPicture(sb.peers, eventID);if (yp == null) return new ymageMatrix(1, 1, ymageMatrix.MODE_SUB, "000000"); // empty imagediff --git a/htroot/ViewFile.java b/htroot/ViewFile.javaindex 5e37ff69c..f12aa9599 100644--- a/htroot/ViewFile.java+++ b/htroot/ViewFile.java@@ -46,8 +46,8 @@ import de.anomic.http.httpDocument;import de.anomic.kelondro.text.metadataPrototype.URLMetadataRow;import de.anomic.kelondro.util.FileUtils;import de.anomic.plasma.plasmaHTCache;-import de.anomic.plasma.plasmaSnippetCache;import de.anomic.plasma.plasmaSwitchboard;+import de.anomic.search.SnippetCache;import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;import de.anomic.yacy.yacyURL;@@ -241,7 +241,7 @@ public class ViewFile {// parsing the resource contentDocument document = null;try {- document = plasmaSnippetCache.parseDocument(url, resourceLength, resource);+ document = SnippetCache.parseDocument(url, resourceLength, resource);if (document == null) {prop.put("error", "5");prop.put("error_errorText", "Unknown error");diff --git a/htroot/ViewImage.java b/htroot/ViewImage.javaindex fda92e8db..f9682343b 100644--- a/htroot/ViewImage.java+++ b/htroot/ViewImage.java@@ -32,8 +32,8 @@ import java.util.HashMap;import de.anomic.http.httpHeader;import de.anomic.http.httpRequestHeader;import de.anomic.kelondro.util.FileUtils;-import de.anomic.plasma.plasmaSnippetCache;import de.anomic.plasma.plasmaSwitchboard;+import de.anomic.search.SnippetCache;import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;import de.anomic.yacy.yacyURL;@@ -87,7 +87,7 @@ public class ViewImage {if (scaled == null) {Object[] resource = null;if (url != null) try {- resource = plasmaSnippetCache.getResource(url, true, timeout, false, true);+ resource = SnippetCache.getResource(url, true, timeout, false, true);} catch (IOException e) {Log.logWarning("ViewImage", "cannot load: " + e.getMessage());}diff --git a/htroot/api/timeline.java b/htroot/api/timeline.javaindex a5b7c653e..8c6e443cf 100644--- a/htroot/api/timeline.java+++ b/htroot/api/timeline.java@@ -36,7 +36,7 @@ import de.anomic.kelondro.text.TermSearch;import de.anomic.kelondro.text.referencePrototype.WordReference;import de.anomic.kelondro.util.DateFormatter;import de.anomic.plasma.plasmaSwitchboard;-import de.anomic.search.Query;+import de.anomic.search.QueryParams;import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;import de.anomic.tools.iso639;@@ -63,7 +63,7 @@ public final class timeline {language = (agent == null) ? "en" : iso639.userAgentLanguageDetection(agent);if (language == null) language = "en";}- final TreeSet<String>[] query = Query.cleanQuery(querystring); // converts also umlaute+ final TreeSet<String>[] query = QueryParams.cleanQuery(querystring); // converts also umlauteTreeSet<byte[]> q = Word.words2hashes(query[0]);// tell all threads to do nothing for a specific time@@ -108,7 +108,7 @@ public final class timeline {// logyacyCore.log.logInfo("EXIT TIMELINE SEARCH: " +- Query.anonymizedQueryHashes(q) + " - " + joincount + " links found, " ++ QueryParams.anonymizedQueryHashes(q) + " - " + joincount + " links found, " +prop.get("linkcount", "?") + " links selected, " +indexabstractContainercount + " index abstracts, " +(System.currentTimeMillis() - timestamp) + " milliseconds");diff --git a/htroot/index.java b/htroot/index.javaindex b6e906df2..d5ff3cacc 100644--- a/htroot/index.java+++ b/htroot/index.java@@ -32,7 +32,7 @@import de.anomic.http.httpRequestHeader;import de.anomic.plasma.plasmaSwitchboard;import de.anomic.plasma.plasmaSwitchboardConstants;-import de.anomic.search.Query;+import de.anomic.search.QueryParams;import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;@@ -79,13 +79,13 @@ public class index {//global = global && indexDistributeGranted && indexReceiveGranted;// search domain- int contentdom = Query.CONTENTDOM_TEXT;+ int contentdom = QueryParams.CONTENTDOM_TEXT;final String cds = (post == null) ? "text" : post.get("contentdom", "text");- if (cds.equals("text")) contentdom = Query.CONTENTDOM_TEXT;- if (cds.equals("audio")) contentdom = Query.CONTENTDOM_AUDIO;- if (cds.equals("video")) contentdom = Query.CONTENTDOM_VIDEO;- if (cds.equals("image")) contentdom = Query.CONTENTDOM_IMAGE;- if (cds.equals("app")) contentdom = Query.CONTENTDOM_APP;+ if (cds.equals("text")) contentdom = QueryParams.CONTENTDOM_TEXT;+ if (cds.equals("audio")) contentdom = QueryParams.CONTENTDOM_AUDIO;+ if (cds.equals("video")) contentdom = QueryParams.CONTENTDOM_VIDEO;+ if (cds.equals("image")) contentdom = QueryParams.CONTENTDOM_IMAGE;+ if (cds.equals("app")) contentdom = QueryParams.CONTENTDOM_APP;// we create empty entries for template stringsString promoteSearchPageGreeting = env.getConfig(plasmaSwitchboardConstants.GREETING, "");@@ -120,11 +120,11 @@ public class index {prop.put("display", display);prop.putHTML("constraint", constraint);prop.put("searchoptions_display", display);- prop.put("contentdomCheckText", (contentdom == Query.CONTENTDOM_TEXT) ? "1" : "0");- prop.put("contentdomCheckAudio", (contentdom == Query.CONTENTDOM_AUDIO) ? "1" : "0");- prop.put("contentdomCheckVideo", (contentdom == Query.CONTENTDOM_VIDEO) ? "1" : "0");- prop.put("contentdomCheckImage", (contentdom == Query.CONTENTDOM_IMAGE) ? "1" : "0");- prop.put("contentdomCheckApp", (contentdom == Query.CONTENTDOM_APP) ? "1" : "0");+ prop.put("contentdomCheckText", (contentdom == QueryParams.CONTENTDOM_TEXT) ? "1" : "0");+ prop.put("contentdomCheckAudio", (contentdom == QueryParams.CONTENTDOM_AUDIO) ? "1" : "0");+ prop.put("contentdomCheckVideo", (contentdom == QueryParams.CONTENTDOM_VIDEO) ? "1" : "0");+ prop.put("contentdomCheckImage", (contentdom == QueryParams.CONTENTDOM_IMAGE) ? "1" : "0");+ prop.put("contentdomCheckApp", (contentdom == QueryParams.CONTENTDOM_APP) ? "1" : "0");// online caution timingsb.localSearchLastAccess = System.currentTimeMillis();diff --git a/htroot/yacy/search.java b/htroot/yacy/search.javaindex 22938d19a..36aa0c50e 100644--- a/htroot/yacy/search.java+++ b/htroot/yacy/search.java@@ -45,12 +45,12 @@ import de.anomic.kelondro.text.referencePrototype.WordReference;import de.anomic.kelondro.util.SortStack;import de.anomic.net.natLib;import de.anomic.plasma.plasmaProfiling;-import de.anomic.plasma.plasmaSearchEvent;import de.anomic.plasma.plasmaSwitchboard;-import de.anomic.plasma.plasmaSearchEvent.ResultEntry;-import de.anomic.plasma.plasmaSearchRankingProcess.NavigatorEntry;-import de.anomic.search.Query;+import de.anomic.search.QueryParams;import de.anomic.search.RankingProfile;+import de.anomic.search.QueryEvent;+import de.anomic.search.QueryEvent.ResultEntry;+import de.anomic.search.RankingProcess.NavigatorEntry;import de.anomic.server.serverCore;import de.anomic.server.serverObjects;import de.anomic.server.serverProfiling;@@ -158,7 +158,7 @@ public final class search {// tell all threads to do nothing for a specific timesb.intermissionAllThreads(3000);- final TreeSet<byte[]> abstractSet = ((abstracts.length() == 0) || (abstracts.equals("auto"))) ? null : Query.hashes2Set(abstracts);+ final TreeSet<byte[]> abstractSet = ((abstracts.length() == 0) || (abstracts.equals("auto"))) ? null : QueryParams.hashes2Set(abstracts);// store accessing peerfinal yacySeed remoteSeed = yacySeed.genRemoteSeed(oseed, key, false);@@ -169,23 +169,23 @@ public final class search {}// prepare search- final TreeSet<byte[]> queryhashes = Query.hashes2Set(query);- final TreeSet<byte[]> excludehashes = (exclude.length() == 0) ? new TreeSet<byte[]>(Base64Order.enhancedCoder) : Query.hashes2Set(exclude);+ final TreeSet<byte[]> queryhashes = QueryParams.hashes2Set(query);+ final TreeSet<byte[]> excludehashes = (exclude.length() == 0) ? new TreeSet<byte[]>(Base64Order.enhancedCoder) : QueryParams.hashes2Set(exclude);final long timestamp = System.currentTimeMillis();// prepare a search profile- final RankingProfile rankingProfile = (profile.length() == 0) ? new RankingProfile(Query.contentdomParser(contentdom)) : new RankingProfile("", profile);+ final RankingProfile rankingProfile = (profile.length() == 0) ? new RankingProfile(QueryParams.contentdomParser(contentdom)) : new RankingProfile("", profile);// prepare an abstract resultfinal StringBuilder indexabstract = new StringBuilder();int indexabstractContainercount = 0;int joincount = 0;- Query theQuery = null;+ QueryParams theQuery = null;ArrayList<SortStack<ResultEntry>.stackElement> accu = null;- plasmaSearchEvent theSearch = null;+ QueryEvent theSearch = null;if ((query.length() == 0) && (abstractSet != null)) {// this is _not_ a normal search, only a request for index abstracts- theQuery = new Query(+ theQuery = new QueryParams(null,abstractSet,new TreeSet<byte[]>(Base64Order.enhancedCoder),@@ -194,14 +194,14 @@ public final class search {rankingProfile,maxdist,prefer,- Query.contentdomParser(contentdom),+ QueryParams.contentdomParser(contentdom),language,"", // no navigationfalse,count,0,filter,- Query.SEARCHDOM_LOCAL,+ QueryParams.SEARCHDOM_LOCAL,-1,null,false,@@ -210,14 +210,14 @@ public final class search {yacyURL.TLD_any_zone_filter,client,false);- theQuery.domType = Query.SEARCHDOM_LOCAL;- yacyCore.log.logInfo("INIT HASH SEARCH (abstracts only): " + Query.anonymizedQueryHashes(theQuery.queryHashes) + " - " + theQuery.displayResults() + " links");+ theQuery.domType = QueryParams.SEARCHDOM_LOCAL;+ yacyCore.log.logInfo("INIT HASH SEARCH (abstracts only): " + QueryParams.anonymizedQueryHashes(theQuery.queryHashes) + " - " + theQuery.displayResults() + " links");final long timer = System.currentTimeMillis();//final Map<byte[], ReferenceContainer<WordReference>>[] containers = sb.indexSegment.index().searchTerm(theQuery.queryHashes, theQuery.excludeHashes, plasmaSearchQuery.hashes2StringSet(urls));- final HashMap<byte[], ReferenceContainer<WordReference>> incc = sb.indexSegment.termIndex().searchConjunction(theQuery.queryHashes, Query.hashes2StringSet(urls));+ final HashMap<byte[], ReferenceContainer<WordReference>> incc = sb.indexSegment.termIndex().searchConjunction(theQuery.queryHashes, QueryParams.hashes2StringSet(urls));- serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(theQuery.id(true), plasmaSearchEvent.COLLECTION, incc.size(), System.currentTimeMillis() - timer), false);+ serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(theQuery.id(true), QueryEvent.COLLECTION, incc.size(), System.currentTimeMillis() - timer), false);if (incc != null) {final Iterator<Map.Entry<byte[], ReferenceContainer<WordReference>>> ci = incc.entrySet().iterator();Map.Entry<byte[], ReferenceContainer<WordReference>> entry;@@ -237,7 +237,7 @@ public final class search {} else {// retrieve index containers from search request- theQuery = new Query(+ theQuery = new QueryParams(null,queryhashes,excludehashes,@@ -246,7 +246,7 @@ public final class search {rankingProfile,maxdist,prefer,- Query.+ QueryParams.contentdomParser(contentdom),language,"", // no navigation@@ -254,7 +254,7 @@ public final class search {count,0,filter,- Query.SEARCHDOM_LOCAL,+ QueryParams.SEARCHDOM_LOCAL,-1,constraint,false,@@ -263,12 +263,12 @@ public final class search {yacyURL.TLD_any_zone_filter,client,false);- theQuery.domType = Query.SEARCHDOM_LOCAL;- yacyCore.log.logInfo("INIT HASH SEARCH (query-" + abstracts + "): " + Query.anonymizedQueryHashes(theQuery.queryHashes) + " - " + theQuery.displayResults() + " links");- RSSFeed.channels(RSSFeed.REMOTESEARCH).addMessage(new RSSMessage("Remote Search Request from " + ((remoteSeed == null) ? "unknown" : remoteSeed.getName()), Query.anonymizedQueryHashes(theQuery.queryHashes), ""));+ theQuery.domType = QueryParams.SEARCHDOM_LOCAL;+ yacyCore.log.logInfo("INIT HASH SEARCH (query-" + abstracts + "): " + QueryParams.anonymizedQueryHashes(theQuery.queryHashes) + " - " + theQuery.displayResults() + " links");+ RSSFeed.channels(RSSFeed.REMOTESEARCH).addMessage(new RSSMessage("Remote Search Request from " + ((remoteSeed == null) ? "unknown" : remoteSeed.getName()), QueryParams.anonymizedQueryHashes(theQuery.queryHashes), ""));// make event- theSearch = plasmaSearchEvent.getEvent(theQuery, sb.indexSegment, sb.peers, sb.crawlResults, null, true);+ theSearch = QueryEvent.getEvent(theQuery, sb.indexSegment, sb.peers, sb.crawlResults, null, true);// set statistic details of search result and find best result index setif (theSearch.getRankingResult().getLocalResourceSize() == 0) {@@ -350,7 +350,7 @@ public final class search {final long timer = System.currentTimeMillis();final StringBuilder links = new StringBuilder();String resource = null;- SortStack<plasmaSearchEvent.ResultEntry>.stackElement entry;+ SortStack<QueryEvent.ResultEntry>.stackElement entry;for (int i = 0; i < accu.size(); i++) {entry = accu.get(i);resource = entry.element.resource();@@ -383,7 +383,7 @@ public final class search {// logyacyCore.log.logInfo("EXIT HASH SEARCH: " +- Query.anonymizedQueryHashes(theQuery.queryHashes) + " - " + joincount + " links found, " ++ QueryParams.anonymizedQueryHashes(theQuery.queryHashes) + " - " + joincount + " links found, " +prop.get("linkcount", "?") + " links selected, " +indexabstractContainercount + " index abstracts, " +(System.currentTimeMillis() - timestamp) + " milliseconds");diff --git a/htroot/yacysearch.java b/htroot/yacysearch.javaindex 72cc7d96b..a71047296 100644--- a/htroot/yacysearch.java+++ b/htroot/yacysearch.java@@ -44,12 +44,12 @@ import de.anomic.kelondro.text.metadataPrototype.URLMetadataRow;import de.anomic.kelondro.util.MemoryControl;import de.anomic.kelondro.util.SetTools;import de.anomic.plasma.plasmaProfiling;-import de.anomic.plasma.plasmaSearchEvent;-import de.anomic.plasma.plasmaSnippetCache;import de.anomic.plasma.plasmaSwitchboard;import de.anomic.plasma.plasmaSwitchboardConstants;-import de.anomic.search.Query;+import de.anomic.search.QueryParams;import de.anomic.search.RankingProfile;+import de.anomic.search.QueryEvent;+import de.anomic.search.SnippetCache;import de.anomic.server.serverCore;import de.anomic.server.serverDomains;import de.anomic.server.serverObjects;@@ -178,10 +178,10 @@ public class yacysearch {if (clustersearch) global = true; // switches search on, but search target is limited to cluster nodes// find search domain- final int contentdomCode = Query.contentdomParser((post == null ? "text" : post.get("contentdom", "text")));+ final int contentdomCode = QueryParams.contentdomParser((post == null ? "text" : post.get("contentdom", "text")));// patch until better search profiles are available- if ((contentdomCode != Query.CONTENTDOM_TEXT) && (itemsPerPage <= 32)) itemsPerPage = 32;+ if ((contentdomCode != QueryParams.CONTENTDOM_TEXT) && (itemsPerPage <= 32)) itemsPerPage = 32;// check the search trackerTreeSet<Long> trackerHandles = sb.localSearchTracker.get(client);@@ -228,7 +228,7 @@ public class yacysearch {// check available memory and clean up if necessaryif (!MemoryControl.request(8000000L, false)) {sb.indexSegment.urlMetadata().clearCache();- plasmaSearchEvent.cleanupEvents(true);+ QueryEvent.cleanupEvents(true);}final RankingProfile ranking = sb.getRanking();@@ -347,7 +347,7 @@ public class yacysearch {String navigation = (post == null) ? "" : post.get("nav", "");// the query- final TreeSet<String>[] query = Query.cleanQuery(querystring.trim()); // converts also umlaute+ final TreeSet<String>[] query = QueryParams.cleanQuery(querystring.trim()); // converts also umlauteint maxDistance = (querystring.indexOf('"') >= 0) ? maxDistance = query.length - 1 : Integer.MAX_VALUE;@@ -389,7 +389,7 @@ public class yacysearch {if (urlentry != null) {final URLMetadataRow.Components metadata = urlentry.metadata();Document document;- document = plasmaSnippetCache.retrieveDocument(metadata.url(), true, 5000, true, false);+ document = SnippetCache.retrieveDocument(metadata.url(), true, 5000, true, false);if (document != null) {// create a news messagefinal HashMap<String, String> map = new HashMap<String, String>();@@ -410,7 +410,7 @@ public class yacysearch {// do the searchfinal TreeSet<byte[]> queryHashes = Word.words2hashes(query[0]);- final Query theQuery = new Query(+ final QueryParams theQuery = new QueryParams(originalquerystring,queryHashes,Word.words2hashes(query[1]),@@ -426,8 +426,8 @@ public class yacysearch {itemsPerPage,offset,urlmask,- (clustersearch && globalsearch) ? Query.SEARCHDOM_CLUSTERALL :- ((globalsearch) ? Query.SEARCHDOM_GLOBALDHT : Query.SEARCHDOM_LOCAL),+ (clustersearch && globalsearch) ? QueryParams.SEARCHDOM_CLUSTERALL :+ ((globalsearch) ? QueryParams.SEARCHDOM_GLOBALDHT : QueryParams.SEARCHDOM_LOCAL),20,constraint,true,@@ -436,7 +436,7 @@ public class yacysearch {yacyURL.TLD_any_zone_filter,client,authenticated);- serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(theQuery.id(true), plasmaSearchEvent.INITIALIZATION, 0, 0), false);+ serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(theQuery.id(true), QueryEvent.INITIALIZATION, 0, 0), false);// tell all threads to do nothing for a specific timesb.intermissionAllThreads(10000);@@ -445,16 +445,16 @@ public class yacysearch {theQuery.filterOut(plasmaSwitchboard.blueList);// log- Log.logInfo("LOCAL_SEARCH", "INIT WORD SEARCH: " + theQuery.queryString + ":" + Query.hashSet2hashString(theQuery.queryHashes) + " - " + theQuery.neededResults() + " links to be computed, " + theQuery.displayResults() + " lines to be displayed");+ Log.logInfo("LOCAL_SEARCH", "INIT WORD SEARCH: " + theQuery.queryString + ":" + QueryParams.hashSet2hashString(theQuery.queryHashes) + " - " + theQuery.neededResults() + " links to be computed, " + theQuery.displayResults() + " lines to be displayed");RSSFeed.channels(RSSFeed.LOCALSEARCH).addMessage(new RSSMessage("Local Search Request", theQuery.queryString, ""));final long timestamp = System.currentTimeMillis();// create a new search event- if (plasmaSearchEvent.getEvent(theQuery.id(false)) == null) {+ if (QueryEvent.getEvent(theQuery.id(false)) == null) {theQuery.setOffset(0); // in case that this is a new search, always start without a offsetoffset = 0;}- final plasmaSearchEvent theSearch = plasmaSearchEvent.getEvent(theQuery, sb.indexSegment, sb.peers, sb.crawlResults, (sb.isRobinsonMode()) ? sb.clusterhashes : null, false);+ final QueryEvent theSearch = QueryEvent.getEvent(theQuery, sb.indexSegment, sb.peers, sb.crawlResults, (sb.isRobinsonMode()) ? sb.clusterhashes : null, false);// generate result object//serverLog.logFine("LOCAL_SEARCH", "SEARCH TIME AFTER ORDERING OF SEARCH RESULTS: " + (System.currentTimeMillis() - timestamp) + " ms");@@ -544,7 +544,7 @@ public class yacysearch {resnav.append("<img src=\"env/grafics/navdl.gif\" width=\"16\" height=\"16\"> ");} else {resnav.append("<a href=\"");- resnav.append(Query.navurl("html", thispage - 1, display, theQuery, originalUrlMask, null, navigation));+ resnav.append(QueryParams.navurl("html", thispage - 1, display, theQuery, originalUrlMask, null, navigation));resnav.append("\"><img src=\"env/grafics/navdl.gif\" width=\"16\" height=\"16\"></a> ");}final int numberofpages = Math.min(10, Math.min(thispage + 2, totalcount / theQuery.displayResults()));@@ -555,7 +555,7 @@ public class yacysearch {resnav.append(".gif\" width=\"16\" height=\"16\"> ");} else {resnav.append("<a href=\"");- resnav.append(Query.navurl("html", i, display, theQuery, originalUrlMask, null, navigation));+ resnav.append(QueryParams.navurl("html", i, display, theQuery, originalUrlMask, null, navigation));resnav.append("\"><img src=\"env/grafics/navd");resnav.append(i + 1);resnav.append(".gif\" width=\"16\" height=\"16\"></a> ");@@ -565,7 +565,7 @@ public class yacysearch {resnav.append("<img src=\"env/grafics/navdr.gif\" width=\"16\" height=\"16\">");} else {resnav.append("<a href=\"");- resnav.append(Query.navurl("html", thispage + 1, display, theQuery, originalUrlMask, null, navigation));+ resnav.append(QueryParams.navurl("html", thispage + 1, display, theQuery, originalUrlMask, null, navigation));resnav.append("\"><img src=\"env/grafics/navdr.gif\" width=\"16\" height=\"16\"></a>");}prop.put("num-results_resnav", resnav.toString());@@ -621,11 +621,11 @@ public class yacysearch {prop.put("constraint", (constraint == null) ? "" : constraint.exportB64());prop.put("verify", (fetchSnippets) ? "true" : "false");prop.put("contentdom", (post == null ? "text" : post.get("contentdom", "text")));- prop.put("contentdomCheckText", (contentdomCode == Query.CONTENTDOM_TEXT) ? "1" : "0");- prop.put("contentdomCheckAudio", (contentdomCode == Query.CONTENTDOM_AUDIO) ? "1" : "0");- prop.put("contentdomCheckVideo", (contentdomCode == Query.CONTENTDOM_VIDEO) ? "1" : "0");- prop.put("contentdomCheckImage", (contentdomCode == Query.CONTENTDOM_IMAGE) ? "1" : "0");- prop.put("contentdomCheckApp", (contentdomCode == Query.CONTENTDOM_APP) ? "1" : "0");+ prop.put("contentdomCheckText", (contentdomCode == QueryParams.CONTENTDOM_TEXT) ? "1" : "0");+ prop.put("contentdomCheckAudio", (contentdomCode == QueryParams.CONTENTDOM_AUDIO) ? "1" : "0");+ prop.put("contentdomCheckVideo", (contentdomCode == QueryParams.CONTENTDOM_VIDEO) ? "1" : "0");+ prop.put("contentdomCheckImage", (contentdomCode == QueryParams.CONTENTDOM_IMAGE) ? "1" : "0");+ prop.put("contentdomCheckApp", (contentdomCode == QueryParams.CONTENTDOM_APP) ? "1" : "0");// for RSS: don't HTML encode some elementsprop.putXML("rss_query", originalquerystring);diff --git a/htroot/yacysearchitem.java b/htroot/yacysearchitem.javaindex b68ff1d18..d3f47f77f 100644--- a/htroot/yacysearchitem.java+++ b/htroot/yacysearchitem.java@@ -33,11 +33,11 @@ import java.util.TreeSet;import de.anomic.http.httpHeader;import de.anomic.http.httpRequestHeader;import de.anomic.plasma.plasmaProfiling;-import de.anomic.plasma.plasmaSearchEvent;-import de.anomic.plasma.plasmaSearchRankingProcess;-import de.anomic.plasma.plasmaSnippetCache;import de.anomic.plasma.plasmaSwitchboard;-import de.anomic.search.Query;+import de.anomic.search.QueryParams;+import de.anomic.search.QueryEvent;+import de.anomic.search.RankingProcess;+import de.anomic.search.SnippetCache;import de.anomic.server.serverObjects;import de.anomic.server.serverProfiling;import de.anomic.server.serverSwitch;@@ -73,12 +73,12 @@ public class yacysearchitem {prop.put("dynamic", "0");// find search event- final plasmaSearchEvent theSearch = plasmaSearchEvent.getEvent(eventID);+ final QueryEvent theSearch = QueryEvent.getEvent(eventID);if (theSearch == null) {// the event does not exist, show empty pagereturn prop;}- final Query theQuery = theSearch.getQuery();+ final QueryParams theQuery = theSearch.getQuery();// dynamically update count valuesfinal int offset = theQuery.neededResults() - theQuery.displayResults() + 1;@@ -90,11 +90,11 @@ public class yacysearchitem {prop.put("remoteIndexCount", Formatter.number(theSearch.getRankingResult().getRemoteIndexCount(), true));prop.put("remotePeerCount", Formatter.number(theSearch.getRankingResult().getRemotePeerCount(), true));- if (theQuery.contentdom == Query.CONTENTDOM_TEXT) {+ if (theQuery.contentdom == QueryParams.CONTENTDOM_TEXT) {// text search// generate result object- final plasmaSearchEvent.ResultEntry result = theSearch.oneResult(item);+ final QueryEvent.ResultEntry result = theSearch.oneResult(item);if (result == null) return prop; // no content@@ -125,7 +125,7 @@ public class yacysearchitem {prop.putHTML("content_urlname", nxTools.shortenURLString(result.urlname(), urllength));prop.put("content_date", plasmaSwitchboard.dateString(result.modified()));prop.put("content_date822", plasmaSwitchboard.dateString822(result.modified()));- prop.put("content_ybr", plasmaSearchRankingProcess.ybr(result.hash()));+ prop.put("content_ybr", RankingProcess.ybr(result.hash()));prop.putHTML("content_size", Integer.toString(result.filesize())); // we don't use putNUM here because that number shall be usable as sorting key. To print the size, use 'sizename'prop.putHTML("content_sizename", sizename(result.filesize()));prop.putHTML("content_host", result.url().getHost());@@ -142,21 +142,21 @@ public class yacysearchitem {prop.put("content_rankingprops", result.word().toPropertyForm() + ", domLengthEstimated=" + yacyURL.domLengthEstimation(result.hash()) +((yacyURL.probablyRootURL(result.hash())) ? ", probablyRootURL" : "") +(((wordURL = yacyURL.probablyWordURL(result.hash(), query[0])) != null) ? ", probablyWordURL=" + wordURL.toNormalform(false, true) : ""));- final plasmaSnippetCache.TextSnippet snippet = result.textSnippet();+ final SnippetCache.TextSnippet snippet = result.textSnippet();final String desc = (snippet == null) ? "" : snippet.getLineMarked(theQuery.fullqueryHashes);prop.put("content_description", desc);prop.putXML("content_description-xml", desc);prop.putJSON("content_description-json", desc);- serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(theQuery.id(true), plasmaSearchEvent.FINALIZATION + "-" + item, 0, 0), false);+ serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(theQuery.id(true), QueryEvent.FINALIZATION + "-" + item, 0, 0), false);return prop;}- if (theQuery.contentdom == Query.CONTENTDOM_IMAGE) {+ if (theQuery.contentdom == QueryParams.CONTENTDOM_IMAGE) {// image search; shows thumbnailsprop.put("content", theQuery.contentdom + 1); // switch on specific content- final plasmaSnippetCache.MediaSnippet ms = theSearch.oneImage(item);+ final SnippetCache.MediaSnippet ms = theSearch.oneImage(item);if (ms == null) {prop.put("content_items", "0");} else {@@ -172,20 +172,20 @@ public class yacysearchitem {return prop;}- if ((theQuery.contentdom == Query.CONTENTDOM_AUDIO) ||- (theQuery.contentdom == Query.CONTENTDOM_VIDEO) ||- (theQuery.contentdom == Query.CONTENTDOM_APP)) {+ if ((theQuery.contentdom == QueryParams.CONTENTDOM_AUDIO) ||+ (theQuery.contentdom == QueryParams.CONTENTDOM_VIDEO) ||+ (theQuery.contentdom == QueryParams.CONTENTDOM_APP)) {// any other media content// generate result object- final plasmaSearchEvent.ResultEntry result = theSearch.oneResult(item);+ final QueryEvent.ResultEntry result = theSearch.oneResult(item);if (result == null) return prop; // no contentprop.put("content", theQuery.contentdom + 1); // switch on specific content- final ArrayList<plasmaSnippetCache.MediaSnippet> media = result.mediaSnippets();+ final ArrayList<SnippetCache.MediaSnippet> media = result.mediaSnippets();if (item == 0) col = true;if (media != null) {- plasmaSnippetCache.MediaSnippet ms;+ SnippetCache.MediaSnippet ms;int c = 0;for (int i = 0; i < media.size(); i++) {ms = media.get(i);diff --git a/htroot/yacysearchtrailer.java b/htroot/yacysearchtrailer.javaindex b0a7ecba4..16a72fa6e 100644--- a/htroot/yacysearchtrailer.java+++ b/htroot/yacysearchtrailer.java@@ -29,9 +29,9 @@ import java.util.Iterator;import de.anomic.http.httpRequestHeader;import de.anomic.plasma.plasmaProfiling;-import de.anomic.plasma.plasmaSearchEvent;-import de.anomic.plasma.plasmaSearchRankingProcess.NavigatorEntry;-import de.anomic.search.Query;+import de.anomic.search.QueryParams;+import de.anomic.search.QueryEvent;+import de.anomic.search.RankingProcess.NavigatorEntry;import de.anomic.server.serverObjects;import de.anomic.server.serverProfiling;import de.anomic.server.serverSwitch;@@ -48,12 +48,12 @@ public class yacysearchtrailer {final int display = post.getInt("display", 0);// find search event- final plasmaSearchEvent theSearch = plasmaSearchEvent.getEvent(eventID);+ final QueryEvent theSearch = QueryEvent.getEvent(eventID);if (theSearch == null) {// the event does not exist, show empty pagereturn prop;}- final Query theQuery = theSearch.getQuery();+ final QueryParams theQuery = theSearch.getQuery();// compose search navigation@@ -68,8 +68,8 @@ public class yacysearchtrailer {for (i = 0; i < hostNavigator.size(); i++) {entry = hostNavigator.get(i);prop.put("nav-domains_element_" + i + "_name", entry.name);- prop.put("nav-domains_element_" + i + "_url", "<a href=\"" + Query.navurl("html", 0, display, theQuery, theQuery.urlMask, "site:" + entry.name, theQuery.navigators) + "\">" + entry.name + " (" + entry.count + ")</a>");- prop.putJSON("nav-domains_element_" + i + "_url-json", Query.navurl("json", 0, display, theQuery, theQuery.urlMask, "site:" + entry.name, theQuery.navigators));+ prop.put("nav-domains_element_" + i + "_url", "<a href=\"" + QueryParams.navurl("html", 0, display, theQuery, theQuery.urlMask, "site:" + entry.name, theQuery.navigators) + "\">" + entry.name + " (" + entry.count + ")</a>");+ prop.putJSON("nav-domains_element_" + i + "_url-json", QueryParams.navurl("json", 0, display, theQuery, theQuery.urlMask, "site:" + entry.name, theQuery.navigators));prop.put("nav-domains_element_" + i + "_count", entry.count);prop.put("nav-domains_element_" + i + "_modifier", "site:" + entry.name);prop.put("nav-domains_element_" + i + "_nl", 1);@@ -92,8 +92,8 @@ public class yacysearchtrailer {entry = authorNavigator.get(i);anav = (entry.name.indexOf(' ') < 0) ? "author:" + entry.name : "author:'" + entry.name + "'";prop.put("nav-authors_element_" + i + "_name", entry.name);- prop.put("nav-authors_element_" + i + "_url", "<a href=\"" + Query.navurl("html", 0, display, theQuery, theQuery.urlMask, anav, theQuery.navigators) + "\">" + entry.name + " (" + entry.count + ")</a>");- prop.putJSON("nav-authors_element_" + i + "_url-json", Query.navurl("json", 0, display, theQuery, theQuery.urlMask, anav, theQuery.navigators));+ prop.put("nav-authors_element_" + i + "_url", "<a href=\"" + QueryParams.navurl("html", 0, display, theQuery, theQuery.urlMask, anav, theQuery.navigators) + "\">" + entry.name + " (" + entry.count + ")</a>");+ prop.putJSON("nav-authors_element_" + i + "_url-json", QueryParams.navurl("json", 0, display, theQuery, theQuery.urlMask, anav, theQuery.navigators));prop.put("nav-authors_element_" + i + "_count", entry.count);prop.put("nav-authors_element_" + i + "_modifier", "author:'" + entry.name + "'");prop.put("nav-authors_element_" + i + "_nl", 1);@@ -114,8 +114,8 @@ public class yacysearchtrailer {if (/*(theQuery == null) ||*/ (theQuery.queryString == null)) break;if (e != null && e.name != null) {prop.putHTML("nav-topics_element_" + i + "_name", e.name);- prop.put("nav-topics_element_" + i + "_url", "<a href=\"" + Query.navurl("html", 0, display, theQuery, theQuery.urlMask, e.name, theQuery.navigators) + "\">" + e.name + " (" + e.count + ")</a>");- prop.putJSON("nav-topics_element_" + i + "_url-json", Query.navurl("json", 0, display, theQuery, theQuery.urlMask, e.name, theQuery.navigators));+ prop.put("nav-topics_element_" + i + "_url", "<a href=\"" + QueryParams.navurl("html", 0, display, theQuery, theQuery.urlMask, e.name, theQuery.navigators) + "\">" + e.name + " (" + e.count + ")</a>");+ prop.putJSON("nav-topics_element_" + i + "_url-json", QueryParams.navurl("json", 0, display, theQuery, theQuery.urlMask, e.name, theQuery.navigators));prop.put("nav-topics_element_" + i + "_count", e.count);prop.put("nav-topics_element_" + i + "_modifier", e.name);prop.put("nav-topics_element_" + i + "_nl", (iter.hasNext() && i < MAX_TOPWORDS) ? 1 : 0);@@ -127,7 +127,7 @@ public class yacysearchtrailer {prop.put("nav-topics_element", i);prop.put("nav-topics", "1");- serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(theQuery.id(true), plasmaSearchEvent.FINALIZATION + "-" + "bottomline", 0, 0), false);+ serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(theQuery.id(true), QueryEvent.FINALIZATION + "-" + "bottomline", 0, 0), false);return prop;}diff --git a/source/de/anomic/kelondro/text/ReferenceOrder.java b/source/de/anomic/kelondro/text/ReferenceOrder.javaindex a82083eb4..a814055ff 100644--- a/source/de/anomic/kelondro/text/ReferenceOrder.java+++ b/source/de/anomic/kelondro/text/ReferenceOrder.java@@ -37,8 +37,8 @@ import de.anomic.kelondro.text.referencePrototype.WordReference;import de.anomic.kelondro.text.referencePrototype.WordReferenceRow;import de.anomic.kelondro.text.referencePrototype.WordReferenceVars;import de.anomic.kelondro.util.ScoreCluster;-import de.anomic.plasma.plasmaSearchRankingProcess;import de.anomic.search.RankingProfile;+import de.anomic.search.RankingProcess;import de.anomic.server.serverProcessor;import de.anomic.yacy.yacyURL;@@ -125,7 +125,7 @@ public class ReferenceOrder {int minminpos = min.minposition();final long r =((256 - yacyURL.domLengthNormalized(t.metadataHash())) << ranking.coeff_domlength)- + ((ranking.coeff_ybr > 12) ? ((256 - (plasmaSearchRankingProcess.ybr(t.metadataHash()) << 4)) << ranking.coeff_ybr) : 0)+ + ((ranking.coeff_ybr > 12) ? ((256 - (RankingProcess.ybr(t.metadataHash()) << 4)) << ranking.coeff_ybr) : 0)+ ((max.urlcomps() == min.urlcomps() ) ? 0 : (256 - (((t.urlcomps() - min.urlcomps() ) << 8) / (max.urlcomps() - min.urlcomps()) )) << ranking.coeff_urlcomps)+ ((max.urllength() == min.urllength() ) ? 0 : (256 - (((t.urllength() - min.urllength() ) << 8) / (max.urllength() - min.urllength()) )) << ranking.coeff_urllength)+ ((maxmaxpos == minminpos ) ? 0 : (256 - (((t.minposition() - minminpos ) << 8) / (maxmaxpos - minminpos) )) << ranking.coeff_posintext)diff --git a/source/de/anomic/kelondro/text/metadataPrototype/URLMetadataRow.java b/source/de/anomic/kelondro/text/metadataPrototype/URLMetadataRow.javaindex 21c1f24f7..7c5dcbe03 100644--- a/source/de/anomic/kelondro/text/metadataPrototype/URLMetadataRow.java+++ b/source/de/anomic/kelondro/text/metadataPrototype/URLMetadataRow.java@@ -45,7 +45,7 @@ import de.anomic.kelondro.text.referencePrototype.WordReferenceRow;import de.anomic.kelondro.util.DateFormatter;import de.anomic.kelondro.util.FileUtils;import de.anomic.kelondro.util.kelondroException;-import de.anomic.search.Query;+import de.anomic.search.QueryParams;import de.anomic.server.serverCharBuffer;import de.anomic.server.serverCodings;import de.anomic.tools.crypt;@@ -254,7 +254,7 @@ public class URLMetadataRow implements Metadata {this.entry.setCol(col_wc, Integer.parseInt(prop.getProperty("wc", "0")));this.entry.setCol(col_dt, new byte[]{(byte) prop.getProperty("dt", "t").charAt(0)});final String flags = prop.getProperty("flags", "AAAAAA");- this.entry.setCol(col_flags, (flags.length() > 6) ? Query.empty_constraint.bytes() : (new Bitfield(4, flags)).bytes());+ this.entry.setCol(col_flags, (flags.length() > 6) ? QueryParams.empty_constraint.bytes() : (new Bitfield(4, flags)).bytes());try {this.entry.setCol(col_lang, prop.getProperty("lang", "uk").getBytes("UTF-8"));} catch (UnsupportedEncodingException e) {diff --git a/source/de/anomic/plasma/plasmaGrafics.java b/source/de/anomic/plasma/plasmaGrafics.javaindex f6556a878..8c2b90266 100644--- a/source/de/anomic/plasma/plasmaGrafics.java+++ b/source/de/anomic/plasma/plasmaGrafics.java@@ -35,7 +35,8 @@ import java.awt.image.BufferedImage;import java.util.Date;import java.util.Iterator;-import de.anomic.search.Query;+import de.anomic.search.QueryParams;+import de.anomic.search.QueryEvent;import de.anomic.yacy.yacySearch;import de.anomic.yacy.yacySeed;import de.anomic.yacy.yacySeedDB;@@ -109,7 +110,7 @@ public class plasmaGrafics {private static long bannerPictureDate = 0; // [MN]public static ymageMatrix getSearchEventPicture(final yacySeedDB seedDB, final String eventID) {- final plasmaSearchEvent event = plasmaSearchEvent.getEvent(eventID);+ final QueryEvent event = QueryEvent.getEvent(eventID);if (event == null) return null;final yacySearch[] primarySearches = event.getPrimarySearchThreads();final yacySearch[] secondarySearches = event.getSecondarySearchThreads();@@ -145,7 +146,7 @@ public class plasmaGrafics {}// draw in the search target- final Query query = event.getQuery();+ final QueryParams query = event.getQuery();final Iterator<byte[]> i = query.queryHashes.iterator();eventPicture.setColor(ymageMatrix.GREY);while (i.hasNext()) {diff --git a/source/de/anomic/plasma/plasmaRankingRCIEvaluation.java b/source/de/anomic/plasma/plasmaRankingRCIEvaluation.javaindex 4fac48e89..4595b47b1 100644--- a/source/de/anomic/plasma/plasmaRankingRCIEvaluation.java+++ b/source/de/anomic/plasma/plasmaRankingRCIEvaluation.java@@ -38,6 +38,7 @@ import de.anomic.kelondro.order.Base64Order;import de.anomic.kelondro.order.Digest;import de.anomic.kelondro.util.AttrSeq;import de.anomic.kelondro.util.FileUtils;+import de.anomic.search.RankingProcess;import de.anomic.yacy.yacyURL;public class plasmaRankingRCIEvaluation {@@ -209,7 +210,7 @@ public class plasmaRankingRCIEvaluation {final File root_path = new File(args[1]);// load a partition table- plasmaSearchRankingProcess.loadYBR(new File(root_path, "ranking/YBR"), 16);+ RankingProcess.loadYBR(new File(root_path, "ranking/YBR"), 16);// load domain list and generate hash index for domainsfinal HashMap<String, String> dommap = genReverseDomHash(new File(root_path, "domlist.txt"));@@ -218,8 +219,8 @@ public class plasmaRankingRCIEvaluation {String hash, dom;for (int i = 0; i < 9; i++) {System.out.print("YBR-" + i + ": ");- for (int j = 0; j < plasmaSearchRankingProcess.ybrTables[i].size(); j++) {- hash = new String(plasmaSearchRankingProcess.ybrTables[i].get(j));+ for (int j = 0; j < RankingProcess.ybrTables[i].size(); j++) {+ hash = new String(RankingProcess.ybrTables[i].get(j));dom = dommap.get(hash);if (dom == null) System.out.print("[" + hash + "], "); else System.out.print(dom + ", ");}diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.javaindex a6c961028..0b43a0265 100644--- a/source/de/anomic/plasma/plasmaSwitchboard.java+++ b/source/de/anomic/plasma/plasmaSwitchboard.java@@ -167,8 +167,11 @@ import de.anomic.kelondro.util.FileUtils;import de.anomic.kelondro.util.MemoryControl;import de.anomic.kelondro.util.SetTools;import de.anomic.net.UPnP;-import de.anomic.search.Query;+import de.anomic.search.QueryParams;import de.anomic.search.RankingProfile;+import de.anomic.search.QueryEvent;+import de.anomic.search.RankingProcess;+import de.anomic.search.SnippetCache;import de.anomic.server.serverAbstractSwitch;import de.anomic.server.serverBusyThread;import de.anomic.server.serverCore;@@ -251,8 +254,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.public bookmarksDB bookmarksDB;public plasmaWebStructure webStructure;public ImporterManager dbImportManager;- public ArrayList<Query> localSearches; // array of search result properties as HashMaps- public ArrayList<Query> remoteSearches; // array of search result properties as HashMaps+ public ArrayList<QueryParams> localSearches; // array of search result properties as HashMaps+ public ArrayList<QueryParams> remoteSearches; // array of search result properties as HashMapspublic ConcurrentHashMap<String, TreeSet<Long>> localSearchTracker, remoteSearchTracker; // mappings from requesting host to a TreeSet of Long(access time)public long indexedPages = 0;public double requestedQueries = 0d;@@ -456,7 +459,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.// load ranking tablesfinal File YBRPath = new File(rootPath, "ranking/YBR");if (YBRPath.exists()) {- plasmaSearchRankingProcess.loadYBR(YBRPath, 15);+ RankingProcess.loadYBR(YBRPath, 15);}// loading the robots.txt db@@ -553,8 +556,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.// init search history trackersthis.localSearchTracker = new ConcurrentHashMap<String, TreeSet<Long>>(); // String:TreeSet - IP:set of Long(accessTime)this.remoteSearchTracker = new ConcurrentHashMap<String, TreeSet<Long>>();- this.localSearches = new ArrayList<Query>(); // contains search result properties as HashMaps- this.remoteSearches = new ArrayList<Query>();+ this.localSearches = new ArrayList<QueryParams>(); // contains search result properties as HashMaps+ this.remoteSearches = new ArrayList<QueryParams>();// init messages: clean up message symbolfinal File notifierSource = new File(getRootPath(), getConfig(plasmaSwitchboardConstants.HTROOT_PATH, plasmaSwitchboardConstants.HTROOT_PATH_DEFAULT) + "/env/grafics/empty.gif");@@ -589,7 +592,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.// generate snippets cachelog.logConfig("Initializing Snippet Cache");- plasmaSnippetCache.init(log, this);+ SnippetCache.init(log, this);// init the wikiwikiParser = new wikiCode(this.peers.mySeed().getClusterAddress());@@ -800,7 +803,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.// trigger online cautionproxyLastAccess = System.currentTimeMillis() + 10000; // at least 10 seconds online caution to prevent unnecessary action on database meanwhile// clean search events which have cached relations to the old index- plasmaSearchEvent.cleanupEvents(true);+ QueryEvent.cleanupEvents(true);// switch the networkssynchronized (this) {@@ -1035,7 +1038,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.public RankingProfile getRanking() {return (getConfig("rankingProfile", "").length() == 0) ?- new RankingProfile(Query.CONTENTDOM_TEXT) :+ new RankingProfile(QueryParams.CONTENTDOM_TEXT) :new RankingProfile("", crypt.simpleDecode(sb.getConfig("rankingProfile", ""), null));}@@ -1235,7 +1238,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.public void deQueueFreeMem() {// empty some cachesindexSegment.urlMetadata().clearCache();- plasmaSearchEvent.cleanupEvents(true);+ QueryEvent.cleanupEvents(true);}public IndexingStack.QueueEntry deQueue() {@@ -1426,7 +1429,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.// clear caches if necessaryif (!MemoryControl.request(8000000L, false)) {indexSegment.urlMetadata().clearCache();- plasmaSearchEvent.cleanupEvents(true);+ QueryEvent.cleanupEvents(true);}// set a random password if no password is configured@@ -1916,7 +1919,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.// get the resource contentObject[] resource = null;try {- resource = plasmaSnippetCache.getResource(metadata.url(), fetchOnline, 10000, true, false);+ resource = SnippetCache.getResource(metadata.url(), fetchOnline, 10000, true, false);} catch (IOException e) {Log.logWarning("removeAllUrlReferences", "cannot load: " + e.getMessage());}@@ -1929,7 +1932,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.final Long resourceContentLength = (Long) resource[1];// parse the resource- final Document document = plasmaSnippetCache.parseDocument(metadata.url(), resourceContentLength.longValue(), resourceContent);+ final Document document = SnippetCache.parseDocument(metadata.url(), resourceContentLength.longValue(), resourceContent);// get the word setSet<String> words = null;diff --git a/source/de/anomic/search/ImageCollector.java b/source/de/anomic/search/ImageCollector.javaindex d0a5dfc2e..f729b6c29 100644--- a/source/de/anomic/search/ImageCollector.java+++ b/source/de/anomic/search/ImageCollector.java@@ -33,7 +33,6 @@ import de.anomic.document.Document;import de.anomic.document.parser.html.ContentScraper;import de.anomic.document.parser.html.ImageEntry;import de.anomic.kelondro.util.DateFormatter;-import de.anomic.plasma.plasmaSnippetCache;import de.anomic.yacy.yacyURL;import de.anomic.yacy.logging.Log;@@ -47,7 +46,7 @@ public final class ImageCollector {if (maxTime > 10) {Object[] resource = null;try {- resource = plasmaSnippetCache.getResource(url, true, (int) maxTime, false, indexing);+ resource = SnippetCache.getResource(url, true, (int) maxTime, false, indexing);} catch (IOException e) {Log.logWarning("ViewImage", "cannot load: " + e.getMessage());}@@ -58,7 +57,7 @@ public final class ImageCollector {Document document = null;try {// parse the document- document = plasmaSnippetCache.parseDocument(url, resLength.longValue(), res);+ document = SnippetCache.parseDocument(url, resLength.longValue(), res);} catch (final ParserException e) {// parsing failedLog.logWarning("ViewImage", "cannot parse: " + e.getMessage());diff --git a/source/de/anomic/search/IndexCollector.java b/source/de/anomic/search/IndexCollector.javaindex c5f4add60..eb77736e9 100644--- a/source/de/anomic/search/IndexCollector.java+++ b/source/de/anomic/search/IndexCollector.java@@ -44,8 +44,7 @@ import de.anomic.kelondro.text.referencePrototype.WordReference;import de.anomic.kelondro.text.referencePrototype.WordReferenceVars;import de.anomic.kelondro.util.SortStack;import de.anomic.plasma.plasmaProfiling;-import de.anomic.plasma.plasmaSearchEvent;-import de.anomic.search.Query;+import de.anomic.search.QueryParams;import de.anomic.server.serverProfiling;import de.anomic.yacy.yacyURL;@@ -56,7 +55,7 @@ public final class IndexCollector extends Thread {public static final ReferenceContainer<WordReference> poison = ReferenceContainer.emptyContainer(Segment.wordReferenceFactory, null, 0);private final SortStack<WordReferenceVars> stack;- private final Query query;+ private final QueryParams query;private final int maxentries;private int remote_peerCount, remote_indexCount, remote_resourceSize, local_resourceSize;private final ReferenceOrder order;@@ -70,7 +69,7 @@ public final class IndexCollector extends Thread {public IndexCollector(final Segment indexSegment,- final Query query,+ final QueryParams query,final int maxentries,final int concurrency) {// we collect the urlhashes and construct a list with urlEntry objects@@ -146,14 +145,14 @@ public final class IndexCollector extends Thread {ReferenceContainer<WordReference> index = search.joined();insertRanked(index, true, index.size());- serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(query.id(true), plasmaSearchEvent.JOIN, index.size(), System.currentTimeMillis() - timer), false);+ serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(query.id(true), QueryEvent.JOIN, index.size(), System.currentTimeMillis() - timer), false);try {while ((index = this.rwiQueue.take()) != poison) {// normalize entriesfinal ArrayList<WordReferenceVars> decodedEntries = this.order.normalizeWith(index);- serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(query.id(true), plasmaSearchEvent.NORMALIZING, index.size(), System.currentTimeMillis() - timer), false);+ serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(query.id(true), QueryEvent.NORMALIZING, index.size(), System.currentTimeMillis() - timer), false);// iterate over normalized entries and select some that are better than currently storedtimer = System.currentTimeMillis();@@ -181,11 +180,11 @@ public final class IndexCollector extends Thread {if (!testFlags(iEntry)) continue;// check document domain- if (query.contentdom != Query.CONTENTDOM_TEXT) {- if ((query.contentdom == Query.CONTENTDOM_AUDIO) && (!(iEntry.flags().get(Condenser.flag_cat_hasaudio)))) continue;- if ((query.contentdom == Query.CONTENTDOM_VIDEO) && (!(iEntry.flags().get(Condenser.flag_cat_hasvideo)))) continue;- if ((query.contentdom == Query.CONTENTDOM_IMAGE) && (!(iEntry.flags().get(Condenser.flag_cat_hasimage)))) continue;- if ((query.contentdom == Query.CONTENTDOM_APP ) && (!(iEntry.flags().get(Condenser.flag_cat_hasapp )))) continue;+ if (query.contentdom != QueryParams.CONTENTDOM_TEXT) {+ if ((query.contentdom == QueryParams.CONTENTDOM_AUDIO) && (!(iEntry.flags().get(Condenser.flag_cat_hasaudio)))) continue;+ if ((query.contentdom == QueryParams.CONTENTDOM_VIDEO) && (!(iEntry.flags().get(Condenser.flag_cat_hasvideo)))) continue;+ if ((query.contentdom == QueryParams.CONTENTDOM_IMAGE) && (!(iEntry.flags().get(Condenser.flag_cat_hasimage)))) continue;+ if ((query.contentdom == QueryParams.CONTENTDOM_APP ) && (!(iEntry.flags().get(Condenser.flag_cat_hasapp )))) continue;}// check tld domain@@ -235,7 +234,7 @@ public final class IndexCollector extends Thread {e.printStackTrace();}//if ((query.neededResults() > 0) && (container.size() > query.neededResults())) remove(true, true);- serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(query.id(true), plasmaSearchEvent.PRESORT, index.size(), System.currentTimeMillis() - timer), false);+ serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(query.id(true), QueryEvent.PRESORT, index.size(), System.currentTimeMillis() - timer), false);}public Map<byte[], ReferenceContainer<WordReference>> searchContainerMap() {diff --git a/source/de/anomic/plasma/plasmaSearchEvent.java b/source/de/anomic/search/QueryEvent.javasimilarity index 88%rename from source/de/anomic/plasma/plasmaSearchEvent.javarename to source/de/anomic/search/QueryEvent.javaindex 7c0ffc8ba..2c990ff5a 100644--- a/source/de/anomic/plasma/plasmaSearchEvent.java+++ b/source/de/anomic/search/QueryEvent.java@@ -24,7 +24,7 @@// 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.plasma;+package de.anomic.search;import java.io.IOException;import java.util.ArrayList;@@ -51,9 +51,10 @@ import de.anomic.kelondro.util.MemoryControl;import de.anomic.kelondro.util.SetTools;import de.anomic.kelondro.util.SortStack;import de.anomic.kelondro.util.SortStore;-import de.anomic.plasma.plasmaSearchRankingProcess.NavigatorEntry;-import de.anomic.plasma.plasmaSnippetCache.MediaSnippet;-import de.anomic.search.Query;+import de.anomic.plasma.plasmaProfiling;+import de.anomic.plasma.plasmaSwitchboard;+import de.anomic.search.RankingProcess.NavigatorEntry;+import de.anomic.search.SnippetCache.MediaSnippet;import de.anomic.server.serverProfiling;import de.anomic.yacy.yacySearch;import de.anomic.yacy.yacySeed;@@ -62,7 +63,7 @@ import de.anomic.yacy.yacyURL;import de.anomic.yacy.dht.FlatWordPartitionScheme;import de.anomic.yacy.logging.Log;-public final class plasmaSearchEvent {+public final class QueryEvent {public static final String INITIALIZATION = "initialization";public static final String COLLECTION = "collection";@@ -74,15 +75,15 @@ public final class plasmaSearchEvent {private final static int workerThreadCount = 10;public static String lastEventID = "";- private static ConcurrentHashMap<String, plasmaSearchEvent> lastEvents = new ConcurrentHashMap<String, plasmaSearchEvent>(); // a cache for objects from this class: re-use old search requests+ private static ConcurrentHashMap<String, QueryEvent> lastEvents = new ConcurrentHashMap<String, QueryEvent>(); // a cache for objects from this class: re-use old search requestspublic static final long eventLifetime = 60000; // the time an event will stay in the cache, 1 Minuteprivate static final int max_results_preparation = 1000;private long eventTime;- Query query;+ QueryParams query;private final Segment indexSegment;private final yacySeedDB peers;- plasmaSearchRankingProcess rankedCache; // ordered search results, grows dynamically as all the query threads enrich this container+ RankingProcess rankedCache; // ordered search results, grows dynamically as all the query threads enrich this containerprivate final Map<String, TreeMap<String, String>> rcAbstracts; // cache for index abstracts; word:TreeMap mapping where the embedded TreeMap is a urlhash:peerlist relationprivate yacySearch[] primarySearchThreads, secondarySearchThreads;private Thread localSearchThread;@@ -93,7 +94,7 @@ public final class plasmaSearchEvent {public byte[] IAmaxcounthash, IAneardhthash;private resultWorker[] workerThreads;SortStore<ResultEntry> result;- SortStore<plasmaSnippetCache.MediaSnippet> images; // container to sort images by size+ SortStore<SnippetCache.MediaSnippet> images; // container to sort images by sizeHashMap<String, String> failedURLs; // a mapping from a urlhash to a fail reason stringTreeSet<byte[]> snippetFetchWordHashes; // a set of word hashes that are used to match with the snippetslong urlRetrievalAllTime;@@ -101,7 +102,7 @@ public final class plasmaSearchEvent {public ResultURLs crawlResults;@SuppressWarnings("unchecked")- private plasmaSearchEvent(final Query query,+ private QueryEvent(final QueryParams query,final Segment indexSegment,final yacySeedDB peers,final ResultURLs crawlResults,@@ -125,7 +126,7 @@ public final class plasmaSearchEvent {this.workerThreads = null;this.localSearchThread = null;this.result = new SortStore<ResultEntry>(-1); // this is the result, enriched with snippets, ranked and ordered by ranking- this.images = new SortStore<plasmaSnippetCache.MediaSnippet>(-1);+ this.images = new SortStore<SnippetCache.MediaSnippet>(-1);this.failedURLs = new HashMap<String, String>(); // a map of urls to reason strings where a worker thread tried to work on, but failed.// snippets do not need to match with the complete query hashes,@@ -137,12 +138,12 @@ public final class plasmaSearchEvent {}final long start = System.currentTimeMillis();- if ((query.domType == Query.SEARCHDOM_GLOBALDHT) ||- (query.domType == Query.SEARCHDOM_CLUSTERALL)) {+ if ((query.domType == QueryParams.SEARCHDOM_GLOBALDHT) ||+ (query.domType == QueryParams.SEARCHDOM_CLUSTERALL)) {// initialize a ranking process that is the target for data// that is generated concurrently from local and global search threads- this.rankedCache = new plasmaSearchRankingProcess(indexSegment, query, max_results_preparation, 16);+ this.rankedCache = new RankingProcess(indexSegment, query, max_results_preparation, 16);// start a local searchlocalSearchThread = new localSearchProcess();@@ -153,8 +154,8 @@ public final class plasmaSearchEvent {final int fetchpeers = 12;Log.logFine("SEARCH_EVENT", "STARTING " + fetchpeers + " THREADS TO CATCH EACH " + query.displayResults() + " URLs");this.primarySearchThreads = yacySearch.primaryRemoteSearches(- Query.hashSet2hashString(query.queryHashes),- Query.hashSet2hashString(query.excludeHashes),+ QueryParams.hashSet2hashString(query.queryHashes),+ QueryParams.hashSet2hashString(query.excludeHashes),"",query.prefer,query.urlMask,@@ -172,14 +173,14 @@ public final class plasmaSearchEvent {plasmaSwitchboard.urlBlacklist,query.ranking,query.constraint,- (query.domType == Query.SEARCHDOM_GLOBALDHT) ? null : preselectedPeerHashes);+ (query.domType == QueryParams.SEARCHDOM_GLOBALDHT) ? null : preselectedPeerHashes);serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(query.id(true), "remote search thread start", this.primarySearchThreads.length, System.currentTimeMillis() - timer), false);// finished searchingLog.logFine("SEARCH_EVENT", "SEARCH TIME AFTER GLOBAL-TRIGGER TO " + primarySearchThreads.length + " PEERS: " + ((System.currentTimeMillis() - start) / 1000) + " seconds");} else {// do a local search- this.rankedCache = new plasmaSearchRankingProcess(indexSegment, query, max_results_preparation, 2);+ this.rankedCache = new RankingProcess(indexSegment, query, max_results_preparation, 2);this.rankedCache.execQuery();//CrawlSwitchboard.Finding finding = wordIndex.retrieveURLs(query, false, 2, ranking, process);@@ -249,8 +250,8 @@ public final class plasmaSearchEvent {public static void cleanupEvents(final boolean all) {// remove old events in the event cache- final Iterator<plasmaSearchEvent> i = lastEvents.values().iterator();- plasmaSearchEvent cleanEvent;+ final Iterator<QueryEvent> i = lastEvents.values().iterator();+ QueryEvent cleanEvent;while (i.hasNext()) {cleanEvent = i.next();if ((all) || (cleanEvent.eventTime + eventLifetime < System.currentTimeMillis())) {@@ -304,9 +305,9 @@ public final class plasmaSearchEvent {final long dbRetrievalTime = System.currentTimeMillis() - startTime;// check exclusion- if ((Query.matches(pagetitle, query.excludeHashes)) ||- (Query.matches(pageurl, query.excludeHashes)) ||- (Query.matches(pageauthor, query.excludeHashes))) {+ if ((QueryParams.matches(pagetitle, query.excludeHashes)) ||+ (QueryParams.matches(pageurl, query.excludeHashes)) ||+ (QueryParams.matches(pageauthor, query.excludeHashes))) {return null;}@@ -325,19 +326,19 @@ public final class plasmaSearchEvent {return null;}- if ((query.contentdom == Query.CONTENTDOM_AUDIO) && (page.laudio() == 0)) {+ if ((query.contentdom == QueryParams.CONTENTDOM_AUDIO) && (page.laudio() == 0)) {registerFailure(page.hash(), "contentdom-audio constraint not fullfilled");return null;}- if ((query.contentdom == Query.CONTENTDOM_VIDEO) && (page.lvideo() == 0)) {+ if ((query.contentdom == QueryParams.CONTENTDOM_VIDEO) && (page.lvideo() == 0)) {registerFailure(page.hash(), "contentdom-video constraint not fullfilled");return null;}- if ((query.contentdom == Query.CONTENTDOM_IMAGE) && (page.limage() == 0)) {+ if ((query.contentdom == QueryParams.CONTENTDOM_IMAGE) && (page.limage() == 0)) {registerFailure(page.hash(), "contentdom-image constraint not fullfilled");return null;}- if ((query.contentdom == Query.CONTENTDOM_APP) && (page.lapp() == 0)) {+ if ((query.contentdom == QueryParams.CONTENTDOM_APP) && (page.lapp() == 0)) {registerFailure(page.hash(), "contentdom-app constraint not fullfilled");return null;}@@ -347,10 +348,10 @@ public final class plasmaSearchEvent {}// load snippet- if (query.contentdom == Query.CONTENTDOM_TEXT) {+ if (query.contentdom == QueryParams.CONTENTDOM_TEXT) {// attach text snippetstartTime = System.currentTimeMillis();- final plasmaSnippetCache.TextSnippet snippet = plasmaSnippetCache.retrieveTextSnippet(metadata, snippetFetchWordHashes, (snippetFetchMode == 2), ((query.constraint != null) && (query.constraint.get(Condenser.flag_cat_indexof))), 180, (snippetFetchMode == 2) ? Integer.MAX_VALUE : 30000, query.isGlobal());+ final SnippetCache.TextSnippet snippet = SnippetCache.retrieveTextSnippet(metadata, snippetFetchWordHashes, (snippetFetchMode == 2), ((query.constraint != null) && (query.constraint.get(Condenser.flag_cat_indexof))), 180, (snippetFetchMode == 2) ? Integer.MAX_VALUE : 30000, query.isGlobal());final long snippetComputationTime = System.currentTimeMillis() - startTime;Log.logInfo("SEARCH_EVENT", "text snippet load time for " + metadata.url() + ": " + snippetComputationTime + ", " + ((snippet.getErrorCode() < 11) ? "snippet found" : ("no snippet found (" + snippet.getError() + ")")));@@ -366,7 +367,7 @@ public final class plasmaSearchEvent {registerFailure(page.hash(), "no text snippet for URL " + metadata.url());if (!peers.mySeed().isVirgin())try {- plasmaSnippetCache.failConsequences(snippet, query.id(false));+ SnippetCache.failConsequences(snippet, query.id(false));} catch (IOException e) {e.printStackTrace();}@@ -375,7 +376,7 @@ public final class plasmaSearchEvent {} else {// attach media informationstartTime = System.currentTimeMillis();- final ArrayList<MediaSnippet> mediaSnippets = plasmaSnippetCache.retrieveMediaSnippets(metadata.url(), snippetFetchWordHashes, query.contentdom, (snippetFetchMode == 2), 6000, query.isGlobal());+ final ArrayList<MediaSnippet> mediaSnippets = SnippetCache.retrieveMediaSnippets(metadata.url(), snippetFetchWordHashes, query.contentdom, (snippetFetchMode == 2), 6000, query.isGlobal());final long snippetComputationTime = System.currentTimeMillis() - startTime;Log.logInfo("SEARCH_EVENT", "media snippet load time for " + metadata.url() + ": " + snippetComputationTime);@@ -430,7 +431,7 @@ public final class plasmaSearchEvent {return count;}- public Query getQuery() {+ public QueryParams getQuery() {return query;}@@ -442,7 +443,7 @@ public final class plasmaSearchEvent {return secondarySearchThreads;}- public plasmaSearchRankingProcess getRankingResult() {+ public RankingProcess getRankingResult() {return this.rankedCache;}@@ -454,12 +455,12 @@ public final class plasmaSearchEvent {return this.snippetComputationAllTime;}- public static plasmaSearchEvent getEvent(final String eventID) {+ public static QueryEvent getEvent(final String eventID) {return lastEvents.get(eventID);}- public static plasmaSearchEvent getEvent(- final Query query,+ public static QueryEvent getEvent(+ final QueryParams query,final Segment indexSegment,final yacySeedDB peers,final ResultURLs crawlResults,@@ -467,7 +468,7 @@ public final class plasmaSearchEvent {final boolean generateAbstracts) {String id = query.id(false);- plasmaSearchEvent event = lastEvents.get(id);+ QueryEvent event = lastEvents.get(id);if (plasmaSwitchboard.getSwitchboard().crawlQueues.noticeURL.size() > 0 && event != null && System.currentTimeMillis() - event.eventTime > 60000) {// if a local crawl is ongoing, don't use the result from the cache to use possibly more results that come from the current crawl// to prevent that this happens during a person switches between the different result pages, a re-search happens no more than@@ -484,11 +485,11 @@ public final class plasmaSearchEvent {}if (event == null) {// generate a new event- event = new plasmaSearchEvent(query, indexSegment, peers, crawlResults, preselectedPeerHashes, generateAbstracts);+ event = new QueryEvent(query, indexSegment, peers, crawlResults, preselectedPeerHashes, generateAbstracts);} else {// if worker threads had been alive, but did not succeed, start them again to fetch missing linksif ((!event.anyWorkerAlive()) &&- (((query.contentdom == Query.CONTENTDOM_IMAGE) && (event.images.size() + 30 < query.neededResults())) ||+ (((query.contentdom == QueryParams.CONTENTDOM_IMAGE) && (event.images.size() + 30 < query.neededResults())) ||(event.result.size() < query.neededResults() + 10)) &&//(event.query.onlineSnippetFetch) &&(event.getRankingResult().getLocalResourceSize() + event.getRankingResult().getRemoteResourceSize() > event.result.size())) {@@ -533,8 +534,8 @@ public final class plasmaSearchEvent {this.lastLifeSign = System.currentTimeMillis();// check if we have enough- if ((query.contentdom == Query.CONTENTDOM_IMAGE) && (images.size() >= query.neededResults() + fetchAhead)) break;- if ((query.contentdom != Query.CONTENTDOM_IMAGE) && (result.size() >= query.neededResults() + fetchAhead)) break;+ if ((query.contentdom == QueryParams.CONTENTDOM_IMAGE) && (images.size() >= query.neededResults() + fetchAhead)) break;+ if ((query.contentdom != QueryParams.CONTENTDOM_IMAGE) && (result.size() >= query.neededResults() + fetchAhead)) break;// get next entrypage = rankedCache.bestURL(true);@@ -601,8 +602,8 @@ public final class plasmaSearchEvent {// we have the wanted result already in the result array .. return thatreturn this.result.element(item).element;}- if ((query.domType == Query.SEARCHDOM_GLOBALDHT) ||- (query.domType == Query.SEARCHDOM_CLUSTERALL)) {+ if ((query.domType == QueryParams.SEARCHDOM_GLOBALDHT) ||+ (query.domType == QueryParams.SEARCHDOM_CLUSTERALL)) {// this is a search using remote search threads. Also the local// search thread is started as background processif ((localSearchThread != null) && (localSearchThread.isAlive())) {@@ -638,7 +639,7 @@ public final class plasmaSearchEvent {return re;}- public plasmaSnippetCache.MediaSnippet oneImage(final int item) {+ public SnippetCache.MediaSnippet oneImage(final int item) {// check if we already retrieved this item (happens if a search pages is accessed a second time)if (this.images.sizeStore() > item) {// we have the wanted result already in the result array .. return that@@ -649,11 +650,11 @@ public final class plasmaSearchEvent {final int count = Math.min(5, Math.max(1, 10 * this.result.size() / (item + 1)));for (int i = 0; i < count; i++) {// generate result object- final plasmaSearchEvent.ResultEntry result = nextResult();- plasmaSnippetCache.MediaSnippet ms;+ final QueryEvent.ResultEntry result = nextResult();+ SnippetCache.MediaSnippet ms;if (result != null) {// iterate over all images in the result- final ArrayList<plasmaSnippetCache.MediaSnippet> imagemedia = result.mediaSnippets();+ final ArrayList<SnippetCache.MediaSnippet> imagemedia = result.mediaSnippets();if (imagemedia != null) {for (int j = 0; j < imagemedia.size(); j++) {ms = imagemedia.get(j);@@ -788,8 +789,8 @@ public final class plasmaSearchEvent {private final URLMetadataRow.Components urlcomps; // buffer for componentsprivate String alternative_urlstring;private String alternative_urlname;- private final plasmaSnippetCache.TextSnippet textSnippet;- private final ArrayList<plasmaSnippetCache.MediaSnippet> mediaSnippets;+ private final SnippetCache.TextSnippet textSnippet;+ private final ArrayList<SnippetCache.MediaSnippet> mediaSnippets;// statistic objectspublic long dbRetrievalTime, snippetComputationTime;@@ -797,8 +798,8 @@ public final class plasmaSearchEvent {public ResultEntry(final URLMetadataRow urlentry,final Segment indexSegment,yacySeedDB peers,- final plasmaSnippetCache.TextSnippet textSnippet,- final ArrayList<plasmaSnippetCache.MediaSnippet> mediaSnippets,+ final SnippetCache.TextSnippet textSnippet,+ final ArrayList<SnippetCache.MediaSnippet> mediaSnippets,final long dbRetrievalTime, final long snippetComputationTime) {this.urlentry = urlentry;this.urlcomps = urlentry.metadata();@@ -858,10 +859,10 @@ public final class plasmaSearchEvent {public String title() {return urlcomps.dc_title();}- public plasmaSnippetCache.TextSnippet textSnippet() {+ public SnippetCache.TextSnippet textSnippet() {return this.textSnippet;}- public ArrayList<plasmaSnippetCache.MediaSnippet> mediaSnippets() {+ public ArrayList<SnippetCache.MediaSnippet> mediaSnippets() {return this.mediaSnippets;}public Date modified() {diff --git a/source/de/anomic/search/Query.java b/source/de/anomic/search/QueryParams.javasimilarity index 96%rename from source/de/anomic/search/Query.javarename to source/de/anomic/search/QueryParams.javaindex bd092b750..f2a7abcee 100644--- a/source/de/anomic/search/Query.java+++ b/source/de/anomic/search/QueryParams.java@@ -38,7 +38,7 @@ import de.anomic.yacy.yacySeed;import de.anomic.yacy.yacySeedDB;import de.anomic.yacy.yacyURL;-public final class Query {+public final class QueryParams {public static final int SEARCHDOM_LOCAL = 0;public static final int SEARCHDOM_CLUSTERDHT = 1;@@ -83,7 +83,7 @@ public final class Query {public long searchtime, urlretrievaltime, snippetcomputationtime; // time to perform the search, to get all the urls, and to compute the snippetspublic boolean specialRights; // is true if the user has a special authorization and my use more database-extensive options- public Query(final String queryString,+ public QueryParams(final String queryString,final int lines,final RankingProfile ranking,final Bitfield constraint) {@@ -123,7 +123,7 @@ public final class Query {this.navigators = "all";}- public Query(+ public QueryParams(final String queryString, final TreeSet<byte[]> queryHashes,final TreeSet<byte[]> excludeHashes,final TreeSet<byte[]> fullqueryHashes,@@ -352,7 +352,7 @@ public final class Query {* @param addToQuery* @return*/- public static String navurl(String ext, final int page, final int display, final Query theQuery, final String originalUrlMask, String addToQuery, String nav) {+ public static String navurl(String ext, final int page, final int display, final QueryParams theQuery, final String originalUrlMask, String addToQuery, String nav) {return"/yacysearch." + ext + "?display=" + display +"&search=" + theQuery.queryString(true) + ((addToQuery == null) ? "" : "+" + addToQuery) +diff --git a/source/de/anomic/plasma/plasmaSearchRankingProcess.java b/source/de/anomic/search/RankingProcess.javasimilarity index 91%rename from source/de/anomic/plasma/plasmaSearchRankingProcess.javarename to source/de/anomic/search/RankingProcess.javaindex 50456c5d3..37610886c 100644--- a/source/de/anomic/plasma/plasmaSearchRankingProcess.java+++ b/source/de/anomic/search/RankingProcess.java@@ -24,7 +24,7 @@// 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.plasma;+package de.anomic.search;import java.io.File;import java.io.IOException;@@ -54,11 +54,14 @@ import de.anomic.kelondro.text.referencePrototype.WordReference;import de.anomic.kelondro.text.referencePrototype.WordReferenceVars;import de.anomic.kelondro.util.SortStack;import de.anomic.kelondro.util.FileUtils;-import de.anomic.search.Query;+import de.anomic.plasma.plasmaProfiling;+import de.anomic.plasma.plasmaSwitchboard;+import de.anomic.plasma.plasmaProfiling.searchEvent;+import de.anomic.search.QueryEvent.ResultEntry;import de.anomic.server.serverProfiling;import de.anomic.yacy.yacyURL;-public final class plasmaSearchRankingProcess {+public final class RankingProcess {public static BinSearch[] ybrTables = null; // block-rank tablespublic static final int maxYBR = 3; // the lower this value, the faster the search@@ -68,7 +71,7 @@ public final class plasmaSearchRankingProcess {private final SortStack<WordReferenceVars> stack;private final HashMap<String, SortStack<WordReferenceVars>> doubleDomCache; // key = domhash (6 bytes); value = like stackprivate final HashSet<String> handover; // key = urlhash; used for double-check of urls that had been handed over to search process- private final Query query;+ private final QueryParams query;private final int maxentries;private int remote_peerCount, remote_indexCount, remote_resourceSize, local_resourceSize;private final ReferenceOrder order;@@ -82,9 +85,9 @@ public final class plasmaSearchRankingProcess {private final ConcurrentHashMap<String, HostInfo> hostNavigator;private final ConcurrentHashMap<String, AuthorInfo> authorNavigator;- public plasmaSearchRankingProcess(+ public RankingProcess(final Segment indexSegment,- final Query query,+ final QueryParams query,final int maxentries,final int concurrency) {// we collect the urlhashes and construct a list with urlEntry objects@@ -132,7 +135,7 @@ public final class plasmaSearchRankingProcess {query.maxDistance);this.localSearchInclusion = search.inclusion();final ReferenceContainer<WordReference> index = search.joined();- serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(query.id(true), plasmaSearchEvent.JOIN, index.size(), System.currentTimeMillis() - timer), false);+ serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(query.id(true), QueryEvent.JOIN, index.size(), System.currentTimeMillis() - timer), false);if (index.size() == 0) {return;}@@ -157,7 +160,7 @@ public final class plasmaSearchRankingProcess {// normalize entriesfinal ArrayList<WordReferenceVars> decodedEntries = this.order.normalizeWith(index);- serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(query.id(true), plasmaSearchEvent.NORMALIZING, index.size(), System.currentTimeMillis() - timer), false);+ serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(query.id(true), QueryEvent.NORMALIZING, index.size(), System.currentTimeMillis() - timer), false);// iterate over normalized entries and select some that are better than currently storedtimer = System.currentTimeMillis();@@ -185,11 +188,11 @@ public final class plasmaSearchRankingProcess {if (!testFlags(iEntry)) continue;// check document domain- if (query.contentdom != Query.CONTENTDOM_TEXT) {- if ((query.contentdom == Query.CONTENTDOM_AUDIO) && (!(iEntry.flags().get(Condenser.flag_cat_hasaudio)))) continue;- if ((query.contentdom == Query.CONTENTDOM_VIDEO) && (!(iEntry.flags().get(Condenser.flag_cat_hasvideo)))) continue;- if ((query.contentdom == Query.CONTENTDOM_IMAGE) && (!(iEntry.flags().get(Condenser.flag_cat_hasimage)))) continue;- if ((query.contentdom == Query.CONTENTDOM_APP ) && (!(iEntry.flags().get(Condenser.flag_cat_hasapp )))) continue;+ if (query.contentdom != QueryParams.CONTENTDOM_TEXT) {+ if ((query.contentdom == QueryParams.CONTENTDOM_AUDIO) && (!(iEntry.flags().get(Condenser.flag_cat_hasaudio)))) continue;+ if ((query.contentdom == QueryParams.CONTENTDOM_VIDEO) && (!(iEntry.flags().get(Condenser.flag_cat_hasvideo)))) continue;+ if ((query.contentdom == QueryParams.CONTENTDOM_IMAGE) && (!(iEntry.flags().get(Condenser.flag_cat_hasimage)))) continue;+ if ((query.contentdom == QueryParams.CONTENTDOM_APP ) && (!(iEntry.flags().get(Condenser.flag_cat_hasapp )))) continue;}// check tld domain@@ -238,7 +241,7 @@ public final class plasmaSearchRankingProcess {}//if ((query.neededResults() > 0) && (container.size() > query.neededResults())) remove(true, true);- serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(query.id(true), plasmaSearchEvent.PRESORT, index.size(), System.currentTimeMillis() - timer), false);+ serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(query.id(true), QueryEvent.PRESORT, index.size(), System.currentTimeMillis() - timer), false);}private boolean testFlags(final WordReference ientry) {@@ -532,7 +535,7 @@ public final class plasmaSearchRankingProcess {}}- protected void addTopics(final plasmaSearchEvent.ResultEntry resultEntry) {+ protected void addTopics(final QueryEvent.ResultEntry resultEntry) {// take out relevant information for reference computationif ((resultEntry.url() == null) || (resultEntry.title() == null)) return;//final String[] urlcomps = htmlFilterContentScraper.urlComps(resultEntry.url().toNormalform(true, true)); // word components of the url@@ -619,16 +622,16 @@ public final class plasmaSearchRankingProcess {public long postRanking(final Set<String> topwords,- final plasmaSearchEvent.ResultEntry rentry,+ final QueryEvent.ResultEntry rentry,final int position) {long r = (255 - position) << 8;// for media search: prefer pages with many links- if (query.contentdom == Query.CONTENTDOM_IMAGE) r += rentry.limage() << query.ranking.coeff_cathasimage;- if (query.contentdom == Query.CONTENTDOM_AUDIO) r += rentry.laudio() << query.ranking.coeff_cathasaudio;- if (query.contentdom == Query.CONTENTDOM_VIDEO) r += rentry.lvideo() << query.ranking.coeff_cathasvideo;- if (query.contentdom == Query.CONTENTDOM_APP ) r += rentry.lapp() << query.ranking.coeff_cathasapp;+ if (query.contentdom == QueryParams.CONTENTDOM_IMAGE) r += rentry.limage() << query.ranking.coeff_cathasimage;+ if (query.contentdom == QueryParams.CONTENTDOM_AUDIO) r += rentry.laudio() << query.ranking.coeff_cathasaudio;+ if (query.contentdom == QueryParams.CONTENTDOM_VIDEO) r += rentry.lvideo() << query.ranking.coeff_cathasvideo;+ if (query.contentdom == QueryParams.CONTENTDOM_APP ) r += rentry.lapp() << query.ranking.coeff_cathasapp;// prefer hit with 'prefer' patternif (rentry.url().toNormalform(true, true).matches(query.prefer)) r += 256 << query.ranking.coeff_prefer;diff --git a/source/de/anomic/search/RankingProfile.java b/source/de/anomic/search/RankingProfile.javaindex ac8d7b428..8a5dba11f 100644--- a/source/de/anomic/search/RankingProfile.java+++ b/source/de/anomic/search/RankingProfile.java@@ -26,7 +26,7 @@ import java.util.HashMap;import java.util.Iterator;import java.util.Map;-import de.anomic.search.Query;+import de.anomic.search.QueryParams;public class RankingProfile {@@ -103,11 +103,11 @@ public class RankingProfile {coeff_app_dc_subject = 13;coeff_app_dc_description = 13;coeff_appemph = 10;- coeff_catindexof = (mediatype == Query.CONTENTDOM_TEXT) ? 0 : 15;- coeff_cathasimage = (mediatype == Query.CONTENTDOM_IMAGE) ? 15 : 0;- coeff_cathasaudio = (mediatype == Query.CONTENTDOM_AUDIO) ? 15 : 0;- coeff_cathasvideo = (mediatype == Query.CONTENTDOM_VIDEO) ? 15 : 0;- coeff_cathasapp = (mediatype == Query.CONTENTDOM_APP) ? 15 : 0;+ coeff_catindexof = (mediatype == QueryParams.CONTENTDOM_TEXT) ? 0 : 15;+ coeff_cathasimage = (mediatype == QueryParams.CONTENTDOM_IMAGE) ? 15 : 0;+ coeff_cathasaudio = (mediatype == QueryParams.CONTENTDOM_AUDIO) ? 15 : 0;+ coeff_cathasvideo = (mediatype == QueryParams.CONTENTDOM_VIDEO) ? 15 : 0;+ coeff_cathasapp = (mediatype == QueryParams.CONTENTDOM_APP) ? 15 : 0;coeff_termfrequency = 14;coeff_urlcompintoplist = 3;coeff_descrcompintoplist = 2;@@ -116,7 +116,7 @@ public class RankingProfile {}public RankingProfile(final String prefix, final String profile) {- this(Query.CONTENTDOM_TEXT); // set defaults+ this(QueryParams.CONTENTDOM_TEXT); // set defaultsif ((profile != null) && (profile.length() > 0)) {//parse external formfinal HashMap<String, Integer> coeff = new HashMap<String, Integer>();diff --git a/source/de/anomic/plasma/plasmaSnippetCache.java b/source/de/anomic/search/SnippetCache.javasimilarity index 96%rename from source/de/anomic/plasma/plasmaSnippetCache.javarename to source/de/anomic/search/SnippetCache.javaindex 1abdf3cbc..5e0a9e1ba 100644--- a/source/de/anomic/plasma/plasmaSnippetCache.java+++ b/source/de/anomic/search/SnippetCache.java@@ -22,7 +22,7 @@// 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.plasma;+package de.anomic.search;import java.io.ByteArrayInputStream;import java.io.IOException;@@ -52,12 +52,13 @@ import de.anomic.kelondro.order.Base64Order;import de.anomic.kelondro.text.metadataPrototype.URLMetadataRow;import de.anomic.kelondro.util.ScoreCluster;import de.anomic.kelondro.util.SetTools;-import de.anomic.search.Query;+import de.anomic.plasma.plasmaHTCache;+import de.anomic.plasma.plasmaSwitchboard;import de.anomic.yacy.yacySearch;import de.anomic.yacy.yacyURL;import de.anomic.yacy.logging.Log;-public class plasmaSnippetCache {+public class SnippetCache {private static final int maxCache = 500;@@ -707,10 +708,10 @@ public class plasmaSnippetCache {final Document document = retrieveDocument(url, fetchOnline, timeout, false, reindexing);final ArrayList<MediaSnippet> a = new ArrayList<MediaSnippet>();if (document != null) {- if ((mediatype == Query.CONTENTDOM_ALL) || (mediatype == Query.CONTENTDOM_AUDIO)) a.addAll(computeMediaSnippets(document, queryhashes, Query.CONTENTDOM_AUDIO));- if ((mediatype == Query.CONTENTDOM_ALL) || (mediatype == Query.CONTENTDOM_VIDEO)) a.addAll(computeMediaSnippets(document, queryhashes, Query.CONTENTDOM_VIDEO));- if ((mediatype == Query.CONTENTDOM_ALL) || (mediatype == Query.CONTENTDOM_APP)) a.addAll(computeMediaSnippets(document, queryhashes, Query.CONTENTDOM_APP));- if ((mediatype == Query.CONTENTDOM_ALL) || (mediatype == Query.CONTENTDOM_IMAGE)) a.addAll(computeImageSnippets(document, queryhashes));+ if ((mediatype == QueryParams.CONTENTDOM_ALL) || (mediatype == QueryParams.CONTENTDOM_AUDIO)) a.addAll(computeMediaSnippets(document, queryhashes, QueryParams.CONTENTDOM_AUDIO));+ if ((mediatype == QueryParams.CONTENTDOM_ALL) || (mediatype == QueryParams.CONTENTDOM_VIDEO)) a.addAll(computeMediaSnippets(document, queryhashes, QueryParams.CONTENTDOM_VIDEO));+ if ((mediatype == QueryParams.CONTENTDOM_ALL) || (mediatype == QueryParams.CONTENTDOM_APP)) a.addAll(computeMediaSnippets(document, queryhashes, QueryParams.CONTENTDOM_APP));+ if ((mediatype == QueryParams.CONTENTDOM_ALL) || (mediatype == QueryParams.CONTENTDOM_IMAGE)) a.addAll(computeImageSnippets(document, queryhashes));}return a;}@@ -719,9 +720,9 @@ public class plasmaSnippetCache {if (document == null) return new ArrayList<MediaSnippet>();Map<yacyURL, String> media = null;- if (mediatype == Query.CONTENTDOM_AUDIO) media = document.getAudiolinks();- else if (mediatype == Query.CONTENTDOM_VIDEO) media = document.getVideolinks();- else if (mediatype == Query.CONTENTDOM_APP) media = document.getApplinks();+ if (mediatype == QueryParams.CONTENTDOM_AUDIO) media = document.getAudiolinks();+ else if (mediatype == QueryParams.CONTENTDOM_VIDEO) media = document.getVideolinks();+ else if (mediatype == QueryParams.CONTENTDOM_APP) media = document.getApplinks();if (media == null) return null;final Iterator<Map.Entry<yacyURL, String>> i = media.entrySet().iterator();@@ -767,13 +768,13 @@ public class plasmaSnippetCache {s = removeAppearanceHashes(url.toNormalform(false, false), queryhashes);if (s.size() == 0) {final int ranking = ientry.hashCode();- result.add(new MediaSnippet(Query.CONTENTDOM_IMAGE, url, desc, ientry.width() + " x " + ientry.height(), ranking, document.dc_source()));+ result.add(new MediaSnippet(QueryParams.CONTENTDOM_IMAGE, url, desc, ientry.width() + " x " + ientry.height(), ranking, document.dc_source()));continue;}s = removeAppearanceHashes(desc, s);if (s.size() == 0) {final int ranking = ientry.hashCode();- result.add(new MediaSnippet(Query.CONTENTDOM_IMAGE, url, desc, ientry.width() + " x " + ientry.height(), ranking, document.dc_source()));+ result.add(new MediaSnippet(QueryParams.CONTENTDOM_IMAGE, url, desc, ientry.width() + " x " + ientry.height(), ranking, document.dc_source()));continue;}}@@ -952,7 +953,7 @@ public class plasmaSnippetCache {(snippet.getErrorCode() == ERROR_PARSER_NO_LINES)) {log.logInfo("error: '" + snippet.getError() + "', remove url = " + snippet.getUrl().toNormalform(false, true) + ", cause: " + snippet.getError());plasmaSwitchboard.getSwitchboard().indexSegment.urlMetadata().remove(urlHash);- final plasmaSearchEvent event = plasmaSearchEvent.getEvent(eventID);+ final QueryEvent event = QueryEvent.getEvent(eventID);assert plasmaSwitchboard.getSwitchboard() != null;assert plasmaSwitchboard.getSwitchboard().indexSegment != null;assert event != null : "eventID = " + eventID;@@ -963,7 +964,7 @@ public class plasmaSnippetCache {if (snippet.getErrorCode() == ERROR_NO_MATCH) {log.logInfo("error: '" + snippet.getError() + "', remove words '" + querystring + "' for url = " + snippet.getUrl().toNormalform(false, true) + ", cause: " + snippet.getError());plasmaSwitchboard.getSwitchboard().indexSegment.termIndex().remove(snippet.remaingHashes, urlHash);- plasmaSearchEvent.getEvent(eventID).remove(urlHash);+ QueryEvent.getEvent(eventID).remove(urlHash);}return snippet.getError();}diff --git a/source/de/anomic/yacy/yacyClient.java b/source/de/anomic/yacy/yacyClient.javaindex e2c2828fa..e5a5f6017 100644--- a/source/de/anomic/yacy/yacyClient.java+++ b/source/de/anomic/yacy/yacyClient.java@@ -82,11 +82,11 @@ import de.anomic.kelondro.text.metadataPrototype.URLMetadataRow;import de.anomic.kelondro.text.referencePrototype.WordReference;import de.anomic.kelondro.util.ByteBuffer;import de.anomic.kelondro.util.FileUtils;-import de.anomic.plasma.plasmaSearchRankingProcess;-import de.anomic.plasma.plasmaSnippetCache;import de.anomic.plasma.plasmaSwitchboard;import de.anomic.plasma.plasmaSwitchboardConstants;import de.anomic.search.RankingProfile;+import de.anomic.search.RankingProcess;+import de.anomic.search.SnippetCache;import de.anomic.server.serverCore;import de.anomic.server.serverDomains;import de.anomic.tools.crypt;@@ -436,7 +436,7 @@ public final class yacyClient {final yacySeed target,final Segment indexSegment,final ResultURLs crawlResults,- final plasmaSearchRankingProcess containerCache,+ final RankingProcess containerCache,final Map<String, TreeMap<String, String>> abstractCache,final Blacklist blacklist,final RankingProfile rankingProfile,@@ -587,7 +587,7 @@ public final class yacyClient {// because they are search-specific.// instead, they are placed in a snipped-search cache.// System.out.println("--- RECEIVED SNIPPET '" + link.snippet() + "'");- plasmaSnippetCache.storeToCache(wordhashes, urlEntry.hash(), urlEntry.snippet());+ SnippetCache.storeToCache(wordhashes, urlEntry.hash(), urlEntry.snippet());}// add the url entry to the word indexesdiff --git a/source/de/anomic/yacy/yacySearch.java b/source/de/anomic/yacy/yacySearch.javaindex dfe5d89ed..97dff605b 100644--- a/source/de/anomic/yacy/yacySearch.java+++ b/source/de/anomic/yacy/yacySearch.java@@ -36,9 +36,9 @@ import de.anomic.data.Blacklist;import de.anomic.kelondro.order.Bitfield;import de.anomic.kelondro.text.Segment;import de.anomic.kelondro.util.ScoreCluster;-import de.anomic.plasma.plasmaSearchRankingProcess;-import de.anomic.search.Query;+import de.anomic.search.QueryParams;import de.anomic.search.RankingProfile;+import de.anomic.search.RankingProcess;import de.anomic.yacy.dht.PeerSelection;import de.anomic.yacy.logging.Log;@@ -48,7 +48,7 @@ public class yacySearch extends Thread {final private boolean global;final private int partitions;final private Segment indexSegment;- final private plasmaSearchRankingProcess containerCache;+ final private RankingProcess containerCache;final private Map<String, TreeMap<String, String>> abstractCache;final private Blacklist blacklist;final private yacySeed targetPeer;@@ -73,7 +73,7 @@ public class yacySearch extends Thread {final Segment indexSegment,final yacySeedDB peers,final ResultURLs crawlResults,- final plasmaSearchRankingProcess containerCache,+ final RankingProcess containerCache,final Map<String, TreeMap<String, String>> abstractCache,final Blacklist blacklist,final RankingProfile rankingProfile,@@ -253,7 +253,7 @@ public class yacySearch extends Thread {final Segment indexSegment,final yacySeedDB peers,final ResultURLs crawlResults,- final plasmaSearchRankingProcess containerCache,+ final RankingProcess containerCache,final Map<String, TreeMap<String, String>> abstractCache,int targets,final Blacklist blacklist,@@ -270,7 +270,7 @@ public class yacySearch extends Thread {(clusterselection == null) ?selectSearchTargets(peers,- Query.hashes2Set(wordhashes),+ QueryParams.hashes2Set(wordhashes),targets,peers.redundancy()): selectClusterPeers(peers, clusterselection);@@ -296,7 +296,7 @@ public class yacySearch extends Thread {final Segment indexSegment,final yacySeedDB peers,final ResultURLs crawlResults,- final plasmaSearchRankingProcess containerCache,+ final RankingProcess containerCache,final String targethash, final Blacklist blacklist,final RankingProfile rankingProfile,final Bitfield constraint, final TreeMap<byte[], String> clusterselection) {