Sha256: 9db63213a15cec64f00b53e0a5bee1e61438522d8965e12bda2a9ab1e1ccaac7

Contents?: true

Size: 575 Bytes

Versions: 3

Compression:

Stored size: 575 Bytes

Contents

module PgSearch
  class Normalizer
    def initialize(config)
      @config = config
    end

    def add_normalization(sql_expression)
      if @config.ignore.include?(:accents)
        if @config.postgresql_version < 90000
          raise PgSearch::NotSupportedForPostgresqlVersion.new(<<-MESSAGE.gsub /^\s*/, '')
            Sorry, {:ignoring => :accents} only works in PostgreSQL 9.0 and above.
            #{@config.inspect}
          MESSAGE
        else
          "unaccent(#{sql_expression})"
        end
      else
        sql_expression
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pg_search-0.5.4 lib/pg_search/normalizer.rb
pg_search-0.5.3 lib/pg_search/normalizer.rb
pg_search-0.5.2 lib/pg_search/normalizer.rb