Family Tree Index
From SharedTree Wiki
Although SharedTree has (or will have) billions of names, genealogists want to feel like they're just using a small local copy on their personal computer with only few thousand names. The Family Tree Index (FTI) is what makes this happen.
Other genealogy applications have no need for a Family Tree Index since they usually create small sandboxes for each user. SharedTree is unique in that it truly “shares” the data. The FTI enables SharedTree to be both shared and small at the same time.
Contents |
What is it for
The index essentially links each end user with all of the names in his or her portion of the large shared tree. The FTI performs several functions:
- This index provides the primary security mechanism during search, charting, and even Family, Marriage, and Individual pages that determines what the end user can and cannot see.
- The index determines which recent posts, changes, and biographies to display on the My Tree page
- The index also calculates the path from a user to an individual genealogical record to display related users
- Finally the index assists in quickly calculating which users are related to each other when displayed on the My Tree page and also in the Invite Relatives section
How does it calculate
The FTI Spider starts with the current end user, finds their attached genealogical record and then start circling that individual. During each circle the spider finds parents, spouses, and children of each person and family in the stack. It adds those people to the stack and continues to the next loop. If it finds a person with a blocked relationship it eliminates that person from the list. After nine loops, the spider quits. It currently takes about 2 minues for 9 loops with 5000 individuals. The spider calculated the entire index for a single end user. It does not have the ability to build partial indexes or build them in reverse such as from an individual to an end user.
What are the allowed relationships
When does the spider run
First off, the spider only needs to run after there have been structural changes to genealogical records that were or will be in an enduser's FTI. Since endusers can still view records they create, it also only applies to other endusers. I think daily is enough.
Currently the spider runs manually as requested by the enduser. I have added a field into app_user that will track when we run this so we can automatically run this daily or even less depending on what parts of the tree change. Re-indexing the database for every user every night will be too complicated. So that's why it's still manual for now.
