Class: Stretchy::Clauses::BoostMatchClause
- Inherits:
-
BoostClause
- Object
- Base
- BoostClause
- Stretchy::Clauses::BoostMatchClause
- Defined in:
- lib/stretchy/clauses/boost_match_clause.rb
Constant Summary
Constants inherited from Base
Stretchy::Clauses::Base::DEFAULT_LIMIT, Stretchy::Clauses::Base::DEFAULT_OFFSET
Instance Attribute Summary
Attributes inherited from Base
#aggregate_builder, #boost_builder, #index_name, #inverse, #match_builder, #type, #where_builder
Instance Method Summary collapse
-
#initialize(base, opts_or_string = {}, options = {}) ⇒ BoostMatchClause
constructor
A new instance of BoostMatchClause.
- #match(*args) ⇒ Object
- #not(opts_or_string = {}, options = {}) ⇒ Object
- #where(*args) ⇒ Object
Methods inherited from BoostClause
#all, #boost_mode, #max, #near, #random, #score_mode
Methods inherited from Base
#boost, #get_limit, #get_offset, #inverse?, #limit, #offset, #query_results, #should, #to_search
Constructor Details
#initialize(base, opts_or_string = {}, options = {}) ⇒ BoostMatchClause
Returns a new instance of BoostMatchClause.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/stretchy/clauses/boost_match_clause.rb', line 9 def initialize(base, opts_or_string = {}, = {}) super(base) if opts_or_string.is_a?(Hash) @inverse = opts_or_string.delete(:inverse) || .delete(:inverse) match_function(opts_or_string.merge()) else @inverse = .delete(:inverse) match_function(.merge('_all' => opts_or_string)) end end |
Instance Method Details
#match(*args) ⇒ Object
28 29 30 |
# File 'lib/stretchy/clauses/boost_match_clause.rb', line 28 def match(*args) MatchClause.new(self, *args) end |
#not(opts_or_string = {}, options = {}) ⇒ Object
20 21 22 |
# File 'lib/stretchy/clauses/boost_match_clause.rb', line 20 def not(opts_or_string = {}, = {}) self.class.new(self, opts_or_string, .merge(inverse: !inverse?)) end |
#where(*args) ⇒ Object
24 25 26 |
# File 'lib/stretchy/clauses/boost_match_clause.rb', line 24 def where(*args) WhereClause.new(self, *args) end |