title: Full-text search on Heroku using pg_search gem
body: <p>I've implemented full-text search using pg_search gem for my Rails application</p>
  
  <p>My migration to create index looks like</p>
  
  <pre><code>execute(&lt;&lt;-'eosql'.strip)
    CREATE index mytable_fts_idx
    ON mytable
    USING gin(
      (setweight(to_tsvector('english', coalesce("mytable"."name", '')), 'A') ||
      ' ' ||
      setweight(to_tsvector('english', coalesce("mytable"."description",'')), 'B')
      )
    )
  eosql
  </code></pre>
  
  <p>And my controller code looks like</p>
  
  <pre><code>pg_search_scope :full_text_search,
  :against =&gt; [
    :name, :description],
  :using =&gt; {
    :tsearch =&gt; {
      :prefix =&gt; true,
      :dictionary =&gt; "english",
      :any_word =&gt; true
    }
  }
  </code></pre>
  
  <p>which works totally fine locally on Postgres 9.0.4. However, when I deploy the same to heroku and search for a sample query 'test', it throws up an error </p>
  
  <pre><code>PGError: ERROR:  syntax error in tsquery: "' test ':*"
  
  SELECT COUNT(count_column) FROM (SELECT  1 AS count_column FROM "mytable"  WHERE (((to_tsvector('english', coalesce("mytable"."name", '')) || to_tsvector('english', coalesce("mytable"."description", ''))) @@ (to_tsquery('english', ''' ' || 'test' || ' ''' || ':*')))) LIMIT 12 OFFSET 0) subquery_for_count ):
  </code></pre>
  
  <p>Any suggestions on where I'm wrong and what I should be looking at to fix this error? Thanks.</p>