use bulk api for reindexing memberships

this improves the performance for objects that have a large number of
memberships
Add basic join interface to API

At the moment use a hard coded list of possible joins along with the
internal instructions on how to do them. Only does one document at a
time and one level of join.
cope with joins up to depth 3 on persons and organizations

Populates the person or organization memberships of a returned
item in a collection. Limited to depth 3 as it probably doesn't
make sense to go deeper.
allow collection query to be limited to basic information

i.e. skip the population of the memberships which significantly cuts
down the size of the returned data if that's all you want.