lib/pg_search/normalizer.rb in pg_search-0.3.1 vs lib/pg_search/normalizer.rb in pg_search-0.3.2

- old
+ new

@@ -4,10 +4,19 @@ @config = config end def add_normalization(original_sql) normalized_sql = original_sql - normalized_sql = "unaccent(#{normalized_sql})" if @config.ignore.include?(:accents) + if @config.ignore.include?(:accents) + if @config.postgresql_version < 90000 + raise PgSearch::NotSupportedForPostgresqlVersion.new(<<-MESSAGE) + Sorry, {:ignoring => :accents} only works in PostgreSQL 9.0 and above. + #{@config.inspect} + MESSAGE + else + normalized_sql = "unaccent(#{normalized_sql})" + end + end normalized_sql end end end