Author: orbiter
Date: 2008-02-02 12:30:47 +0100 (Sat, 02 Feb 2008)
New Revision: 4428
Modified:
trunk/skins/default.css
trunk/source/de/anomic/plasma/plasmaSearchEvent.java
trunk/source/de/anomic/plasma/plasmaSnippetCache.java
Log:
- removed dashed line from default skin (looks much better!)
- better timing when displaying results
Modified: trunk/skins/default.css
===================================================================
--- trunk/skins/default.css 2008-02-02 00:16:00 UTC (rev 4427)
+++ trunk/skins/default.css 2008-02-02 11:30:47 UTC (rev 4428)
@@ -156,7 +156,7 @@
/* Searchresults */
.searchresults {
- border-top:1px #000 dashed;
+ /*border-top:1px #000 dashed;*/
}
.searchresults .url a {
Modified: trunk/source/de/anomic/plasma/plasmaSearchEvent.java
===================================================================
--- trunk/source/de/anomic/plasma/plasmaSearchEvent.java 2008-02-02
00:16:00 UTC (rev 4427)
+++ trunk/source/de/anomic/plasma/plasmaSearchEvent.java 2008-02-02
11:30:47 UTC (rev 4428)
@@ -391,17 +391,6 @@
}
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() {
// check primary search threads
@@ -504,7 +493,6 @@
private class resultWorker extends Thread {
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 int id;
@@ -512,7 +500,7 @@
this.id = id;
this.lastLifeSign = System.currentTimeMillis();
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() {
@@ -522,7 +510,7 @@
while (System.currentTimeMillis() < this.timeout) {
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
page = rankedCache.bestURL(true);
@@ -554,11 +542,6 @@
rankedCache.addReferences(resultEntry);
}
//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");
}
@@ -586,11 +569,29 @@
public ResultEntry oneResult(int item) {
// first sleep a while to give accumulation threads a chance to work
- while (((localSearchThread != null) && (localSearchThread.isAlive()))
||
- ((countFinishedWorkerThreads() <= item) && (item <
workerThreadCount)) ||
- ((this.primarySearchThreads != null) &&
(this.primarySearchThreads.length > item) && (anyWorkerAlive()) &&
- ((this.resultList.size() <= item) ||
(countFinishedRemoteSearch() <= item)))) {
- try {Thread.sleep(100);} catch (InterruptedException e) {}
+ 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(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) {}
+ }
+ } 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
Modified: trunk/source/de/anomic/plasma/plasmaSnippetCache.java
===================================================================
--- trunk/source/de/anomic/plasma/plasmaSnippetCache.java 2008-02-02
00:16:00 UTC (rev 4427)
+++ trunk/source/de/anomic/plasma/plasmaSnippetCache.java 2008-02-02
11:30:47 UTC (rev 4428)
@@ -291,6 +291,9 @@
} else if (containsAllHashes(comp.dc_subject(), 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 (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) {
// if not found try to download it
_______________________________________________
YaCy-svn mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/yacy-svn