Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
integrated number of remote targets as 'partitions' into remote search protocol
orbiterc2d6edf21d3b
diff --git a/htroot/yacy/search.java b/htroot/yacy/search.javaindex a0b5b5d50..8b1eb1927 100644--- a/htroot/yacy/search.java+++ b/htroot/yacy/search.java@@ -99,6 +99,7 @@ public final class search {final String prefer = post.get("prefer", "");final String contentdom = post.get("contentdom", "text");final String filter = post.get("filter", ".*");+ final int partitions = post.getInt("partitions", 30);String profile = post.get("profile", ""); // remote profile hand-overif (profile.length() > 0) profile = crypt.simpleDecode(profile, null);final boolean includesnippet = post.get("includesnippet", "false").equals("true");@@ -238,7 +239,7 @@ public final class search {//yacyCore.log.logFine("DEBUG HASH SEARCH: " + indexabstract);}}- sb.requestedQueries = sb.requestedQueries + 1d / 30d; // increase query counter TODO: put number of remote peers into protocol+ if (partitions > 0) sb.requestedQueries = sb.requestedQueries + 1d / (double) partitions; // increase query counter}prop.putASIS("indexabstract", indexabstract.toString());diff --git a/source/de/anomic/yacy/yacyClient.java b/source/de/anomic/yacy/yacyClient.javaindex e876eca06..e7a8c0fb9 100644--- a/source/de/anomic/yacy/yacyClient.java+++ b/source/de/anomic/yacy/yacyClient.java@@ -373,6 +373,7 @@ public final class yacyClient {String filter,int maxDistance,boolean global,+ int partitions,yacySeed targetPeer,plasmaCrawlLURL urlManager,plasmaWordIndex wordIndex,@@ -388,16 +389,17 @@ public final class yacyClient {// this mainly converts the words into word hashes// INPUT:- // iam : complete seed of the requesting peer- // youare : seed hash of the target peer, used for testing network stability- // key : transmission key for response- // search : a list of search words- // hsearch : a string of word hashes- // fwdep : forward depth. if "0" then peer may NOT ask another peer for more results- // fwden : forward deny, a list of seed hashes. They may NOT be target of forward hopping- // count : maximum number of wanted results- // global : if "true", then result may consist of answers from other peers- // duetime : maximum time that a peer should spent to create a result+ // iam : complete seed of the requesting peer+ // youare : seed hash of the target peer, used for testing network stability+ // key : transmission key for response+ // search : a list of search words+ // hsearch : a string of word hashes+ // fwdep : forward depth. if "0" then peer may NOT ask another peer for more results+ // fwden : forward deny, a list of seed hashes. They may NOT be target of forward hopping+ // count : maximum number of wanted results+ // global : if "true", then result may consist of answers from other peers+ // partitions : number of remote peers that are asked (for evaluation of QPM)+ // duetime : maximum time that a peer should spent to create a result// request resultfinal String key = crypt.randomSalt();@@ -426,6 +428,7 @@ public final class yacyClient {obj.put("key", key);obj.put("count", timingProfile.getTargetCount(plasmaSearchTimingProfile.PROCESS_POSTSORT));obj.put("resource", ((global) ? "global" : "local"));+ obj.put("partitions", partitions);obj.put("query", wordhashes);obj.put("urls", urlhashes);obj.put("prefer", prefer);diff --git a/source/de/anomic/yacy/yacySearch.java b/source/de/anomic/yacy/yacySearch.javaindex 0cae3d451..04ef4a40f 100644--- a/source/de/anomic/yacy/yacySearch.java+++ b/source/de/anomic/yacy/yacySearch.java@@ -66,6 +66,7 @@ public class yacySearch extends Thread {final private String wordhashes, urlhashes;final private boolean global;+ final private int partitions;final private plasmaCrawlLURL urlManager;final private plasmaWordIndex wordIndex;final private indexContainer containerCache;@@ -81,7 +82,7 @@ public class yacySearch extends Thread {final private kelondroBitfield constraint;public yacySearch(String wordhashes, String urlhashes, String prefer, String filter, int maxDistance,- boolean global, yacySeed targetPeer, plasmaCrawlLURL urlManager, plasmaWordIndex wordIndex,+ boolean global, int partitions, yacySeed targetPeer, plasmaCrawlLURL urlManager, plasmaWordIndex wordIndex,indexContainer containerCache, Map abstractCache,plasmaURLPattern blacklist, plasmaSnippetCache snippetCache,plasmaSearchTimingProfile timingProfile, plasmaSearchRankingProfile rankingProfile,@@ -93,6 +94,7 @@ public class yacySearch extends Thread {this.prefer = prefer;this.filter = filter;this.global = global;+ this.partitions = partitions;this.urlManager = urlManager;this.wordIndex = wordIndex;this.containerCache = containerCache;@@ -108,7 +110,10 @@ public class yacySearch extends Thread {}public void run() {- this.urls = yacyClient.search(wordhashes, urlhashes, prefer, filter, maxDistance, global, targetPeer, urlManager, wordIndex, containerCache, abstractCache, blacklist, snippetCache, timingProfile, rankingProfile, constraint);+ this.urls = yacyClient.search(+ wordhashes, urlhashes, prefer, filter, maxDistance, global, partitions,+ targetPeer, urlManager, wordIndex, containerCache, abstractCache,+ blacklist, snippetCache, timingProfile, rankingProfile, constraint);if (urls != null) {StringBuffer urllist = new StringBuffer(this.urls.length * 13);for (int i = 0; i < this.urls.length; i++) urllist.append(this.urls[i]).append(' ');@@ -218,7 +223,7 @@ public class yacySearch extends Thread {if (targets == 0) return null;yacySearch[] searchThreads = new yacySearch[targets];for (int i = 0; i < targets; i++) {- searchThreads[i]= new yacySearch(wordhashes, urlhashes, prefer, filter, maxDist, true, targetPeers[i],+ searchThreads[i]= new yacySearch(wordhashes, urlhashes, prefer, filter, maxDist, true, targets, targetPeers[i],urlManager, wordIndex, containerCache, abstractCache, blacklist, snippetCache, timingProfile, rankingProfile, constraint);searchThreads[i].start();//try {Thread.sleep(20);} catch (InterruptedException e) {}@@ -239,7 +244,7 @@ public class yacySearch extends Thread {//Set wordhashes = plasmaSearch.words2hashes(querywords);final yacySeed targetPeer = yacyCore.seedDB.getConnected(targethash);if (targetPeer == null) return null;- yacySearch searchThread = new yacySearch(wordhashes, urlhashes, "", "", 9999, true, targetPeer,+ yacySearch searchThread = new yacySearch(wordhashes, urlhashes, "", "", 9999, true, 0, targetPeer,urlManager, wordIndex, containerCache, new TreeMap(), blacklist, snippetCache, timingProfile, rankingProfile, constraint);searchThread.start();return searchThread;