add query search function