Class: Query::ExactPhrase

Inherits:
Struct
  • Object
show all
Defined in:
lib/generators/hayfork/templates/query/exact_phrase.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#wordsObject

Returns the value of attribute words



2
3
4
# File 'lib/generators/hayfork/templates/query/exact_phrase.rb', line 2

def words
  @words
end

Instance Method Details

#apply(set) ⇒ Object



4
5
6
7
8
# 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