fixing loose search edge case
This commit is contained in:
parent
769236ff33
commit
45aabd2427
@ -983,7 +983,7 @@ class BPlusTree_Node {
|
|||||||
|
|
||||||
#d(implode(",",$this->keys));
|
#d(implode(",",$this->keys));
|
||||||
#$place = array_search($key, $this->keys);
|
#$place = array_search($key, $this->keys);
|
||||||
$place = BPT_bisect($this->keys, $key, 0);
|
$place = BPT_bisect($this->keys, $key, 0, $this->validkeys);
|
||||||
if (@$this->keys[$place-1] == $key) {
|
if (@$this->keys[$place-1] == $key) {
|
||||||
return $this->indices[$place];
|
return $this->indices[$place];
|
||||||
} else {
|
} else {
|
||||||
@ -1898,7 +1898,7 @@ class BPlusTree {
|
|||||||
|
|
||||||
#$ki = array_slice($ki, 1);
|
#$ki = array_slice($ki, 1);
|
||||||
$ki->remove(0);
|
$ki->remove(0);
|
||||||
print_r($ki);
|
#print_r($ki);
|
||||||
// insert new pair
|
// insert new pair
|
||||||
#BPT_insort($ki, array($leftmost, $insertindex));
|
#BPT_insort($ki, array($leftmost, $insertindex));
|
||||||
$ki->insort($leftmost, $insertindex);
|
$ki->insort($leftmost, $insertindex);
|
||||||
@ -2410,7 +2410,7 @@ class BPlusWalker {
|
|||||||
}
|
}
|
||||||
if (!$this->valid) {
|
if (!$this->valid) {
|
||||||
$place = BPT_bisect($keys, $keylower, 0, $validkeys);
|
$place = BPT_bisect($keys, $keylower, 0, $validkeys);
|
||||||
if ($place < $validkeys) {
|
if ($place < $validkeys || ($place==$validkeys && $this->includelower>1)) {
|
||||||
if ($place > 0)
|
if ($place > 0)
|
||||||
$index = $place - 1;
|
$index = $place - 1;
|
||||||
else $index = $place;
|
else $index = $place;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user