Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

dpwildboar's Profile

GitHub User: dpwildboar

Comments by

Avatar

another thing that people might want to play around with is partial match. searching for 'jun' with the blog-after code will get

SELECT "articles".* FROM "articles" WHERE (to_tsvector('english', name) @@ to_tsquery('jun') or to_tsvector('english', content) @@ to_tsquery('jun')) ;
 id | author_id | name | content | published_at | created_at | updated_at 
----+-----------+------+---------+--------------+------------+------------
(0 rows)

where as the following will get Superman (content has the word june) and Robin (junior) as a result

SELECT "articles".* FROM "articles" WHERE (to_tsvector('english', name) @@ to_tsquery('jun:*') or to_tsvector('english', content) @@ to_tsquery('jun:*')) ;

also, there is an additional contrib, pg_trgm, that can help with partial searching:

http://www.postgresql.org/docs/9.1/interactive/pgtrgm.html

and can also do similarity.

like unaccent, pg_trgm is not built by default for a postgres install.

Avatar

http://www.postgresql.org/docs/9.1/interactive/contrib.html

"When building from the source distribution, these modules are not built automatically, unless you build the "world" target (see step 2)."

unaccent is not built by default for a postgres install. this might be the issue.

Avatar

if your using rvm, you can't just:

rvm use 1.9.3 --default 

you need to state the gemset too, thus having an accepted .rvmrc that states the gemset is important.

rvm use ruby-1.9.3-p125@rails-3.2.3 --default 

seems to work also. if you don't then you get log messages that are along the lines of: "cannot load such file -- bundler/setup"

at least that was my experience with using the above version of ruby and rails.

also, the whenever gem would default to production. so if your running whenever in development you want to also state:

bundle exec whenever --set 'environment=development' -w