added query search functionality