Class: IndexedSearch::Match::Result
- Inherits:
-
Object
- Object
- IndexedSearch::Match::Result
- Defined in:
- lib/indexed_search/match/result.rb
Overview
each matcher class generates one (or more) of these to describe its results.
Instance Attribute Summary collapse
-
#ignored_because_already_used ⇒ Object
populated by result list class.
-
#limit_reduction_factor ⇒ Object
Returns the value of attribute limit_reduction_factor.
-
#list_map ⇒ Object
populated by result list class.
-
#matcher ⇒ Object
Returns the value of attribute matcher.
-
#matchidx ⇒ Object
Returns the value of attribute matchidx.
-
#rank_multiplier ⇒ Object
Returns the value of attribute rank_multiplier.
-
#reduced_by_limit_reduction_factor ⇒ Object
populated by result list class.
-
#term_map ⇒ Object
Returns the value of attribute term_map.
-
#term_multiplier ⇒ Object
Returns the value of attribute term_multiplier.
-
#type_reduction_factor ⇒ Object
Returns the value of attribute type_reduction_factor.
Instance Method Summary collapse
- #empty? ⇒ Boolean
- #find ⇒ Object
-
#initialize(matcher, term_map, rank_multiplier, term_multiplier, limit_reduction_factor, type_reduction_factor, matchidx = 0) ⇒ Result
constructor
A new instance of Result.
- #list_map_words ⇒ Object
Constructor Details
#initialize(matcher, term_map, rank_multiplier, term_multiplier, limit_reduction_factor, type_reduction_factor, matchidx = 0) ⇒ Result
Returns a new instance of Result.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/indexed_search/match/result.rb', line 8 def initialize(matcher, term_map, rank_multiplier, term_multiplier, limit_reduction_factor, type_reduction_factor, matchidx=0) self.matcher = matcher self.term_map = term_map self.rank_multiplier = rank_multiplier self.term_multiplier = term_multiplier self.limit_reduction_factor = limit_reduction_factor self.type_reduction_factor = type_reduction_factor self.matchidx = matchidx self.list_map = Hash.new { |hash,key| hash[key] = [] } self.reduced_by_limit_reduction_factor = false self.ignored_because_already_used = [] end |
Instance Attribute Details
#ignored_because_already_used ⇒ Object
populated by result list class
29 30 31 |
# File 'lib/indexed_search/match/result.rb', line 29 def ignored_because_already_used @ignored_because_already_used end |
#limit_reduction_factor ⇒ Object
Returns the value of attribute limit_reduction_factor.
7 8 9 |
# File 'lib/indexed_search/match/result.rb', line 7 def limit_reduction_factor @limit_reduction_factor end |
#list_map ⇒ Object
populated by result list class
29 30 31 |
# File 'lib/indexed_search/match/result.rb', line 29 def list_map @list_map end |
#matcher ⇒ Object
Returns the value of attribute matcher.
7 8 9 |
# File 'lib/indexed_search/match/result.rb', line 7 def matcher @matcher end |
#matchidx ⇒ Object
Returns the value of attribute matchidx.
7 8 9 |
# File 'lib/indexed_search/match/result.rb', line 7 def matchidx @matchidx end |
#rank_multiplier ⇒ Object
Returns the value of attribute rank_multiplier.
7 8 9 |
# File 'lib/indexed_search/match/result.rb', line 7 def rank_multiplier @rank_multiplier end |
#reduced_by_limit_reduction_factor ⇒ Object
populated by result list class
29 30 31 |
# File 'lib/indexed_search/match/result.rb', line 29 def reduced_by_limit_reduction_factor @reduced_by_limit_reduction_factor end |
#term_map ⇒ Object
Returns the value of attribute term_map.
7 8 9 |
# File 'lib/indexed_search/match/result.rb', line 7 def term_map @term_map end |
#term_multiplier ⇒ Object
Returns the value of attribute term_multiplier.
7 8 9 |
# File 'lib/indexed_search/match/result.rb', line 7 def term_multiplier @term_multiplier end |
#type_reduction_factor ⇒ Object
Returns the value of attribute type_reduction_factor.
7 8 9 |
# File 'lib/indexed_search/match/result.rb', line 7 def type_reduction_factor @type_reduction_factor end |
Instance Method Details
#empty? ⇒ Boolean
24 25 26 |
# File 'lib/indexed_search/match/result.rb', line 24 def empty? find.empty? end |
#find ⇒ Object
20 21 22 23 |
# File 'lib/indexed_search/match/result.rb', line 20 def find # TODO: I don't think this select should be necessary for everything, right? @find ||= matcher.find.select { |id, count, rank, *matches| term_map.has_key?(matches[matchidx]) } end |
#list_map_words ⇒ Object
31 32 33 |
# File 'lib/indexed_search/match/result.rb', line 31 def list_map_words list_map.values.flatten.uniq end |