Class: Eson::Search::Boosting
- Inherits:
-
Object
- Object
- Eson::Search::Boosting
- Includes:
- Query
- Defined in:
- lib/eson/search/boosting.rb
Instance Attribute Summary collapse
-
#conditions ⇒ Object
Returns the value of attribute conditions.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
-
#boosting { ... } ⇒ self
Generates a ‘boosting` query in a query context.
- #boosts ⇒ Object
-
#initialize(options = {}) ⇒ Boosting
constructor
A new instance of Boosting.
- #negative(&block) ⇒ Object
- #positive(&block) ⇒ Object
- #to_query_hash ⇒ Object
Methods included from Query
Constructor Details
#initialize(options = {}) ⇒ Boosting
Returns a new instance of Boosting.
12 13 14 |
# File 'lib/eson/search/boosting.rb', line 12 def initialize( = {}) self. = end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Eson::Search::Query
Instance Attribute Details
#conditions ⇒ Object
Returns the value of attribute conditions.
10 11 12 |
# File 'lib/eson/search/boosting.rb', line 10 def conditions @conditions end |
#options ⇒ Object
Returns the value of attribute options.
10 11 12 |
# File 'lib/eson/search/boosting.rb', line 10 def @options end |
Instance Method Details
#boosting { ... } ⇒ self
8 |
# File 'lib/eson/search/boosting.rb', line 8 short_name :boosting |
#boosts ⇒ Object
16 17 18 |
# File 'lib/eson/search/boosting.rb', line 16 def boosts @boosts ||= {} end |
#negative(&block) ⇒ Object
25 26 27 28 |
# File 'lib/eson/search/boosting.rb', line 25 def negative(&block) q = (boosts[:negative] ||= SubQuery.new(args)) q.query(&block) end |
#positive(&block) ⇒ Object
20 21 22 23 |
# File 'lib/eson/search/boosting.rb', line 20 def positive(&block) q = (boosts[:positive] ||= SubQuery.new(args)) q.query(&block) end |
#to_query_hash ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/eson/search/boosting.rb', line 30 def to_query_hash result = {} boosts.each do |k,v| result[k] = v.to_query_hash end {name => result.merge()} end |