changed search query to cater to PostgreSQL