Added nextSearchTermForDoc; inckuded more stuff for the meta view.