- removed dashed line from default skin (looks much better!)

- better timing when displaying results

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4428 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 17 years ago
parent 89169d54fd
commit 08a12e9bb5

@ -156,7 +156,7 @@ div.ProgressBarFill {
/* Searchresults */ /* Searchresults */
.searchresults { .searchresults {
border-top:1px #000 dashed; /*border-top:1px #000 dashed;*/
} }
.searchresults .url a { .searchresults .url a {

@ -392,17 +392,6 @@ public final class plasmaSearchEvent {
return false; return false;
} }
private int countFinishedWorkerThreads() {
if (this.workerThreads == null) return workerThreadCount;
int c = 0;
for (int i = 0; i < workerThreadCount; i++) {
if ((this.workerThreads[i] == null) ||
!(this.workerThreads[i].isAlive()) ||
(this.workerThreads[i].busytime() >= 3000)) c++;
}
return c;
}
private boolean anyRemoteSearchAlive() { private boolean anyRemoteSearchAlive() {
// check primary search threads // check primary search threads
if ((this.primarySearchThreads != null) && (this.primarySearchThreads.length != 0)) { if ((this.primarySearchThreads != null) && (this.primarySearchThreads.length != 0)) {
@ -504,7 +493,6 @@ public final class plasmaSearchEvent {
private class resultWorker extends Thread { private class resultWorker extends Thread {
private long timeout; // the date until this thread should try to work private long timeout; // the date until this thread should try to work
private long sleeptime; // the sleeptime of this thread at the beginning of its life
private long lastLifeSign; // when the last time the run()-loop was executed private long lastLifeSign; // when the last time the run()-loop was executed
private int id; private int id;
@ -512,7 +500,7 @@ public final class plasmaSearchEvent {
this.id = id; this.id = id;
this.lastLifeSign = System.currentTimeMillis(); this.lastLifeSign = System.currentTimeMillis();
this.timeout = System.currentTimeMillis() + Math.max(1000, maxlifetime); this.timeout = System.currentTimeMillis() + Math.max(1000, maxlifetime);
this.sleeptime = Math.min(300, maxlifetime / 10 * id); //this.sleeptime = Math.min(300, maxlifetime / 10 * id);
} }
public void run() { public void run() {
@ -522,7 +510,7 @@ public final class plasmaSearchEvent {
while (System.currentTimeMillis() < this.timeout) { while (System.currentTimeMillis() < this.timeout) {
this.lastLifeSign = System.currentTimeMillis(); this.lastLifeSign = System.currentTimeMillis();
if (resultList.size() >= query.neededResults() + query.displayResults()) break; // we have enough if (resultList.size() >= query.neededResults() /*+ query.displayResults()*/) break; // we have enough
// get next entry // get next entry
page = rankedCache.bestURL(true); page = rankedCache.bestURL(true);
@ -554,11 +542,6 @@ public final class plasmaSearchEvent {
rankedCache.addReferences(resultEntry); rankedCache.addReferences(resultEntry);
} }
//System.out.println("DEBUG SNIPPET_LOADING: thread " + id + " got " + resultEntry.url()); //System.out.println("DEBUG SNIPPET_LOADING: thread " + id + " got " + resultEntry.url());
if (resultList.size() >= query.neededResults() + query.displayResults()) break; // we have enough
// sleep first to give remote loading threads a chance to fetch entries
if (anyRemoteSearchAlive()) try {Thread.sleep(this.sleeptime);} catch (InterruptedException e1) {}
} }
serverLog.logInfo("SEARCH", "resultWorker thread " + id + " terminated"); serverLog.logInfo("SEARCH", "resultWorker thread " + id + " terminated");
} }
@ -586,12 +569,30 @@ public final class plasmaSearchEvent {
public ResultEntry oneResult(int item) { public ResultEntry oneResult(int item) {
// first sleep a while to give accumulation threads a chance to work // first sleep a while to give accumulation threads a chance to work
while (((localSearchThread != null) && (localSearchThread.isAlive())) || if ((query.domType == plasmaSearchQuery.SEARCHDOM_GLOBALDHT) ||
((countFinishedWorkerThreads() <= item) && (item < workerThreadCount)) || (query.domType == plasmaSearchQuery.SEARCHDOM_CLUSTERALL)) {
((this.primarySearchThreads != null) && (this.primarySearchThreads.length > item) && (anyWorkerAlive()) && // this is a search using remote search threads. Also the local search thread is started as background process
((this.resultList.size() <= item) || (countFinishedRemoteSearch() <= item)))) { 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(200);} catch (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()) &&
((this.resultList.size() <= item) || (countFinishedRemoteSearch() <= item))) {
try {Thread.sleep(100);} catch (InterruptedException e) {}
}
// finally wait until enough results are there produced from the snippet fetch process
while ((anyWorkerAlive()) && (this.resultList.size() <= item)) {
try {Thread.sleep(100);} catch (InterruptedException e) {} try {Thread.sleep(100);} catch (InterruptedException e) {}
} }
} else {
// we did a local search. If we arrive here, the local search process was finished
// and the only things we need to wait for are snippets from snippet fetch processes
while ((anyWorkerAlive()) && (this.resultList.size() <= item)) {
try {Thread.sleep(100);} catch (InterruptedException e) {}
}
}
// finally, if there is something, return the result // finally, if there is something, return the result
synchronized (this.resultList) { synchronized (this.resultList) {

@ -291,6 +291,9 @@ public class plasmaSnippetCache {
} else if (containsAllHashes(comp.dc_subject(), queryhashes)) { } else if (containsAllHashes(comp.dc_subject(), queryhashes)) {
// try to create the snippet from information given in the subject metadata // try to create the snippet from information given in the subject metadata
return new TextSnippet(url, (comp.dc_creator().length() > 0) ? comp.dc_creator() : comp.dc_subject(), SOURCE_METADATA, null, null, faviconCache.get(url.hash())); return new TextSnippet(url, (comp.dc_creator().length() > 0) ? comp.dc_creator() : comp.dc_subject(), SOURCE_METADATA, null, null, faviconCache.get(url.hash()));
} else if (containsAllHashes(comp.url().toNormalform(true, true), queryhashes)) {
// try to create the snippet from information given in the subject metadata
return new TextSnippet(url, (comp.dc_creator().length() > 0) ? comp.dc_creator() : comp.dc_subject(), SOURCE_METADATA, null, null, faviconCache.get(url.hash()));
} else if (fetchOnline) { } else if (fetchOnline) {
// if not found try to download it // if not found try to download it

Loading…
Cancel
Save