class Query::ExactPhrase

Public Instance Methods

apply(set) click to toggle source
# File lib/generators/hayfork/templates/query/exact_phrase.rb, line 4
def apply(set)
  set.where(Arel::Nodes::InfixOperation.new("@@",
    set.arel_table[Hayfork::SEARCH_VECTOR],
    to_tsquery(Hayfork.default_dictionary, words.join(" <-> "))))
end

Private Instance Methods

to_tsquery(dictionary, querystring) click to toggle source
# File lib/generators/hayfork/templates/query/exact_phrase.rb, line 12
def to_tsquery(dictionary, querystring)
  Arel::Nodes::NamedFunction.new("to_tsquery", [
    Arel::Nodes.build_quoted(dictionary),
    Arel::Nodes.build_quoted(querystring) ])
end