fixed problem with time-out during result joint which caused OR behavior instead of AND beahvior

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1167 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 19 years ago
parent 3d8a5ae652
commit dc778659fb

@ -128,8 +128,9 @@ public final class plasmaSearchQuery {
}
// the string is clean now, but we must generate a set out of it
final String[] a = words.split(" ");
final TreeSet query = new TreeSet(kelondroMSetTools.fastStringComparator);
if (words.length() == 0) return query; // split returns always one element
final String[] a = words.split(" ");
for (int i = 0; i < a.length; i++) { query.add(a[i]); }
return query;
}

@ -313,6 +313,9 @@ public final class plasmaWordIndexEntity {
public static plasmaWordIndexEntity joinEntities(Set entities, long time) throws IOException {
// big problem here: there cannot be a time-out for join, since a time-out will leave the joined set too big.
// this will result in a OR behavior of the search instead of an AND behavior
long stamp = System.currentTimeMillis();
// order entities by their size
@ -339,7 +342,7 @@ public final class plasmaWordIndexEntity {
// we now must pairwise build up a conjunction of these sets
Long k = (Long) map.firstKey(); // the smallest, which means, the one with the least entries
plasmaWordIndexEntity searchA, searchB, searchResult = (plasmaWordIndexEntity) map.remove(k);
while ((map.size() > 0) && (searchResult.size() > 0) && (time > 0)) {
while ((map.size() > 0) && (searchResult.size() > 0)) {
// take the first element of map which is a result and combine it with result
k = (Long) map.firstKey(); // the next smallest...
time -= (System.currentTimeMillis() - stamp); stamp = System.currentTimeMillis();

Loading…
Cancel
Save