[en] One embodiment provides a system that receives a packet with a hierarchically structured variable-length identifier (HSVLI). An HSVLI indicates a piece or collection of content and may be hierarchically structured, comprising contiguous components ordered from a most general level to a most specific level. The length of a respective identifier is not fixed. During operation, the system converts the HSVLI into a fixed-length key. Subsequently, the system obtains forwarding information based on one or more longest-prefix matches with a longest-prefix-match lookup engine using the fixed-length key. Next, the system forwards the packet to an output port based on the forwarding information.