synchronized local searched to prevent that several searches are performed at the same time

see also: http://www.yacy-forum.de/viewtopic.php?p=19761#19761

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

@ -156,14 +156,23 @@ public final class plasmaSearchEvent extends Thread implements Runnable {
public int localSearch() {
// search for the set of hashes and return an array of urlEntry elements
// we synchronize with flushThreads to allow only one local search at a time,
// so all search tasks are queued
synchronized (flushThreads) {
// retrieve entities that belong to the hashes
profileLocal.startTimer();
Set containers = wordIndex.getContainers(query.queryHashes, true, true, profileLocal.getTargetTime(plasmaSearchTimingProfile.PROCESS_COLLECTION));
Set containers = wordIndex.getContainers(
query.queryHashes,
true,
true,
profileLocal.getTargetTime(plasmaSearchTimingProfile.PROCESS_COLLECTION));
if (containers.size() < query.size()) containers = null; // prevent that only a subset is returned
profileLocal.setYieldTime(plasmaSearchTimingProfile.PROCESS_COLLECTION);
profileLocal.setYieldCount(plasmaSearchTimingProfile.PROCESS_COLLECTION, (containers == null) ? 0 : containers.size());
// since this is a conjunction we return an empty entity if any word is not known
// since this is a conjunction we return an empty entity if any word
// is not known
if (containers == null) {
rcLocal = new plasmaWordIndexEntryContainer(null);
return 0;
@ -171,12 +180,16 @@ public final class plasmaSearchEvent extends Thread implements Runnable {
// join the result
profileLocal.startTimer();
rcLocal = plasmaWordIndexEntryContainer.joinContainer(containers, profileLocal.getTargetTime(plasmaSearchTimingProfile.PROCESS_JOIN), query.maxDistance);
rcLocal = plasmaWordIndexEntryContainer.joinContainer(
containers,
profileLocal.getTargetTime(plasmaSearchTimingProfile.PROCESS_JOIN),
query.maxDistance);
profileLocal.setYieldTime(plasmaSearchTimingProfile.PROCESS_JOIN);
profileLocal.setYieldCount(plasmaSearchTimingProfile.PROCESS_JOIN, rcLocal.size());
return rcLocal.size();
}
}
public int globalSearch(int fetchpeers) {
// do global fetching

Loading…
Cancel
Save