Class: Stretchy::Clauses::BoostWhereClause
- Inherits:
-
BoostClause
- Object
- Base
- BoostClause
- Stretchy::Clauses::BoostWhereClause
- Defined in:
- lib/stretchy/clauses/boost_where_clause.rb
Overview
Boosts documents that match certain filters. Most filters will
be passed into #initialize, but you can also use .range
and
.geo
.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#geo(*args) ⇒ Base
Boosts a document if it matches a geo filter.
-
#initialize(base, options = {}) ⇒ BoostWhereClause
constructor
Generates a boost that matches a set of filters.
-
#match(*args) ⇒ MatchClause
Returns to the base context.
-
#range(*args) ⇒ Base
Applies a range filter with a min or max as a boost.
-
#where(*args) ⇒ WhereClause
Returns to the base context; filters passed here will be used to filter documents.
Methods inherited from BoostClause
#all, #boost_mode, #max, #near, #not, #random, #score_mode
Methods inherited from Base
#aggregations, #boost, #explain, #fields, #get_aggregations, #get_explain, #get_fields, #get_limit, #get_offset, #get_page, #inverse?, #limit, #not, #offset, #page, #query_results, #should
Constructor Details
#initialize(base, options = {}) ⇒ BoostWhereClause
Generates a boost that matches a set of filters.
23 24 25 26 27 |
# File 'lib/stretchy/clauses/boost_where_clause.rb', line 23 def initialize(base, = {}) super(base) where_function(:init, ) if .any? self end |
Instance Method Details
#geo(*args) ⇒ Base
Boosts a document if it matches a geo filter.
This is different than Stretchy::Clauses::BoostClause#near -
while .near
applies a decay function that boosts
based on how close a field is to a geo point,
.geo
applies a filter that either boosts or doesn't
boost the document.
94 95 96 97 |
# File 'lib/stretchy/clauses/boost_where_clause.rb', line 94 def geo(*args) where_function(:geo, *args) Base.new(base) end |
#match(*args) ⇒ MatchClause
Returns to the base context. Queries passed here will be used to filter documents.
59 60 61 |
# File 'lib/stretchy/clauses/boost_where_clause.rb', line 59 def match(*args) MatchClause.new(base, *args) end |
#range(*args) ⇒ Base
Applies a range filter with a min or max as a boost.
74 75 76 77 |
# File 'lib/stretchy/clauses/boost_where_clause.rb', line 74 def range(*args) where_function(:range, *args) Base.new(base) end |
#where(*args) ⇒ WhereClause
Returns to the base context; filters passed here will be used to filter documents.
42 43 44 |
# File 'lib/stretchy/clauses/boost_where_clause.rb', line 42 def where(*args) WhereClause.new(base, *args) end |