Class: SolrLite::ExplainEntry
- Inherits:
-
Object
- Object
- SolrLite::ExplainEntry
- Defined in:
- lib/explain_entry.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#matches ⇒ Object
Returns the value of attribute matches.
-
#score ⇒ Object
Returns the value of attribute score.
-
#text ⇒ Object
Returns the value of attribute text.
-
#top_matches ⇒ Object
Returns the value of attribute top_matches.
Instance Method Summary collapse
-
#initialize(key, text) ⇒ ExplainEntry
constructor
A new instance of ExplainEntry.
Constructor Details
#initialize(key, text) ⇒ ExplainEntry
Returns a new instance of ExplainEntry.
5 6 7 8 9 10 11 12 |
# File 'lib/explain_entry.rb', line 5 def initialize(key, text) @key = key # get rid of this one extraneous linebreak that Solr includes @text = text.gsub("\n), product of:", ", product of:") @matches = get_matches(@text) @score = @matches.first.split(" ").first @top_matches = get_top_matches(@matches) end |
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
3 4 5 |
# File 'lib/explain_entry.rb', line 3 def key @key end |
#matches ⇒ Object
Returns the value of attribute matches.
3 4 5 |
# File 'lib/explain_entry.rb', line 3 def matches @matches end |
#score ⇒ Object
Returns the value of attribute score.
3 4 5 |
# File 'lib/explain_entry.rb', line 3 def score @score end |
#text ⇒ Object
Returns the value of attribute text.
3 4 5 |
# File 'lib/explain_entry.rb', line 3 def text @text end |
#top_matches ⇒ Object
Returns the value of attribute top_matches.
3 4 5 |
# File 'lib/explain_entry.rb', line 3 def top_matches @top_matches end |