Added optimization findIndexWithTerm but disabled for now