Class: GSA::SuggestedQueries

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

Overview

Represents a set of suggested search terms, based on results from a GSA. AKA DynamicResultClusters

Defined Under Namespace

Classes: Suggestion

Instance Method Summary collapse

Constructor Details

#initialize(xml_as_string) ⇒ SuggestedQueries

Returns a new instance of SuggestedQueries.



55
56
57
58
59
60
61
62
# File 'lib/bcms_google_mini_search/gsa.rb', line 55

def initialize(xml_as_string)
  @clusters = []
  doc = REXML::Document.new(xml_as_string)
  doc.elements.each('toplevel/Response/cluster/gcluster') do |ele|
    @clusters << Suggestion.new(ele.elements["label"].attributes["data"])
  end

end