Use Google's API to search your rails site
In search controller...
def search require 'soap/wsdlDriver' @title = 'Search Results' key = 'YOUR GOOGLE API KEY HERE' yoursite = 'YOUR SITE ADDRESS HERE' driver = SOAP::WSDLDriverFactory.new("http://api.google.com/GoogleSearch.wsdl").createDriver @results = driver.doGoogleSearch(key, @params['term']+" site:#{yoursite}", 0, 10, true, " ", false, " ", " ", " ") end
The above expects to be called with a request parameter 'term' containing the actual search terms.
Then in your view (e.g. search.rhtml)...
<% for result in @results.resultElements %>><%= result.title %>
<%
= result.snippet %>> <p><a href="<%= result.URL %>"><%= result.URL %> <% end %>
Needs to be extended to handle paging the results but you get the idea.