class Sunspot::Search::Spellcheck::Collation

TODO: Firm up the names of these a bit

Attributes

hits[R]
query[R]
suggestions[R]

Public Class Methods

new(args = {}) click to toggle source
# File lib/sunspot_suggest/sunspot/search/abstract_search.rb, line 11
def initialize(args = {})
  @query = args['collationQuery']
  @hits = args['hits']
  @suggestions = parse_corrections(args['misspellingsAndCorrections'])
end

Private Instance Methods

parse_corrections(raw) click to toggle source
# File lib/sunspot_suggest/sunspot/search/abstract_search.rb, line 19
def parse_corrections(raw)
  suggestions = []
  raw.each_slice(2) do |k, v|
    suggestions << Suggestions.new(k, [Suggestion.new(v)])
  end
  suggestions
end