search func of suffix tree