Class: SolrLite::ExplainEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/explain_entry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#keyObject

Returns the value of attribute key.



3
4
5
# File 'lib/explain_entry.rb', line 3

def key
  @key
end

#matchesObject

Returns the value of attribute matches.



3
4
5
# File 'lib/explain_entry.rb', line 3

def matches
  @matches
end

#scoreObject

Returns the value of attribute score.



3
4
5
# File 'lib/explain_entry.rb', line 3

def score
  @score
end

#textObject

Returns the value of attribute text.



3
4
5
# File 'lib/explain_entry.rb', line 3

def text
  @text
end

#top_matchesObject

Returns the value of attribute top_matches.



3
4
5
# File 'lib/explain_entry.rb', line 3

def top_matches
  @top_matches
end