Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unaccent support in PostgreSQL 8.4 #11

Closed
daniel2d2art opened this issue Sep 21, 2011 · 4 comments
Closed

unaccent support in PostgreSQL 8.4 #11

daniel2d2art opened this issue Sep 21, 2011 · 4 comments

Comments

@daniel2d2art
Copy link

unaccent not included for Posgresql 8.4, how work around?

@nertzy
Copy link
Collaborator

nertzy commented Sep 26, 2011

It might be possible. We haven't tested it.

This looks like it would work: https://launchpad.net/postgresql-unaccent

@nertzy
Copy link
Collaborator

nertzy commented Oct 18, 2011

I haven't been able to get it to work, so for now I've disabled it in version 0.3.2.

d5bf5ec Disable {:ignoring => :accents} in PostgreSQL 8.x

@nertzy nertzy closed this as completed Oct 18, 2011
@gjones
Copy link

gjones commented Apr 27, 2012

I installed the unaccent extension and it works a treat on my local, running 9.1.3, however Heroku's shared database option still seems to be running 8.3. Is there a patch available to fix this? I keep getting this when running heroku rake db:migrate.

PG::Error: ERROR: syntax error at or near "extension"
LINE 1: create extension unaccent

Thanks

@nertzy
Copy link
Collaborator

nertzy commented Apr 29, 2012

Yeah I don't think Heroku allows you to supply your own compiled PostgreSQL contrib packages for security reasons. And the CREATE EXTENSION syntax is new to PostgreSQL 9.1.

Heroku is working on a shared PostgreSQL 9.1 solution but I'm not sure how far along it is. https://addons.heroku.com/heroku-shared-postgresql

If stripping accents is an important concern, you could add an additional column to your model (called something like content or search_content) and have a before_validate hook on your model that copies over the appropriate text there and strips accents in the Ruby layer.

The disadvantage is that by caching the unaccented version in another column, you run the risk of the search_content going out-of-sync with the rest of the columns. For example, if you use update_attribute or another method that updates without calling callbacks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants