fix template insertion
add term to search virtual functions. fix indexer thread destroy