Class: Eson::Search::CustomFiltersScore
- Inherits:
-
Object
- Object
- Eson::Search::CustomFiltersScore
- Defined in:
- lib/eson/search/custom_filters_score.rb
Instance Attribute Summary collapse
-
#filters(&block) ⇒ Object
Returns the value of attribute filters.
-
#options ⇒ Object
Returns the value of attribute options.
Attributes included from Queries
Instance Method Summary collapse
-
#custom_filters_score { ... } ⇒ self
Generates a ‘custom_filters_score` query in a query context.
- #filter(options, &block) ⇒ Object
-
#initialize(options = {}) ⇒ CustomFiltersScore
constructor
A new instance of CustomFiltersScore.
- #to_query_hash ⇒ Object
Methods included from Query
Methods included from Queries
Constructor Details
#initialize(options = {}) ⇒ CustomFiltersScore
Returns a new instance of CustomFiltersScore.
12 13 14 15 |
# File 'lib/eson/search/custom_filters_score.rb', line 12 def initialize( = {}) self. = self.filters = [] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Eson::Search::Query
Instance Attribute Details
#filters(&block) ⇒ Object
Returns the value of attribute filters.
10 11 12 |
# File 'lib/eson/search/custom_filters_score.rb', line 10 def filters @filters end |
#options ⇒ Object
Returns the value of attribute options.
10 11 12 |
# File 'lib/eson/search/custom_filters_score.rb', line 10 def @options end |
Instance Method Details
#custom_filters_score { ... } ⇒ self
8 |
# File 'lib/eson/search/custom_filters_score.rb', line 8 short_name :custom_filters_score |
#filter(options, &block) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/eson/search/custom_filters_score.rb', line 21 def filter(, &block) sub = SubQuery.new(args) @filters << [, sub] sub.send(context, &block) end |
#to_query_hash ⇒ Object
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/eson/search/custom_filters_score.rb', line 29 def to_query_hash result = {} result[:query] = queries.to_query_hash result[:filters] = @filters.map do |, filter| {:filter => filter.to_query_hash}.merge!() end {name => result.merge()} end |