moving the simple query thingy into a different method/view so that I can turn the index method/view into something more like the Solr builtin browse view

This commit is contained in:
Dan Buch 2011-08-31 15:46:18 -04:00
parent b47a145ef6
commit 048b3881f9
3 changed files with 20 additions and 16 deletions

View File

@ -5,7 +5,7 @@ require 'rexml/document'
class SolrController < ApplicationController class SolrController < ApplicationController
include SolrHelper include SolrHelper
def index def simple_query
@search = request[:q] @search = request[:q]
@results = [] @results = []
if @search != nil if @search != nil
@ -13,4 +13,6 @@ class SolrController < ApplicationController
end end
end end
def index
end
end end

View File

@ -1,15 +1 @@
<h1>Find Stuff!</h1> <h1>Index</h1>
<form action="" method="get" name="query">
<input type="text" name="q" value="<%= @search || "" %>"/>
<input type="submit" value="Search" />
</form>
<% if @results.length %>
<p>Results for &ldquo;<%= @search %>&rdquo;:</p>
<ul>
<% @results.each do |result| %>
<li><strong><%= result[:id] %></strong>: <%= result[:description] %></li>
<% end %>
</ul>
<% end %>

View File

@ -0,0 +1,16 @@
<h1>Find Stuff!</h1>
<form action="" method="get" name="query">
<input type="text" name="q" value="<%= @search || "" %>"/>
<input type="submit" value="Search" />
</form>
<% if @results.length %>
<p>Results for &ldquo;<%= @search %>&rdquo;:</p>
<ul>
<% @results.each do |result| %>
<li><strong><%= result[:id] %></strong>: <%= result[:description] %></li>
<% end %>
</ul>
<% end %>