Class: GoogleMiniSearchEnginePortlet
- Inherits:
-
Cms::Portlet
- Object
- Cms::Portlet
- GoogleMiniSearchEnginePortlet
- Defined in:
- app/portlets/google_mini_search_engine_portlet.rb
Instance Method Summary collapse
-
#narrow_your_search? ⇒ Boolean
Handles the fact that all portlet attributes, including checkboxes like enable_your_search are stored as strings.
- #render ⇒ Object
Instance Method Details
#narrow_your_search? ⇒ Boolean
Handles the fact that all portlet attributes, including checkboxes like enable_your_search are stored as strings.
24 25 26 |
# File 'app/portlets/google_mini_search_engine_portlet.rb', line 24 def narrow_your_search? self.enable_narrow_your_search == "1" end |
#render ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/portlets/google_mini_search_engine_portlet.rb', line 5 def render @site = params[:site] @start = params[:start] ? params[:start].to_i : 0 = {:start => @start, :portlet => self, :site=>@site, :sort=>params[:sort]} query_string = params[:query] @results = SearchResult.find(query_string, .clone) # Need to clone, so that :portlet isn't removed for the 2nd call. # This is temporary, while the API is being reworked. Ideally, the search results would contain a reference # to the query, so that two X calls isn't needed. @query = SearchResult.create_query(query_string, .clone) if narrow_your_search? @appliance = SearchResult.new_gsa(self) @suggested_queries = @appliance.find_narrow_search_results(query_string) end end |