I've been playing with a similar structure for another purpose, but
have been wondering what the best way to perform a search under a
given point in the tree is. I can see a few:
1) Use Lucene and on creation of a site, add all of it's parent sites
as metadata to lucene. Unfortunately, this means moving all the
metadata when a node or site is relocacted, including adjusting all
child nodes when moving a mid-level node. Additionally, it requires a
series of traversal steps to find all of the parents, and this may be
a series of queries to the database.
2) Store as metadata on the object/table the parent sites of each
node. Again, on moving nodes, you have to readjust your metadata.
3) Perform all of your searches by selecting the node under which you
want to see the results and traverse. Unfortunately here, it's harder
to do a query that returns these results and includes an "and".
e.g. "All sites under site X, and with characteristic Y.
4) Limit the heirarchy to one level deep, and thus every child has
only one ancestor. While this is restrictive, for some functions, it
is suitable.
Others? |