reverted change of search event processing in SVN 5460. The new code did not work properly,

it gave remote search requests too less time


git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5479 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 16 years ago
parent c7c291bc6b
commit a6b29cf72c

@ -555,6 +555,7 @@ public final class plasmaSearchEvent {
serverLog.logInfo("search", "sorted out hash " + urlhash + " during search: " + reason);
}
/*
public ResultEntry oneResult(final int item) {
return oneResult(item, System.currentTimeMillis() + 100);
}
@ -598,7 +599,47 @@ public final class plasmaSearchEvent {
if (this.result.size() <= item) return null;
return this.result.element(item).element;
}
*/
public ResultEntry oneResult(final int item) {
// check if we already retrieved this item (happens if a search
// pages is accessed a second time)
serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(query.id(true), "obtain one result entry - start", 0, 0));
if (this.result.sizeStore() > item) {
// we have the wanted result already in the result array .. return that
return this.result.element(item).element;
}
if ((query.domType == plasmaSearchQuery.SEARCHDOM_GLOBALDHT) ||
(query.domType == plasmaSearchQuery.SEARCHDOM_CLUSTERALL)) {
// this is a search using remote search threads. Also the local
// search thread is started as background process
if ((localSearchThread != null) && (localSearchThread.isAlive())) {
// in case that the local search takes longer than some other
// remote search requests, do some sleeps to give the local process
// a chance to contribute
try {Thread.sleep(item * 50L);} catch (final InterruptedException e) {}
}
// now wait until as many remote worker threads have finished, as we
// want to display results
while (this.primarySearchThreads != null &&
this.primarySearchThreads.length > item &&
anyWorkerAlive() &&
(result.size() <= item || countFinishedRemoteSearch() <= item)) {
try {Thread.sleep(item * 50L);} catch (final InterruptedException e) {}
}
}
// finally wait until enough results are there produced from the
// snippet fetch process
while ((anyWorkerAlive()) && (result.size() <= item)) {
try {Thread.sleep(item * 50L);} catch (final InterruptedException e) {}
}
// finally, if there is something, return the result
if (this.result.size() <= item) return null;
return this.result.element(item).element;
}
private int resultCounter = 0;
public ResultEntry nextResult() {
final ResultEntry re = oneResult(resultCounter);
@ -767,8 +808,8 @@ public final class plasmaSearchEvent {
public long dbRetrievalTime, snippetComputationTime;
public ResultEntry(final indexURLReference urlentry, final plasmaWordIndex wordIndex,
final plasmaSnippetCache.TextSnippet textSnippet,
final ArrayList<plasmaSnippetCache.MediaSnippet> mediaSnippets,
final plasmaSnippetCache.TextSnippet textSnippet,
final ArrayList<plasmaSnippetCache.MediaSnippet> mediaSnippets,
final long dbRetrievalTime, final long snippetComputationTime) {
this.urlentry = urlentry;
this.urlcomps = urlentry.comp();
@ -787,16 +828,16 @@ public final class plasmaSearchEvent {
final String filename = urlcomps.url().getFile();
String address = null;
if ((seed == null) || ((address = seed.getPublicAddress()) == null)) {
// seed is not known from here
// seed is not known from here
wordIndex.removeWordReferences(
plasmaCondenser.getWords(
("yacyshare " +
filename.replace('?', ' ') +
" " +
urlcomps.dc_title())).keySet(),
urlentry.hash());
wordIndex.removeURL(urlentry.hash()); // clean up
throw new RuntimeException("index void");
plasmaCondenser.getWords(
("yacyshare " +
filename.replace('?', ' ') +
" " +
urlcomps.dc_title())).keySet(),
urlentry.hash());
wordIndex.removeURL(urlentry.hash()); // clean up
throw new RuntimeException("index void");
}
alternative_urlstring = "http://" + address + "/" + host.substring(0, p) + filename;
alternative_urlname = "http://share." + seed.getName() + ".yacy" + filename;

@ -42,7 +42,7 @@ import de.anomic.plasma.plasmaSwitchboard;
public class serverDomains {
private static final String localPatterns = "10.*,127.*,172.16.*,169.254.*,192.168.*,localhost";
private static final String localPatterns = "10\\..*,127.*,172.(1[6-9]|2[0-9]|3[0-1])\\..*,169.254.*,192.168.*,localhost";
// a dns cache
private static final Map<String, InetAddress> nameCacheHit = new ConcurrentHashMap<String, InetAddress>(); // a not-synchronized map resulted in deadlocks

Loading…
Cancel
Save