I am following the thoughtbot tutorial on multi-index full-text search using postgresql and rails 4. And I can't seem to get the indices migrations to work. I have tried
disable_ddl_transaction!
def change
add_index(:cards, :object, using: 'gin', algorithm: :concurrently)
add_index(:cards, :content, using: 'gin', algorithm: :concurrently)
add_index(:tags, :name, using: 'gin', algorithm: :concurrently)
end
and
def up
ActiveRecord::Base.connection.execute <<-SQL
CREATE INDEX CONCURRENTLY index_cards_on_object ON cards USING gin(to_tsvector('english', object));
CREATE INDEX CONCURRENTLY index_cards_on_content ON cards USING gin(to_tsvector('english', content));
CREATE INDEX CONCURRENTLY index_tags_on_name ON tags USING gin(to_tsvector('english', name));
SQL
end
def down
ActiveRecord::Base.connection.execute <<-SQL
DROP INDEX index_cards_on_object;
DROP INDEX index_cards_on_content;
DROP INDEX index_tags_on_name;
SQL
end
I get the following errors (rescpectively)
PG::UndefinedObject: ERROR: data type character varying has no default operator class for access method "gin"
and
ActiveRecord::StatementInvalid: PG::UndefinedObject: ERROR: data type character varying has no default operator class for access method "gin" PG::SyntaxError: ERROR: syntax error at or near "CREATE"
All help and insight welcomed, thank you