Module: Card::Query::CardQuery::FullTextMatching
- Defined in:
- lib/card/query/card_query/full_text_matching.rb
Overview
handle ‘fulltext_match` condition in card queries
Instance Method Summary collapse
Instance Method Details
#fulltext_match(value) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/card/query/card_query/full_text_matching.rb', line 9 def fulltext_match value return if value.strip.empty? if prefixed_match? value name_match value else add_condition Value.new([:match, ":#{value}"], self).to_sql(:name) end end |
#prefixed_match?(value) ⇒ Boolean
18 19 20 |
# File 'lib/card/query/card_query/full_text_matching.rb', line 18 def prefixed_match? value value.match?(/^[\~\:\=]/) end |