Heroku full-text search using pg_search gem

I implemented full-text search using pg_search gem for my Rails application

My migration to create an index looks like

execute(<<-'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

And my controller code looks like

pg_search_scope :full_text_search,
:against => [
  :name, :description],
:using => {
  :tsearch => {
    :prefix => true,
    :dictionary => "english",
    :any_word => true
  }
}

which works fine locally on Postgres 9.0.4. However, when I deploy the same with heroku and search for the test request "test", it throws an error

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 ):

Any suggestions on where I am going wrong and what I should look for to fix this error? Thank.

+5
source share
1 answer

pg_search. , ! pg_search :prefix PostgreSQL 8.3 ( Heroku).

https://github.com/Casecommons/pg_search/issues/10

. , 8.x, 9.x.

. , :prefix PostgreSQL 8.3. 8.4. pg_search 0.3.3, . , Heroku 9.0. , , , , .

+13

All Articles