GenericIndexIterator::SetTo(): Find fuzzily

Use TwoKeyAVLTree::FindFirstClosest() instead of FindFirst(), so, if the
value isn't in the index, we find the closest greater value. That's the
semantics Index::InternalFind() is expected to have.
This commit is contained in:
Ingo Weinhold 2011-07-07 11:34:31 +02:00
parent abaf82e5a9
commit 84989de15b

View File

@ -148,10 +148,12 @@ GenericIndexIterator<Policy>::SetTo(Index* index, const Value& value,
return false;
typename NodeTree::Iterator iterator;
if (ignoreValue)
if (ignoreValue) {
Policy::GetNodeTree(fIndex)->GetIterator(&iterator);
else if (Policy::GetNodeTree(fIndex)->FindFirst(value, &iterator) == NULL)
} else if (Policy::GetNodeTree(fIndex)->FindFirstClosest(value, false,
&iterator) == NULL) {
return false;
}
fNextTreeNode = iterator.CurrentNode();
return fNextTreeNode != NULL;