Longest matching prefix lookups - 07-23-2005 , 06:04 AM
Does Berkeley DB support a lookup method on BTREE databases which
returns the key/data pair whose key is a prefix of the lookup key, and
the longest key with this property?
Maybe I'm missing something and this can be implemented using a
special user-defined comparison function?
(Yes, this is the IP forwarding problem, but it does show up in other
contexts, too. 8-)
Re: Longest matching prefix lookups - 07-23-2005 , 08:47 AM
I am not sure if this is quite what you are looking for....but you
can use the SETRANGE feature of a cursor together with a special
comparitor to do partial matches. This would allow you to search
through all matches only of a particular prefix match (defined by your
comparitor). It would then be up to you to decide which of the
matching keys within the returned range is the one you were looking
Sorry if this is off-base from your question. Its the only thing that
I am aware of that comes close.
Florian Weimer wrote: