Dear Lucene Developers,
In the source file "SortedIntDocSet.java", the code fragment that is used
for binary search can have its speed improved by adding two more conditions.
Original Code
--------------------
if (docb < doca) {
low = mid+1;
}
else if (docb > doca) {
high = mid-1;
}
Changed Code
----------------------
if (docb < doca) {
low = mid+1;
}
else if (docb > doca) {
high = mid-1;
else if (low != mid) //Equal but range is not fully scanned
high = mid; //Set upper bound to current number and rescan
else //Equal and full range is scanned
return mid;
Reference: http://stackoverflow.com/questions/6676360/
--
Warmest Regards,
Fuxiang