Sha256: 59863cf22db04166d10f234f3029020f0832bbc71f5c5bc8bf393cb7f722dca7
Contents?: true
Size: 971 Bytes
Versions: 4
Compression:
Stored size: 971 Bytes
Contents
module PgSearch module Features class DMetaphone def initialize(query, options, columns, model, normalizer) dmetaphone_normalizer = Normalizer.new(normalizer) options = (options || {}).merge(:dictionary => 'simple') @tsearch = TSearch.new(query, options, columns, model, dmetaphone_normalizer) end def conditions tsearch.conditions end def rank tsearch.rank end private attr_reader :tsearch # Decorates a normalizer with dmetaphone processing. class Normalizer def initialize(normalizer_to_wrap) @normalizer_to_wrap = normalizer_to_wrap end def add_normalization(original_sql) otherwise_normalized_sql = normalizer_to_wrap.add_normalization(original_sql) "pg_search_dmetaphone(#{otherwise_normalized_sql})" end private attr_reader :normalizer_to_wrap end end end end
Version data entries
4 entries across 4 versions & 1 rubygems