Sha256: 1025c544dc5e22fcc6996122cbf617962768233a5923262a89d05f1ee66e5834
Contents?: true
Size: 757 Bytes
Versions: 16
Compression:
Stored size: 757 Bytes
Contents
require "active_support/core_ext/module/delegation" module PgSearch module Features class Trigram def initialize(query, options, columns, model, normalizer) @query = query @options = options @columns = columns @model = model @normalizer = normalizer end def conditions ["(#{@normalizer.add_normalization(document)}) % #{@normalizer.add_normalization(":query")}", {:query => @query}] end def rank ["similarity((#{@normalizer.add_normalization(document)}), #{@normalizer.add_normalization(":query")})", {:query => @query}] end private def document @columns.map { |column| column.to_sql }.join(" || ' ' || ") end end end end
Version data entries
16 entries across 16 versions & 1 rubygems