Class: Ferret::Search::FilteredQuery::FilteredWeight
- Defined in:
- lib/ferret/search/filtered_query.rb
Instance Attribute Summary collapse
-
#query ⇒ Object
readonly
Returns the value of attribute query.
Instance Method Summary collapse
- #explain(ir, i) ⇒ Object
-
#initialize(query, sub_weight, similarity) ⇒ FilteredWeight
constructor
A new instance of FilteredWeight.
- #normalize(v) ⇒ Object
-
#scorer(reader) ⇒ Object
return a scorer that overrides the enclosed query’s score if the given hit has been filtered out.
- #sum_of_squared_weights ⇒ Object
-
#value ⇒ Object
pass these methods through to enclosed query’s weight.
Constructor Details
#initialize(query, sub_weight, similarity) ⇒ FilteredWeight
Returns a new instance of FilteredWeight.
64 65 66 67 68 |
# File 'lib/ferret/search/filtered_query.rb', line 64 def initialize(query, sub_weight, similarity) @query = query @sub_weight = sub_weight @similarity = similarity end |
Instance Attribute Details
#query ⇒ Object (readonly)
Returns the value of attribute query.
62 63 64 |
# File 'lib/ferret/search/filtered_query.rb', line 62 def query @query end |
Instance Method Details
#explain(ir, i) ⇒ Object
83 84 85 |
# File 'lib/ferret/search/filtered_query.rb', line 83 def explain(ir, i) return @sub_weight.explain(ir, i) end |
#normalize(v) ⇒ Object
79 80 81 |
# File 'lib/ferret/search/filtered_query.rb', line 79 def normalize(v) return @sub_weight.normalize(v) end |
#scorer(reader) ⇒ Object
return a scorer that overrides the enclosed query’s score if the given hit has been filtered out.
89 90 91 92 93 |
# File 'lib/ferret/search/filtered_query.rb', line 89 def scorer(reader) scorer = @sub_weight.scorer(reader) bits = @query.filter.bits(reader) return FilteredScorer.new(scorer, bits, @similarity) end |
#sum_of_squared_weights ⇒ Object
75 76 77 |
# File 'lib/ferret/search/filtered_query.rb', line 75 def sum_of_squared_weights() return @sub_weight.sum_of_squared_weights end |
#value ⇒ Object
pass these methods through to enclosed query’s weight
71 72 73 |
# File 'lib/ferret/search/filtered_query.rb', line 71 def value() return @sub_weight.value end |