Changed simple search query to be postgresql complient