diff --git a/web/app/views/search/index.html.erb b/web/app/views/search/index.html.erb index a5626a112..3b3794fbe 100644 --- a/web/app/views/search/index.html.erb +++ b/web/app/views/search/index.html.erb @@ -1,4 +1,5 @@ -<%= form :action => url(:controller => "search", :action => "query") do %> +<%= form :action => url(:controller => "search", :action => "query"), + :method => :getvn do %> <%= text_field :name => "q", :label => "Query" %> <%= submit "Search" %> <% end =%> diff --git a/web/app/views/search/query.html.erb b/web/app/views/search/query.html.erb index 3456f9450..40885632b 100644 --- a/web/app/views/search/query.html.erb +++ b/web/app/views/search/query.html.erb @@ -1,12 +1,18 @@ -<%= form :action => url(:controller => "search", :action => "query") do %> - <%= text_field :name => "q", :label => "Query", :value => escape_html(params[:q]) %> +<%= form :action => url(:controller => "search", :action => "query"), + :method => :get do %> + <%= text_field :name => "q", :label => "Query" %> <%= submit "Search" %> <% end =%> -
-

Hits: <%= @searchclient.hits %>

-
+

Results <%= params[:offset] %> - <%= params[:offset] + params[:limit] %> of <%= @searchclient.hits %> for <%= params[:q] %>

+<% if params[:offset] > 0 %> + <%= link_to "prev", url(:controller => "search", :action => "query", :q => params[:q], :offset => [0, params[:offset] - params[:limit]].max, :limit => params[:limit]) %> +<% end %> +<% if params[:offset] + params[:limit] < @searchclient.hits %> +<%= link_to "next", url(:controller => "search", :action => "query", :q => params[:q], :offset => [@searchclient.hits - params[:limit], params[:offset] + params[:limit]].min, :limit => params[:limit]) %> +<% end %> +
 <%=h @searchclient.results.join("\n") %>