simple passthrough query version

This commit is contained in:
Dan Buch 2011-08-31 09:13:52 -04:00
parent 95591f4484
commit 1699dce6cb
2 changed files with 23 additions and 2 deletions

View File

@ -1,5 +1,17 @@
require 'open-uri'
class SolrController < ApplicationController class SolrController < ApplicationController
$select_url = 'http://localhost:8983/solr/select/'
def index def index
@search = request[:q]
if @search != nil
@results = open("#{$select_url}?q=#{@search}&indent=on").read
end
end
def browse
end end
end end

View File

@ -1,2 +1,11 @@
<h1>Solr#index</h1> <h1>Find Stuff!</h1>
<p>Find me in app/views/solr/index.html.erb</p>
<form action="" method="get" name="query">
<input type="text" name="q" value="<%= @search || "" %>"/>
<input type="submit" value="Search" />
</form>
<% if @results %>
<p>Results for &ldquo;<%= @search %>&rdquo;:</p>
<pre><%= h(@results) %></pre>
<% end %>