mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
added hand-over of search filter and prefer ranking to yacy protocol
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2029 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
parent
49f3b56526
commit
dbe96e6541
|
@ -84,6 +84,7 @@ public final class search {
|
|||
final int count = post.getInt("count", 10); // maximum number of wanted results
|
||||
final int maxdist= post.getInt("maxdist", Integer.MAX_VALUE);
|
||||
final String prefer = post.get("prefer", "");
|
||||
final String filter = post.get("filter", ".*");
|
||||
// final boolean global = ((String) post.get("resource", "global")).equals("global"); // if true, then result may consist of answers from other peers
|
||||
// Date remoteTime = yacyCore.parseUniversalDate((String) post.get(yacySeed.MYTIME)); // read remote time
|
||||
|
||||
|
@ -105,7 +106,7 @@ public final class search {
|
|||
}
|
||||
final long timestamp = System.currentTimeMillis();
|
||||
|
||||
plasmaSearchQuery squery = new plasmaSearchQuery(keyhashes, maxdist, prefer, count, duetime, ".*");
|
||||
plasmaSearchQuery squery = new plasmaSearchQuery(keyhashes, maxdist, prefer, count, duetime, filter);
|
||||
squery.domType = plasmaSearchQuery.SEARCHDOM_LOCAL;
|
||||
|
||||
serverObjects prop = new serverObjects();
|
||||
|
|
|
@ -199,7 +199,7 @@ public final class plasmaSearchEvent extends Thread implements Runnable {
|
|||
log.logFine("STARTING " + fetchpeers + " THREADS TO CATCH EACH " + profileGlobal.getTargetCount(plasmaSearchTimingProfile.PROCESS_POSTSORT) + " URLs WITHIN " + (profileGlobal.duetime() / 1000) + " SECONDS");
|
||||
|
||||
long timeout = System.currentTimeMillis() + profileGlobal.duetime() + 4000;
|
||||
searchThreads = yacySearch.searchHashes(query.queryHashes, query.maxDistance, urlStore, rcGlobal, fetchpeers, plasmaSwitchboard.urlBlacklist, snippetCache, profileGlobal, ranking);
|
||||
searchThreads = yacySearch.searchHashes(query.queryHashes, query.prefer, query.urlMask, query.maxDistance, urlStore, rcGlobal, fetchpeers, plasmaSwitchboard.urlBlacklist, snippetCache, profileGlobal, ranking);
|
||||
|
||||
// wait until wanted delay passed or wanted result appeared
|
||||
while (System.currentTimeMillis() < timeout) {
|
||||
|
|
|
@ -351,6 +351,8 @@ public final class yacyClient {
|
|||
|
||||
public static int search(
|
||||
String wordhashes,
|
||||
String prefer,
|
||||
String filter,
|
||||
int maxDistance,
|
||||
boolean global,
|
||||
yacySeed targetPeer,
|
||||
|
@ -404,6 +406,8 @@ public final class yacyClient {
|
|||
obj.put("count", timingProfile.getTargetCount(plasmaSearchTimingProfile.PROCESS_POSTSORT));
|
||||
obj.put("resource", ((global) ? "global" : "local"));
|
||||
obj.put("query", wordhashes);
|
||||
obj.put("prefer", prefer);
|
||||
obj.put("filter", filter);
|
||||
obj.put("ttl", "0");
|
||||
obj.put("duetime", Long.toString(duetime));
|
||||
obj.put("profile", timingProfile.targetToString()); // new duetimes splitted by specific search tasks
|
||||
|
|
|
@ -70,12 +70,15 @@ public class yacySearch extends Thread {
|
|||
private int maxDistance;
|
||||
final private plasmaSearchTimingProfile timingProfile;
|
||||
final private plasmaSearchRankingProfile rankingProfile;
|
||||
final private String prefer, filter;
|
||||
|
||||
public yacySearch(Set wordhashes, int maxDistance, boolean global, yacySeed targetPeer,
|
||||
public yacySearch(Set wordhashes, String prefer, String filter, int maxDistance, boolean global, yacySeed targetPeer,
|
||||
plasmaCrawlLURL urlManager, plasmaWordIndexEntryContainer containerCache, plasmaURLPattern blacklist, plasmaSnippetCache snippetCache,
|
||||
plasmaSearchTimingProfile timingProfile, plasmaSearchRankingProfile rankingProfile) {
|
||||
super("yacySearch_" + targetPeer.getName());
|
||||
this.wordhashes = wordhashes;
|
||||
this.prefer = prefer;
|
||||
this.filter = filter;
|
||||
this.global = global;
|
||||
this.urlManager = urlManager;
|
||||
this.containerCache = containerCache;
|
||||
|
@ -89,7 +92,7 @@ public class yacySearch extends Thread {
|
|||
}
|
||||
|
||||
public void run() {
|
||||
this.links = yacyClient.search(set2string(wordhashes), maxDistance, global, targetPeer, urlManager, containerCache, blacklist, snippetCache, timingProfile, rankingProfile);
|
||||
this.links = yacyClient.search(set2string(wordhashes), prefer, filter, maxDistance, global, targetPeer, urlManager, containerCache, blacklist, snippetCache, timingProfile, rankingProfile);
|
||||
if (links != 0) {
|
||||
//yacyCore.log.logInfo("REMOTE SEARCH - remote peer " + targetPeer.hash + ":" + targetPeer.getName() + " contributed " + links + " links for word hash " + wordhashes);
|
||||
yacyCore.seedDB.mySeed.incRI(links);
|
||||
|
@ -178,7 +181,7 @@ public class yacySearch extends Thread {
|
|||
return result;
|
||||
}
|
||||
|
||||
public static yacySearch[] searchHashes(Set wordhashes, int maxDist, plasmaCrawlLURL urlManager, plasmaWordIndexEntryContainer containerCache,
|
||||
public static yacySearch[] searchHashes(Set wordhashes, String prefer, String filter, int maxDist, plasmaCrawlLURL urlManager, plasmaWordIndexEntryContainer containerCache,
|
||||
int targets, plasmaURLPattern blacklist, plasmaSnippetCache snippetCache,
|
||||
plasmaSearchTimingProfile timingProfile, plasmaSearchRankingProfile rankingProfile) {
|
||||
// check own peer status
|
||||
|
@ -192,7 +195,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, maxDist, true, targetPeers[i],
|
||||
searchThreads[i]= new yacySearch(wordhashes, prefer, filter, maxDist, true, targetPeers[i],
|
||||
urlManager, containerCache, blacklist, snippetCache, timingProfile, rankingProfile);
|
||||
searchThreads[i].start();
|
||||
try {Thread.sleep(20);} catch (InterruptedException e) {}
|
||||
|
|
Loading…
Reference in New Issue
Block a user