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

Loading…
Cancel
Save