|
|
@ -555,6 +555,7 @@ public final class plasmaSearchEvent {
|
|
|
|
serverLog.logInfo("search", "sorted out hash " + urlhash + " during search: " + reason);
|
|
|
|
serverLog.logInfo("search", "sorted out hash " + urlhash + " during search: " + reason);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
public ResultEntry oneResult(final int item) {
|
|
|
|
public ResultEntry oneResult(final int item) {
|
|
|
|
return oneResult(item, System.currentTimeMillis() + 100);
|
|
|
|
return oneResult(item, System.currentTimeMillis() + 100);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -598,6 +599,46 @@ public final class plasmaSearchEvent {
|
|
|
|
if (this.result.size() <= item) return null;
|
|
|
|
if (this.result.size() <= item) return null;
|
|
|
|
return this.result.element(item).element;
|
|
|
|
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;
|
|
|
|
private int resultCounter = 0;
|
|
|
|
public ResultEntry nextResult() {
|
|
|
|
public ResultEntry nextResult() {
|
|
|
|