Sha256: 87eb6efbb174c4f924e899ec50f9cdbafa111ef4d865fde977acff9f799c0387

Contents?: true

Size: 609 Bytes

Versions: 7

Compression:

Stored size: 609 Bytes

Contents

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

    def add_normalization(original_sql)
      normalized_sql = original_sql
      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
          normalized_sql = "unaccent(#{normalized_sql})"
        end
      end
      normalized_sql
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
pg_search-0.5.1 lib/pg_search/normalizer.rb
pg_search-0.5 lib/pg_search/normalizer.rb
pg_search-0.4.2 lib/pg_search/normalizer.rb
pg_search-0.4.1 lib/pg_search/normalizer.rb
pg_search-0.4 lib/pg_search/normalizer.rb
pg_search-0.3.4 lib/pg_search/normalizer.rb
pg_search-0.3.3 lib/pg_search/normalizer.rb