At least one implementation described herein relates to maintaining
filters according to hierarchical data associated with the filters. The
filters are maintained in a tree structure that is used to match inputs
with filters. A filter hierarchy is an in-memory tree of string segments
where each node corresponds to a string segment and references zero or
more filters. When an input is received, a path associated with the input
is parsed into string segments and the tree is traversed according to the
string segments to locate nodes that match the input (primary matching).
The input is then compared to filters referenced by matching nodes to
locate filters that match the input (secondary matching). As a result,
the input is tested against significantly fewer filters and greater
efficiency is achieved over typical systems. Also, the primary matching
process returns filters in a sorted order which facilitates the secondary
matching process.