Sha256: b034b4d50b50df94e4afd6a0d92070559a75f911b89555d084615b52adbd1360
Contents?: true
Size: 834 Bytes
Versions: 19
Compression:
Stored size: 834 Bytes
Contents
module PgSearch class Normalizer def initialize(config) @config = config end def add_normalization(sql_expression) return sql_expression unless config.ignore.include?(:accents) if config.postgresql_version < 90000 raise PgSearch::NotSupportedForPostgresqlVersion.new(<<-MESSAGE.strip_heredoc) Sorry, {:ignoring => :accents} only works in PostgreSQL 9.0 and above. #{config.inspect} MESSAGE end sql_node = case sql_expression when Arel::Nodes::Node sql_expression else Arel.sql(sql_expression) end Arel::Nodes::NamedFunction.new( PgSearch.unaccent_function, [sql_node] ).to_sql end private attr_reader :config end end
Version data entries
19 entries across 19 versions & 1 rubygems