key
with a distance of tolerance
in self
.If tolerance
is null, the use default_tolerance
instead.
# Search `key` with a distance of `tolerance` in `self`.
#
# If `tolerance` is null, the use `default_tolerance` instead.
fun search(key: String, tolerance: nullable Int): Array[BKMatch] do
var res = new Array[BKMatch]
var root = self.root
if root != null then
if tolerance == null then tolerance = self.default_tolerance
search_recursive(root, res, key, tolerance)
end
default_comparator.sort(res)
return res
end
lib/trees/bktree.nit:83,2--95,4