Patched to fix a bug when empty indexes or segments exist.

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@149859 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Doug Cutting 2002-09-20 17:25:13 +00:00
parent 474d9de985
commit 933bac2435
2 changed files with 10 additions and 2 deletions

View File

@ -125,8 +125,12 @@ final class SegmentsReader extends IndexReader
hi = mid - 1;
else if (n > midValue)
lo = mid + 1;
else
else { // found a match
while (mid+1 < readers.length && starts[mid+1] == midValue) {
mid++; // scan to last match
}
return mid;
}
}
return hi;
}

View File

@ -116,8 +116,12 @@ public class MultiSearcher extends Searcher implements Searchable {
hi = mid - 1;
else if (n > midValue)
lo = mid + 1;
else
else { // found a match
while (mid+1 < searchables.length && starts[mid+1] == midValue) {
mid++; // scan to last match
}
return mid;
}
}
return hi;
}