finish search condition in template