bugfixes for remote search server part

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2573 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 19 years ago
parent 2c6f2a1f74
commit 6e2907135a

@ -127,9 +127,12 @@ public final class search {
Map containers = theSearch.localSearchContainers(plasmaSearchQuery.hashes2Set(urls)); Map containers = theSearch.localSearchContainers(plasmaSearchQuery.hashes2Set(urls));
// set statistic details of search result and find best result index set // set statistic details of search result and find best result index set
String maxcounthash = null, neardhthash = null; int joincount = 0;
plasmaSearchResult acc = null;
if (containers == null) { if (containers == null) {
prop.put("indexcount", ""); prop.put("indexcount", "0");
prop.put("joincount", "0");
prop.put("indexabstract","");
} else { } else {
Iterator ci = containers.entrySet().iterator(); Iterator ci = containers.entrySet().iterator();
StringBuffer indexcount = new StringBuffer(); StringBuffer indexcount = new StringBuffer();
@ -137,6 +140,7 @@ public final class search {
int maxcount = -1; int maxcount = -1;
double mindhtdistance = 1.1, d; double mindhtdistance = 1.1, d;
String wordhash; String wordhash;
String maxcounthash = null, neardhthash = null;
while (ci.hasNext()) { while (ci.hasNext()) {
entry = (Map.Entry) ci.next(); entry = (Map.Entry) ci.next();
wordhash = (String) entry.getKey(); wordhash = (String) entry.getKey();
@ -153,27 +157,27 @@ public final class search {
indexcount.append("indexcount.").append(container.getWordHash()).append('=').append(Integer.toString(container.size())).append(serverCore.crlfString); indexcount.append("indexcount.").append(container.getWordHash()).append('=').append(Integer.toString(container.size())).append(serverCore.crlfString);
} }
prop.put("indexcount", new String(indexcount)); prop.put("indexcount", new String(indexcount));
}
// join and order the result
// join and order the result indexContainer localResults = theSearch.localSearchJoin(containers.values());
indexContainer localResults = theSearch.localSearchJoin(containers.values()); joincount = localResults.size();
int joincount = localResults.size(); prop.put("joincount", Integer.toString(joincount));
prop.put("joincount", Integer.toString(joincount)); acc = theSearch.orderFinal(localResults);
plasmaSearchResult acc = theSearch.orderFinal(localResults);
// generate compressed index for maxcounthash
// generate compressed index for maxcounthash // this is not needed if the search is restricted to specific urls, because it is a re-search
// this is not needed if the search is restricted to specific urls, because it is a re-search if ((maxcounthash == null) || (urls.length() != 0) || (keyhashes.size() == 1)) {
if ((maxcounthash == null) || (urls.length() != 0) || (keyhashes.size() == 1)) { prop.put("indexabstract","");
prop.put("indexabstract",""); } else {
} else { String indexabstract = "indexabstract." + maxcounthash + "=" + indexURL.compressIndex(((indexContainer) containers.get(maxcounthash)), localResults, 1000).toString() + serverCore.crlfString;
String indexabstract = "indexabstract." + maxcounthash + "=" + indexURL.compressIndex(((indexContainer) containers.get(maxcounthash)), localResults, 1000).toString() + serverCore.crlfString; if ((neardhthash != null) && (!(neardhthash.equals(maxcounthash)))) {
if ((neardhthash != null) && (!(neardhthash.equals(maxcounthash)))) { indexabstract += "indexabstract." + neardhthash + "=" + indexURL.compressIndex(((indexContainer) containers.get(neardhthash)), localResults, 1000).toString() + serverCore.crlfString;
indexabstract += "indexabstract." + neardhthash + "=" + indexURL.compressIndex(((indexContainer) containers.get(neardhthash)), localResults, 1000).toString() + serverCore.crlfString; }
System.out.println("DEBUG-ABSTRACTGENERATION: maxcounthash = " + maxcounthash);
System.out.println("DEBUG-ABSTRACTGENERATION: neardhthash = " + neardhthash);
//yacyCore.log.logFine("DEBUG HASH SEARCH: " + indexabstract);
prop.put("indexabstract", indexabstract);
} }
System.out.println("DEBUG-ABSTRACTGENERATION: maxcounthash = " + maxcounthash);
System.out.println("DEBUG-ABSTRACTGENERATION: neardhthash = " + neardhthash);
//yacyCore.log.logFine("DEBUG HASH SEARCH: " + indexabstract);
prop.put("indexabstract", indexabstract);
} }
// prepare result // prepare result

@ -390,8 +390,11 @@ public final class indexRAMCacheRI extends indexAbstractRI implements indexRI {
if (urlselection == null) { if (urlselection == null) {
return (indexContainer) wCache.get(wordHash); return (indexContainer) wCache.get(wordHash);
} else { } else {
indexContainer ic = ((indexContainer) wCache.get(wordHash)).topLevelClone(); indexContainer ic = (indexContainer) wCache.get(wordHash);
ic.select(urlselection); if (ic != null) {
ic = ic.topLevelClone();
ic.select(urlselection);
}
return ic; return ic;
} }
} }

@ -153,7 +153,7 @@ public final class plasmaSearchEvent extends Thread implements Runnable {
if (yacySearch.remainingWaiting(primarySearchThreads) == 0) break; // all threads have finished if (yacySearch.remainingWaiting(primarySearchThreads) == 0) break; // all threads have finished
try {Thread.sleep(100);} catch (InterruptedException e) {} try {Thread.sleep(100);} catch (InterruptedException e) {}
} }
prepareSecondarySearch(); if (query.size() > 1) prepareSecondarySearch();
// catch up global results: // catch up global results:
// wait until primary timeout passed // wait until primary timeout passed

@ -437,7 +437,9 @@ public final class yacyClient {
final long timestamp = System.currentTimeMillis(); final long timestamp = System.currentTimeMillis();
// sending request // sending request
final HashMap result = nxTools.table( HashMap result = null;
try {
result = nxTools.table(
httpc.wput( httpc.wput(
new URL(url), new URL(url),
targetPeer.getHexHash() + ".yacyh", targetPeer.getHexHash() + ".yacyh",
@ -448,10 +450,15 @@ public final class yacyClient {
obj, obj,
null null
) )
); );
} catch (IOException e) {
yacyCore.log.logFine("SEARCH failed FROM " + targetPeer.hash + ":" + targetPeer.getName() + " (" + e.getMessage() + "), score=" + targetPeer.selectscore + ", DHTdist=" + yacyDHTAction.dhtDistance(targetPeer.hash, wordhashes));
yacyCore.peerActions.peerDeparture(targetPeer);
return 0;
}
if (result.size() == 0) { if (result.size() == 0) {
yacyCore.log.logFine("SEARCH failed FROM " + targetPeer.hash + ":" + targetPeer.getName() + ", score=" + targetPeer.selectscore + ", DHTdist=" + yacyDHTAction.dhtDistance(targetPeer.hash, wordhashes)); yacyCore.log.logFine("SEARCH failed FROM " + targetPeer.hash + ":" + targetPeer.getName() + " (zero response), score=" + targetPeer.selectscore + ", DHTdist=" + yacyDHTAction.dhtDistance(targetPeer.hash, wordhashes));
return 0; return 0;
} }

@ -82,6 +82,7 @@ public class yacySearch extends Thread {
plasmaURLPattern blacklist, plasmaSnippetCache snippetCache, plasmaURLPattern blacklist, plasmaSnippetCache snippetCache,
plasmaSearchTimingProfile timingProfile, plasmaSearchRankingProfile rankingProfile) { plasmaSearchTimingProfile timingProfile, plasmaSearchRankingProfile rankingProfile) {
super("yacySearch_" + targetPeer.getName()); super("yacySearch_" + targetPeer.getName());
System.out.println("DEBUG - yacySearch thread " + this.getName() + " initialized " + ((urlhashes.length() == 0) ? "(primary)" : "(secondary)"));
this.wordhashes = wordhashes; this.wordhashes = wordhashes;
this.urlhashes = urlhashes; this.urlhashes = urlhashes;
this.prefer = prefer; this.prefer = prefer;
@ -101,8 +102,8 @@ public class yacySearch extends Thread {
public void run() { public void run() {
this.links = yacyClient.search(wordhashes, urlhashes, prefer, filter, maxDistance, global, targetPeer, urlManager, containerCache, abstractCache, blacklist, snippetCache, timingProfile, rankingProfile); this.links = yacyClient.search(wordhashes, urlhashes, prefer, filter, maxDistance, global, targetPeer, urlManager, containerCache, abstractCache, blacklist, snippetCache, timingProfile, rankingProfile);
yacyCore.log.logInfo("REMOTE SEARCH - remote peer " + targetPeer.hash + ":" + targetPeer.getName() + " contributed " + links + " links for word hash " + wordhashes);
if (links != 0) { 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); yacyCore.seedDB.mySeed.incRI(links);
yacyCore.seedDB.mySeed.incRU(links); yacyCore.seedDB.mySeed.incRU(links);
} }

Loading…
Cancel
Save