G
Guest
I have a search problem that I'm seeking some advice in. I'm dealing with
the need to search node names in a tree structure that is flattened into a
database table (I have no say over the design, just over how to search). The
tree consists of nodes that represent rooms, cabinets in each room, drawers
in each cabinet, etc. The flattened representation is as what you would
expect--each data row has a column representing the room, cabinet, drawer,
etc. When I search this data, I need to do it in a hierarchical fashion--I
look at the first room, then the first cabinet in that room, then the first
drawer in that cabinet, etc. If I search the dataset linearly, I end up
showing the same hit multiple times (if I hit on the room name, once I finish
showing hits on that row, I encounter the room again the next row). I could,
once a hit is found, move vertically down the column in the dataset, erasing
all names that match, but that isn't easily done without performing multiple
checks to make sure I'm still in the same branch of the tree. Any hints on a
better way to perform this search would be appreciated. I could convert the
data to xml and use xpath, or create a normalized dataset and fill it
appropriately, but I'm not sure this will ease the search later. Thanks.
the need to search node names in a tree structure that is flattened into a
database table (I have no say over the design, just over how to search). The
tree consists of nodes that represent rooms, cabinets in each room, drawers
in each cabinet, etc. The flattened representation is as what you would
expect--each data row has a column representing the room, cabinet, drawer,
etc. When I search this data, I need to do it in a hierarchical fashion--I
look at the first room, then the first cabinet in that room, then the first
drawer in that cabinet, etc. If I search the dataset linearly, I end up
showing the same hit multiple times (if I hit on the room name, once I finish
showing hits on that row, I encounter the room again the next row). I could,
once a hit is found, move vertically down the column in the dataset, erasing
all names that match, but that isn't easily done without performing multiple
checks to make sure I'm still in the same branch of the tree. Any hints on a
better way to perform this search would be appreciated. I could convert the
data to xml and use xpath, or create a normalized dataset and fill it
appropriately, but I'm not sure this will ease the search later. Thanks.