Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master

This branch is 35 commits behind ryanb:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

..
Failed to load latest commit information.
blog-after
blog-before
README.md

README.md

RailsCasts Episode #343: Full-Text Search in PostgreSQL

http://railscasts.com/episodes/343-full-text-search-in-postgresql

Requires Ruby 1.9.2 or higher.

Commands used in this episode

rails db
rails g migration add_unaccent_extension
rake db:migrate
rails g migration add_search_index_to_articles
rm db/schema.rb
rake db:structure:dump
rake db:structure:load

Commands used in database console

select 'ninja turtles' @@ 'turtles';
select 'ninja turtles' @@ 'turtle';
select 'ninja turtles' @@ 'green';
select to_tsvector('ninja turtles') @@ plainto_tsquery('turtle');
select to_tsvector('english', 'ninja turtles') @@ plainto_tsquery('english', 'turtle');
select to_tsvector('simple', 'ninja turtles') @@ plainto_tsquery('simple', 'turtle');
select to_tsvector('simple', 'ninja turtles') @@ plainto_tsquery('simple', 'turtles');
select to_tsvector('simple', 'ninja turtles') @@ to_tsquery('simple', 'turtles');
select to_tsvector('simple', 'ninja turtles') @@ to_tsquery('simple', 'ninja turtles');
select to_tsvector('simple', 'ninja turtles') @@ to_tsquery('simple', 'ninja & turtles');
select to_tsvector('simple', 'ninja turtles') @@ to_tsquery('simple', 'ninja | turtles');
select to_tsvector('simple', 'ninja turtles') @@ to_tsquery('simple', 'ninja & !turtles');
select ts_rank(to_tsvector('ninjaturtles'), to_tsquery('turtles'));
Something went wrong with that request. Please try again.