diff --git a/rails/hamster/app/controllers/solr_controller.rb b/rails/hamster/app/controllers/solr_controller.rb index dc7b0cb..fa82c29 100644 --- a/rails/hamster/app/controllers/solr_controller.rb +++ b/rails/hamster/app/controllers/solr_controller.rb @@ -1,5 +1,17 @@ +require 'open-uri' + + class SolrController < ApplicationController + $select_url = 'http://localhost:8983/solr/select/' + def index + @search = request[:q] + if @search != nil + @results = open("#{$select_url}?q=#{@search}&indent=on").read + end + end + + def browse end end diff --git a/rails/hamster/app/views/solr/index.html.erb b/rails/hamster/app/views/solr/index.html.erb index c26ffac..b3454e8 100644 --- a/rails/hamster/app/views/solr/index.html.erb +++ b/rails/hamster/app/views/solr/index.html.erb @@ -1,2 +1,11 @@ -

Solr#index

-

Find me in app/views/solr/index.html.erb

+

Find Stuff!

+ +
+ "/> + +
+ +<% if @results %> +

Results for “<%= @search %>”:

+
<%= h(@results) %>
+<% end %>