Use standard library splitext function
Fix bug when term in not in any document