diff --git a/web/app/controllers/search.rb b/web/app/controllers/search.rb
index f5fbbf512..e2edbafd5 100644
--- a/web/app/controllers/search.rb
+++ b/web/app/controllers/search.rb
@@ -36,16 +36,20 @@ class Search < Application
end
def query
+ params[:offset] = (params[:offset] ? params[:offset].to_i : 0) rescue 0
+ params[:limit] = (params[:limit] ? params[:limit].to_i : 20) rescue 20
+ params[:log_type] = (params[:log_type] or "linux-syslog")
@searchclient = SearchClient.new(host="localhost", port=61613)
msg = LogStash::Net::Messages::SearchHitsRequest.new
- msg.log_type = (params[:log_type] or "linux-syslog")
+ msg.log_type = params[:log_type]
msg.query = params[:q]
@searchclient.sendmsg("/queue/logstash", msg)
msg = LogStash::Net::Messages::SearchRequest.new
msg.log_type = (params[:log_type] or "linux-syslog")
msg.query = params[:q]
- msg.limit = 20
+ msg.offset = params[:offset]
+ msg.limit = params[:limit]
@searchclient.sendmsg("/queue/logstash", msg)
Timeout.timeout(10) do
diff --git a/web/app/views/search/index.html.erb b/web/app/views/search/index.html.erb
index 3b3794fbe..6e47aad21 100644
--- a/web/app/views/search/index.html.erb
+++ b/web/app/views/search/index.html.erb
@@ -1,5 +1,8 @@
<%= form :action => url(:controller => "search", :action => "query"),
- :method => :getvn do %>
- <%= text_field :name => "q", :label => "Query" %>
+ :method => :get do %>
+<%= text_field :name => "q", :label => "Query", :value => escape_html(params[:q]), :size => 100 %>
+
+ <%= text_field :name => "log_type", :label => "log type", :value => params[:log_type] %>
+
<%= submit "Search" %>
<% end =%>
diff --git a/web/app/views/search/query.html.erb b/web/app/views/search/query.html.erb
index 40885632b..411ee910b 100644
--- a/web/app/views/search/query.html.erb
+++ b/web/app/views/search/query.html.erb
@@ -1,16 +1,19 @@
<%= form :action => url(:controller => "search", :action => "query"),
:method => :get do %>
- <%= text_field :name => "q", :label => "Query" %>
+<%= text_field :name => "q", :label => "Query", :value => escape_html(params[:q]), :size => 100 %>
+
+ <%= text_field :name => "log_type", :label => "log type", :value => escape_html(params[:log_type]) %>
+
<%= submit "Search" %>
<% end =%>