Move TermIndex to lib.

This is in preparation for direct access to the term index from the client,
for use with finding properties by label.

Change-Id: Ia212cd0d57cc97310f49f6c5d56f9dcf90860789
Merge "Move TermIndex to lib."